File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed
Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -149,20 +149,16 @@ public IEnumerable<FormatDescriptor> GetStreamControlFormats()
149149 while ( current . HasValue )
150150 {
151151 var cur = current . Value ;
152- var numFrameDescriptors = cur . bNumFrameDescriptors ;
153- if ( numFrameDescriptors > 0 )
152+ var frameDesc = cur . CreateFrameDescs ( ) ;
153+ while ( frameDesc . HasValue )
154154 {
155- var frameDesc = cur . CreateFrameDescs ( ) ;
156- while ( frameDesc . HasValue )
157- {
158- result . Add ( new FormatDescriptor
159- {
160- Width = frameDesc . Value . wWidth ,
161- Height = frameDesc . Value . wHeight
162- }
163- ) ;
164- frameDesc = frameDesc . Value . CreateNext ( ) ;
165- }
155+ result . Add ( new FormatDescriptor
156+ {
157+ Width = frameDesc . Value . wWidth ,
158+ Height = frameDesc . Value . wHeight
159+ }
160+ ) ;
161+ frameDesc = frameDesc . Value . CreateNext ( ) ;
166162 }
167163 current = current . Value . CreateNext ( ) ;
168164 }
Original file line number Diff line number Diff line change @@ -101,6 +101,15 @@ public struct Frame
101101 public long TvUsec ;
102102 public IntPtr Source ;
103103 public byte LibraryOwnsData ;
104+
105+ public byte [ ] GetData ( )
106+ {
107+ var dataSize = DataBytes . ToInt32 ( ) ;
108+ if ( dataSize <= 0 ) return [ ] ;
109+ var buffer = new byte [ dataSize ] ;
110+ Marshal . Copy ( Data , buffer , 0 , dataSize ) ;
111+ return buffer ;
112+ }
104113}
105114
106115[ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
You can’t perform that action at this time.
0 commit comments