public static VTDecompressionSession Create(VTDecompressionOutputCallback outputCallback,
                                             CMVideoFormatDescription formatDescription,
                                             VTVideoDecoderSpecification decoderSpecification,          // hardware acceleration is default behavior on iOS. no opt-in required.
                                             CVPixelBufferAttributes destinationImageBufferAttributes)
 {
     return(Create(outputCallback, formatDescription, decoderSpecification, destinationImageBufferAttributes == null ? null : destinationImageBufferAttributes.Dictionary, static_newDecompressionOutputCallback));
 }
        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);
        }
Пример #3
0
		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;
		}
Пример #4
0
		public static VTDecompressionSession Create (VTDecompressionOutputCallback outputCallback,
							     CMVideoFormatDescription formatDescription,
							     VTVideoDecoderSpecification decoderSpecification, // hardware acceleration is default behavior on iOS. no opt-in required.
							     CVPixelBufferAttributes destinationImageBufferAttributes)
		{
			return Create (outputCallback, formatDescription, decoderSpecification, destinationImageBufferAttributes == null ? null : destinationImageBufferAttributes.Dictionary, static_newDecompressionOutputCallback);
		}