public unsafe CMSampleTimingInfo [] GetSampleTimingInfo(out OSStatus status) { nint count; status = 0; if (handle == IntPtr.Zero) { return(null); } if ((status = CMSampleBufferGetSampleTimingInfoArray(handle, 0, null, out count)) != 0) { return(null); } CMSampleTimingInfo [] pInfo = new CMSampleTimingInfo [count]; if (count == 0) { return(pInfo); fixed(CMSampleTimingInfo *info = pInfo) if ((status = CMSampleBufferGetSampleTimingInfoArray(handle, count, info, out count)) != 0) { return(null); } return(pInfo); }
static extern /* OSStatus */ CMSampleBufferError CMSampleBufferCreateForImageBuffer( /* CFAllocatorRef */ IntPtr allocator, /* CVImageBufferRef */ IntPtr imageBuffer, /* Boolean */ bool dataReady, /* CMSampleBufferMakeDataReadyCallback */ IntPtr makeDataReadyCallback, /* void* */ IntPtr makeDataReadyRefcon, /* CMVideoFormatDescriptionRef */ IntPtr formatDescription, /* const CMSampleTimingInfo* */ ref CMSampleTimingInfo sampleTiming, /* CMSampleBufferRef* */ out IntPtr bufOut );
public static CMSampleBuffer CreateReadyWithImageBuffer (CVImageBuffer imageBuffer, CMFormatDescription formatDescription, CMSampleTimingInfo[] sampleTiming, out CMSampleBufferError error) { if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); if (formatDescription == null) throw new ArgumentNullException ("formatDescription"); IntPtr buffer; error = CMSampleBufferCreateReadyWithImageBuffer (IntPtr.Zero, imageBuffer.handle, formatDescription.Handle, sampleTiming, out buffer); if (error != CMSampleBufferError.None) return null; return new CMSampleBuffer (buffer, true); }
extern static /* OSStatus */ CMSampleBufferError CMSampleBufferCreateReadyWithImageBuffer ( /* CFAllocatorRef */ IntPtr allocator, /* CVImageBufferRef */ IntPtr imageBuffer, /* CMFormatDescriptionRef */ IntPtr formatDescription, // not null CMSampleTimingInfo[] sampleTiming, /* CMSampleBufferRef* */ out IntPtr sBufOut);
public static CMSampleBuffer CreateReady (CMBlockBuffer dataBuffer, CMFormatDescription formatDescription, int samplesCount, CMSampleTimingInfo[] sampleTimingArray, nuint[] sampleSizeArray, out CMSampleBufferError error) { if (dataBuffer == null) throw new ArgumentNullException ("dataBuffer"); if (samplesCount < 0) throw new ArgumentOutOfRangeException ("samplesCount"); IntPtr buffer; var fdh = formatDescription == null ? IntPtr.Zero : formatDescription.Handle; var timingCount = sampleTimingArray == null ? 0 : sampleTimingArray.Length; var sizeCount = sampleSizeArray == null ? 0 : sampleSizeArray.Length; error = CMSampleBufferCreateReady (IntPtr.Zero, dataBuffer.handle, fdh, samplesCount, timingCount, sampleTimingArray, sizeCount, sampleSizeArray, out buffer); if (error != CMSampleBufferError.None) return null; return new CMSampleBuffer (buffer, true); }
extern static /* OSStatus */ CMSampleBufferError CMSampleBufferCreateReady ( /* CFAllocatorRef */ IntPtr allocator, /* CMBlockBufferRef */ IntPtr dataBuffer, /* CMFormatDescriptionRef */ IntPtr formatDescription, // can be null /* CMItemCount */ nint numSamples, // can be 0 /* CMItemCount */ nint numSampleTimingEntries, // 0, 1 or numSamples CMSampleTimingInfo[] sampleTimingArray, // can be null /* CMItemCount */ nint numSampleSizeEntries, // 0, 1 or numSamples /* size_t* */ nuint[] sampleSizeArray, // can be null /* CMSampleBufferRef* */ out IntPtr sBufOut);
public unsafe CMSampleTimingInfo [] GetSampleTimingInfo (out OSStatus status) { nint count; status = 0; if (handle == IntPtr.Zero) return null; if ((status = CMSampleBufferGetSampleTimingInfoArray (handle, 0, null, out count)) != 0) return null; CMSampleTimingInfo [] pInfo = new CMSampleTimingInfo [count]; if (count == 0) return pInfo; fixed (CMSampleTimingInfo* info = pInfo) if ((status = CMSampleBufferGetSampleTimingInfoArray (handle, count, info, out count)) != 0) return null; return pInfo; }
unsafe static extern OSStatus CMSampleBufferGetSampleTimingInfoArray ( /* CMSampleBufferRef */ IntPtr sbuf, /* CMItemCount */ nint timingArrayEntries, CMSampleTimingInfo* timingArrayOut, /* CMItemCount* */ out nint timingArrayEntriesNeededOut );
public static CMSampleBuffer CreateForImageBuffer (CVImageBuffer imageBuffer, bool dataReady, CMVideoFormatDescription formatDescription, CMSampleTimingInfo sampleTiming, out CMSampleBufferError error) { if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); if (formatDescription == null) throw new ArgumentNullException ("formatDescription"); IntPtr buffer; error = CMSampleBufferCreateForImageBuffer (IntPtr.Zero, imageBuffer.handle, dataReady, IntPtr.Zero, IntPtr.Zero, formatDescription.handle, ref sampleTiming, out buffer); if (error != CMSampleBufferError.None) return null; return new CMSampleBuffer (buffer, true); }
static extern /* OSStatus */ CMSampleBufferError CMSampleBufferCreateForImageBuffer ( /* CFAllocatorRef */ IntPtr allocator, /* CVImageBufferRef */ IntPtr imageBuffer, /* Boolean */ bool dataReady, /* CMSampleBufferMakeDataReadyCallback */ IntPtr makeDataReadyCallback, /* void* */ IntPtr makeDataReadyRefcon, /* CMVideoFormatDescriptionRef */ IntPtr formatDescription, /* const CMSampleTimingInfo* */ ref CMSampleTimingInfo sampleTiming, /* CMSampleBufferRef* */ out IntPtr bufOut );
public unsafe static CMSampleBuffer CreateWithNewTiming (CMSampleBuffer original, CMSampleTimingInfo [] timing, out OSStatus status) { if (original == null) throw new ArgumentNullException ("original"); nint count = timing == null ? 0 : timing.Length; IntPtr handle; fixed (CMSampleTimingInfo *t = timing) if ((status = CMSampleBufferCreateCopyWithNewTiming (IntPtr.Zero, original.Handle, count, t, out handle)) != 0) return null; return new CMSampleBuffer (handle, true); }
public static CMSampleBuffer CreateWithNewTiming (CMSampleBuffer original, CMSampleTimingInfo [] timing) { OSStatus status; return CreateWithNewTiming (original, timing, out status); }
unsafe static extern OSStatus CMSampleBufferCreateCopyWithNewTiming ( /* CFAllocatorRef */ IntPtr allocator, /* CMSampleBufferRef */ IntPtr originalSBuf, /* CMItemCount */ nint numSampleTimingEntries, CMSampleTimingInfo* sampleTimingArray, /* CMSampleBufferRef* */ out IntPtr sBufCopyOut );
public static CMSampleBuffer CreateForImageBuffer(CVImageBuffer imageBuffer, bool dataReady, CMVideoFormatDescription formatDescription, CMSampleTimingInfo sampleTiming, out CMSampleBufferError error) { if (imageBuffer == null) { throw new ArgumentNullException("imageBuffer"); } if (formatDescription == null) { throw new ArgumentNullException("formatDescription"); } IntPtr buffer; error = CMSampleBufferCreateForImageBuffer(IntPtr.Zero, imageBuffer.handle, dataReady, IntPtr.Zero, IntPtr.Zero, formatDescription.handle, ref sampleTiming, out buffer); if (error != CMSampleBufferError.None) { return(null); } return(new CMSampleBuffer(buffer, true)); }