示例#1
0
 extern static VTStatus VTCompressionSessionCreate(
     /* CFAllocatorRef */ IntPtr allocator,             /* can be null */
     /* int32_t */ int width,
     /* int32_t */ int height,
     /* CMVideoCodecType */ CMVideoCodecType codecType,
     /* CFDictionaryRef */ IntPtr dictionaryEncoderSpecification,        /* can be null */
     /* CFDictionaryRef */ IntPtr dictionarySourceImageBufferAttributes, /* can be null */
     /* CFDictionaryRef */ IntPtr compressedDataAllocator,               /* can be null */
     /* VTCompressionOutputCallback */ CompressionOutputCallback outputCallback,
     /* void* */ IntPtr outputCallbackClosure,
     /* VTCompressionSessionRef* */ out IntPtr compressionSessionOut);
示例#2
0
        static VTCompressionSession Create(int width, int height, CMVideoCodecType codecType,
                                           VTCompressionOutputCallback compressionOutputCallback,
                                           VTVideoEncoderSpecification encoderSpecification,                                // hardware acceleration is default behavior on iOS. no opt-in required.
                                           NSDictionary sourceImageBufferAttributes, CompressionOutputCallback staticCback) // Undocumented options, probably always null
        {
            var callbackHandle = default(GCHandle);

            if (compressionOutputCallback != null)
            {
                callbackHandle = GCHandle.Alloc(compressionOutputCallback);
            }

            IntPtr ret;

            var result = VTCompressionSessionCreate(IntPtr.Zero, width, height, codecType,
                                                    encoderSpecification != null ? encoderSpecification.Dictionary.Handle : IntPtr.Zero,
                                                    sourceImageBufferAttributes != null ? sourceImageBufferAttributes.Handle : IntPtr.Zero,
                                                    IntPtr.Zero,
                                                    callbackHandle.IsAllocated ? (staticCback) : null,
                                                    GCHandle.ToIntPtr(callbackHandle),
                                                    out ret);

            if (result == VTStatus.Ok && ret != IntPtr.Zero)
            {
                return new VTCompressionSession(ret, true)
                       {
                           callbackHandle = callbackHandle
                       }
            }
            ;

            if (callbackHandle.IsAllocated)
            {
                callbackHandle.Free();
            }

            return(null);
        }
示例#3
0
		static VTCompressionSession Create (int width, int height, CMVideoCodecType codecType,
			VTCompressionOutputCallback compressionOutputCallback,
			VTVideoEncoderSpecification encoderSpecification, // hardware acceleration is default behavior on iOS. no opt-in required.
		        NSDictionary sourceImageBufferAttributes, CompressionOutputCallback staticCback) // Undocumented options, probably always null
		{
			var callbackHandle = default (GCHandle);
			if (compressionOutputCallback != null)
				callbackHandle = GCHandle.Alloc (compressionOutputCallback);

			IntPtr ret;

			var result = VTCompressionSessionCreate (IntPtr.Zero, width, height, codecType,
				encoderSpecification != null ? encoderSpecification.Dictionary.Handle : IntPtr.Zero,
				sourceImageBufferAttributes != null ? sourceImageBufferAttributes.Handle : IntPtr.Zero,
				IntPtr.Zero,
				callbackHandle.IsAllocated ? (staticCback) : null,
				GCHandle.ToIntPtr (callbackHandle),
	            out ret);

			if (result == VTStatus.Ok && ret != IntPtr.Zero)
				return new VTCompressionSession (ret, true) {
					callbackHandle = callbackHandle
				};

			if (callbackHandle.IsAllocated)
				callbackHandle.Free ();

			return null;
		}
示例#4
0
		extern static VTStatus VTCompressionSessionCreate (
			/* CFAllocatorRef */ IntPtr allocator, /* can be null */
			/* int32_t */ int width,
			/* int32_t */ int height,
			/* CMVideoCodecType */ CMVideoCodecType codecType,
			/* CFDictionaryRef */ IntPtr dictionaryEncoderSpecification, /* can be null */
			/* CFDictionaryRef */ IntPtr dictionarySourceImageBufferAttributes, /* can be null */
			/* CFDictionaryRef */ IntPtr compressedDataAllocator, /* can be null */
			/* VTCompressionOutputCallback */ CompressionOutputCallback outputCallback,
			/* void* */ IntPtr outputCallbackClosure,
			/* VTCompressionSessionRef* */ out IntPtr compressionSessionOut);