public CVPixelBuffer CopyPixelBuffer(CMTime itemTime, ref CMTime outItemTimeForDisplay) { var ptr = WeakCopyPixelBuffer (itemTime, ref outItemTimeForDisplay); if (ptr == IntPtr.Zero) return null; return new CVPixelBuffer (ptr, true); }
static void DecompressionCallback (IntPtr outputCallbackClosure, IntPtr sourceFrame, VTStatus status, VTDecodeInfoFlags infoFlags, IntPtr imageBufferPtr, CMTime presentationTimeStamp, CMTime presentationDuration) { var gch = GCHandle.FromIntPtr (outputCallbackClosure); var func = (VTDecompressionOutputCallback) gch.Target; // Apple headers states that the callback should get a CVImageBuffer but it turned out that not all of them are a // CVImageBuffer, some can be instances of CVImageBuffer and others can be instances of CVPixelBuffer. So we go one // step further in the inheritance hierarchy and supply the callback a CVPixelBuffer and the callback supplies // to the developer a CVImageBuffer, so the developer can choose when to use one or the other and we mimic // what Apple provides on its headers. using (var sampleBuffer = new CVPixelBuffer (imageBufferPtr)) { func (sourceFrame, status, infoFlags, sampleBuffer, presentationTimeStamp, presentationDuration); } }
extern static /* Float64 */ double CMTimeGetSeconds(CMTime time);
public static CMTime Subtract(CMTime minuend, CMTime subtraend) { return(CMTimeSubtract(minuend, subtraend)); }
public VTStatus CompleteFrames (CMTime completeUntilPresentationTimeStamp) { if (Handle == IntPtr.Zero) throw new ObjectDisposedException ("CompressionSession"); return VTCompressionSessionCompleteFrames (Handle, completeUntilPresentationTimeStamp); }
public static CMTime Multiply(CMTime time, int multiplier, int divisor) { return CMTimeMultiplyByRatio (time, multiplier, divisor); }
extern static /* OSStatus */ CMSampleBufferError CMSampleBufferSetOutputPresentationTimeStamp (/* CMSampleBufferRef */ IntPtr sbuf, CMTime outputPresentationTimeStamp);
static extern CMTime CMTimeMultiply(CMTime time, /* int32_t */ int multiplier);
public static int Compare(CMTime time1, CMTime time2) { return CMTimeCompare (time1, time2); }
static extern CMTime CMTimeAbsoluteValue(CMTime time);
static extern IntPtr CMTimeCopyAsDictionary(CMTime time, /* CFAllocatorRef */ IntPtr allocator);
public static CMTime Multiply(CMTime time, int multiplier, int divisor) { return(CMTimeMultiplyByRatio(time, multiplier, divisor)); }
extern static CMTime CMTimeConvertScale(CMTime time, /* int32_t */ int newScale, CMTimeRoundingMethod method);
extern static CMTime CMTimeMultiplyByRatio(CMTime time, /* int32_t */ int multiplier, /* int32_t */ int divisor);
public static CMTime Multiply(CMTime time, double multiplier) { return(CMTimeMultiplyByFloat64(time, multiplier)); }
extern static CMTime CMTimeMultiplyByFloat64(CMTime time, /* Float64 */ double multiplier);
public static CMTime Multiply(CMTime time, int multiplier) { return(CMTimeMultiply(time, multiplier)); }
extern static CMTime CMTimeMultiply(CMTime time, /* int32_t */ int multiplier);
static extern int CMTimeCompare(CMTime time1, CMTime time2);
extern static CMTime CMTimeMinimum(CMTime time1, CMTime time2);
static extern double CMTimeGetSeconds(CMTime time);
public static CMTime GetMinimum(CMTime time1, CMTime time2) { return(CMTimeMinimum(time1, time2)); }
static extern CMTime CMTimeMultiplyByRatio(CMTime time, /* int32_t */ int multiplier, /* int32_t */ int divisor);
extern static /* CFDictionaryRef */ IntPtr CMTimeCopyAsDictionary(CMTime time, /* CFAllocatorRef */ IntPtr allocator);
public static CMTime Multiply(CMTime time, int multiplier) { return CMTimeMultiply (time, multiplier); }
extern static /* CFStringRef */ IntPtr CMTimeCopyDescription(/* CFAllocatorRef */ IntPtr allocator, CMTime time);
public virtual bool InsertTimeRanges(NSValue cmTimeRanges, AVAssetTrack[] tracks, CMTime startTime, out NSError error) { return InsertTimeRanges (new NSValue [] { cmTimeRanges }, tracks, startTime, out error); }
public extern static /* uint64_t */ ulong ConvertHostTimeToSystemUnits(CMTime hostTime);
extern static /* OSStatus */ CMSampleBufferError CMAudioSampleBufferCreateReadyWithPacketDescriptions ( /* CFAllocatorRef */ IntPtr allocator, /* CMBlockBufferRef */ IntPtr dataBuffer, /* CMFormatDescriptionRef */ IntPtr formatDescription, /* CMItemCount */ nint numSamples, CMTime sbufPTS, /* AudioStreamPacketDescription* */ AudioStreamPacketDescription[] packetDescriptions, /* CMSampleBufferRef* */ out IntPtr sBufOut);
extern static /* OSStatus */ CMTimebaseError CMTimebaseSetTime(/* CMTimebaseRef */ IntPtr timebase, CMTime time);
extern static VTStatus VTCompressionSessionCompleteFrames (IntPtr session, CMTime completeUntilPresentationTimeStamp);
extern static /* OSStatus */ CMTimebaseError CMTimebaseSetAnchorTime(/* CMTimebaseRef */ IntPtr timebase, CMTime timebaseTime, CMTime immediateMasterTime);
static unsafe void VTDecompressionOutputHandlerTrampoline (BlockLiteral *block, VTStatus status, VTDecodeInfoFlags infoFlags, IntPtr imageBuffer, CMTime presentationTimeStamp, CMTime presentationDuration) { var del = (VTDecompressionOutputHandler)(block->Target); if (del != null) del (status, infoFlags, new CVImageBuffer (imageBuffer), presentationTimeStamp, presentationDuration); }
public CMTimebaseError SetAnchorTime(CMTime timebaseTime, CMTime immediateMasterTime) { return(CMTimebaseSetAnchorTime(Handle, timebaseTime, immediateMasterTime)); }
public static CMTime Add(CMTime time1, CMTime time2) { return CMTimeAdd (time1, time2); }
extern static /* OSStatus */ CMTimebaseError CMTimebaseGetTimeAndRate(/* CMTimebaseRef */ IntPtr timebase, out CMTime time, /* Float64* */ out double rate);
static extern CMTime CMTimeAdd(CMTime addend1, CMTime addend2);
public CMTimebaseError GetTimeAndRate(out CMTime time, out double rate) { return(CMTimebaseGetTimeAndRate(Handle, out time, out rate)); }
static extern CMTime CMTimeConvertScale(CMTime time, /* int32_t */ int newScale, CMTimeRoundingMethod method);
extern static /* OSStatus */ CMTimebaseError CMTimebaseSetRateAndAnchorTime(/* CMTimebaseRef */ IntPtr timebase, /* Float64 */ double rate, CMTime timebaseTime, CMTime immediateMasterTime);
static extern IntPtr CMTimeCopyDescription(/* CFAllocatorRef */ IntPtr allocator, CMTime time);
public CMTimebaseError SetRateAndAnchorTime(double rate, CMTime timebaseTime, CMTime immediateMasterTime) { return(CMTimebaseSetRateAndAnchorTime(Handle, rate, timebaseTime, immediateMasterTime)); }
static extern CMTime CMTimeMinimum(CMTime time1, CMTime time2);
extern static /* OSStatus */ CMTimebaseError CMTimebaseSetTimerNextFireTime(/* CMTimebaseRef */ IntPtr timebase, /* CFRunLoopTimerRef */ IntPtr timer, CMTime fireTime, /* uint32_t */ uint flags);
static extern CMTime CMTimeMultiplyByFloat64(CMTime time, /* Float64 */ double multiplier);
extern static /* OSStatus */ CMSyncError CMSyncGetRelativeRateAndAnchorTime( /* CMClockOrTimebaseRef */ IntPtr ofClockOrTimebase, /* CMClockOrTimebaseRef */ IntPtr relativeToClockOrTimebase, /* Float64* */ out double outRelativeRate, out CMTime outOfClockOrTimebaseAnchorTime, out CMTime outRelativeToClockOrTimebaseAnchorTime);
static extern CMTime CMTimeSubtract(CMTime minuend, CMTime subtrahend);
public static CMSyncError GetRelativeRateAndAnchorTime(CMClockOrTimebase clockOrTimebaseA, CMClockOrTimebase clockOrTimebaseB, out double relativeRate, out CMTime timeA, out CMTime timeB) { if (clockOrTimebaseA == null) { throw new ArgumentNullException("clockOrTimebaseA"); } if (clockOrTimebaseB == null) { throw new ArgumentNullException("clockOrTimebaseB"); } return(CMSyncGetRelativeRateAndAnchorTime(clockOrTimebaseA.Handle, clockOrTimebaseB.handle, out relativeRate, out timeA, out timeB)); }
public static CMTime GetMinimum(CMTime time1, CMTime time2) { return CMTimeMinimum (time1, time2); }
extern static CMTime CMSyncConvertTime(CMTime time, /* CMClockOrTimebaseRef */ IntPtr fromClockOrTimebase, /* CMClockOrTimebaseRef */ IntPtr toClockOrTimebase);
public static CMTime Multiply(CMTime time, double multiplier) { return CMTimeMultiplyByFloat64 (time, multiplier); }
extern static /* OSStatus */ CMClockError CMClockGetAnchorTime(/* CMClockRef */ IntPtr clock, out CMTime outClockTime, out CMTime outReferenceClockTime);
public static CMTime Subtract(CMTime minuend, CMTime subtraend) { return CMTimeSubtract (minuend, subtraend); }
public CMClockError GetAnchorTime(out CMTime clockTime, out CMTime referenceClockTime) { return(CMClockGetAnchorTime(Handle, out clockTime, out referenceClockTime)); }
extern static CMSampleBufferError CMAudioSampleBufferCreateWithPacketDescriptions ( /* CFAllocatorRef */ IntPtr allocator, /* CMBlockBufferRef */ IntPtr dataBuffer, /* Boolean */ bool dataReady, /* CMSampleBufferMakeDataReadyCallback */ IntPtr makeDataReadyCallback, /* void */ IntPtr makeDataReadyRefcon, /* CMFormatDescriptionRef */ IntPtr formatDescription, /* CMItemCount */ nint numSamples, CMTime sbufPTS, /* AudioStreamPacketDescription* */ AudioStreamPacketDescription[] packetDescriptions, /* CMSampleBufferRef* */ out IntPtr sBufOut);
extern static /* OSStatus */ CMSampleBufferError CMSampleBufferSetOutputPresentationTimeStamp(/* CMSampleBufferRef */ IntPtr sbuf, CMTime outputPresentationTimeStamp);
public int SetOutputPresentationTimeStamp (CMTime outputPresentationTimeStamp) { return (int)CMSampleBufferSetOutputPresentationTimeStamp (handle, outputPresentationTimeStamp); }
public int SetOutputPresentationTimeStamp(CMTime outputPresentationTimeStamp) { return((int)CMSampleBufferSetOutputPresentationTimeStamp(handle, outputPresentationTimeStamp)); }
public static CMSampleBuffer CreateReadyWithPacketDescriptions (CMBlockBuffer dataBuffer, CMFormatDescription formatDescription, int samplesCount, CMTime sampleTimestamp, AudioStreamPacketDescription[] packetDescriptions, out CMSampleBufferError error) { if (dataBuffer == null) throw new ArgumentNullException ("dataBuffer"); if (formatDescription == null) throw new ArgumentNullException ("formatDescription"); if (samplesCount <= 0) throw new ArgumentOutOfRangeException ("samplesCount"); IntPtr buffer; error = CMAudioSampleBufferCreateReadyWithPacketDescriptions (IntPtr.Zero, dataBuffer.handle, formatDescription.handle, samplesCount, sampleTimestamp, packetDescriptions, out buffer); if (error != CMSampleBufferError.None) return null; return new CMSampleBuffer (buffer, true); }
extern static CMTime CMTimeSubtract(CMTime minuend, CMTime subtrahend);