예제 #1
3
        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);
        }
예제 #2
0
 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
     );
예제 #3
0
		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);
		}
예제 #4
0
		extern static /* OSStatus */ CMSampleBufferError CMSampleBufferCreateReadyWithImageBuffer (
			/* CFAllocatorRef */ IntPtr allocator,
			/* CVImageBufferRef */ IntPtr imageBuffer,
			/* CMFormatDescriptionRef */ IntPtr formatDescription,	// not null
			CMSampleTimingInfo[] sampleTiming,
			/* CMSampleBufferRef* */ out IntPtr sBufOut);
예제 #5
0
		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);
		}
예제 #6
0
		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);
예제 #7
0
		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;
		}
예제 #8
0
		unsafe static extern OSStatus CMSampleBufferGetSampleTimingInfoArray (
			/* CMSampleBufferRef */ IntPtr sbuf,
			/* CMItemCount */ nint timingArrayEntries,
			CMSampleTimingInfo* timingArrayOut,
			/* CMItemCount* */ out nint timingArrayEntriesNeededOut
		);
예제 #9
0
		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);
		}
예제 #10
0
		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
		);
예제 #11
0
		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);
		}
예제 #12
0
		public static CMSampleBuffer CreateWithNewTiming (CMSampleBuffer original, CMSampleTimingInfo [] timing)
		{
			OSStatus status;
			return CreateWithNewTiming (original, timing, out status);
		}
예제 #13
0
		unsafe static extern OSStatus CMSampleBufferCreateCopyWithNewTiming (
			/* CFAllocatorRef */ IntPtr allocator,
			/* CMSampleBufferRef */ IntPtr originalSBuf,
			/* CMItemCount */ nint numSampleTimingEntries,
			CMSampleTimingInfo* sampleTimingArray,
			/* CMSampleBufferRef* */ out IntPtr sBufCopyOut
			);
예제 #14
0
        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));
        }