extern static VTStatus VTDecompressionSessionCreate( /* CFAllocatorRef */ IntPtr allocator, // can be null /* CMVideoFormatDescriptionRef */ IntPtr videoFormatDescription, /* CFDictionaryRef */ IntPtr videoDecoderSpecification, // can be null /* CFDictionaryRef */ IntPtr destinationImageBufferAttributes, // can be null /* const VTDecompressionOutputCallbackRecord* */ ref VTDecompressionOutputCallbackRecord outputCallback, /* VTDecompressionSessionRef* */ out IntPtr decompressionSessionOut);
static VTDecompressionSession Create(VTDecompressionOutputCallback outputCallback, CMVideoFormatDescription formatDescription, VTVideoDecoderSpecification decoderSpecification, // hardware acceleration is default behavior on iOS. no opt-in required. NSDictionary destinationImageBufferAttributes, DecompressionOutputCallback cback) { if (formatDescription == null) { throw new ArgumentNullException("formatDescription"); } var callbackHandle = GCHandle.Alloc(outputCallback); var callbackStruct = new VTDecompressionOutputCallbackRecord() { Proc = cback, DecompressionOutputRefCon = GCHandle.ToIntPtr(callbackHandle) }; IntPtr ret; var result = VTDecompressionSessionCreate(IntPtr.Zero, formatDescription.Handle, decoderSpecification != null ? decoderSpecification.Dictionary.Handle : IntPtr.Zero, destinationImageBufferAttributes != null ? destinationImageBufferAttributes.Handle : IntPtr.Zero, ref callbackStruct, out ret); if (result == VTStatus.Ok && ret != IntPtr.Zero) { return new VTDecompressionSession(ret, true) { callbackHandle = callbackHandle } } ; callbackHandle.Free(); return(null); }
static VTDecompressionSession Create (VTDecompressionOutputCallback outputCallback, CMVideoFormatDescription formatDescription, VTVideoDecoderSpecification decoderSpecification, // hardware acceleration is default behavior on iOS. no opt-in required. NSDictionary destinationImageBufferAttributes, DecompressionOutputCallback cback) { if (formatDescription == null) throw new ArgumentNullException ("formatDescription"); var callbackHandle = GCHandle.Alloc (outputCallback); var callbackStruct = new VTDecompressionOutputCallbackRecord () { Proc = cback, DecompressionOutputRefCon = GCHandle.ToIntPtr (callbackHandle) }; IntPtr ret; var result = VTDecompressionSessionCreate (IntPtr.Zero, formatDescription.Handle, decoderSpecification != null ? decoderSpecification.Dictionary.Handle : IntPtr.Zero, destinationImageBufferAttributes != null ? destinationImageBufferAttributes.Handle : IntPtr.Zero, ref callbackStruct, out ret); if (result == VTStatus.Ok && ret != IntPtr.Zero) return new VTDecompressionSession (ret, true) { callbackHandle = callbackHandle }; callbackHandle.Free (); return null; }
extern static VTStatus VTDecompressionSessionCreate ( /* CFAllocatorRef */ IntPtr allocator, // can be null /* CMVideoFormatDescriptionRef */ IntPtr videoFormatDescription, /* CFDictionaryRef */ IntPtr videoDecoderSpecification, // can be null /* CFDictionaryRef */ IntPtr destinationImageBufferAttributes, // can be null /* const VTDecompressionOutputCallbackRecord* */ ref VTDecompressionOutputCallbackRecord outputCallback, /* VTDecompressionSessionRef* */ out IntPtr decompressionSessionOut);