Beispiel #1
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));
        }
Beispiel #2
0
        public CMFormatDescription GetFormatDescription()
        {
            var desc       = default(CMFormatDescription);
            var descHandle = CMSampleBufferGetFormatDescription(handle);

            if (descHandle != IntPtr.Zero)
            {
                desc = new CMFormatDescription(descHandle, false);
            }
            return(desc);
        }
Beispiel #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); }
Beispiel #4
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);
		}
Beispiel #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);
		}
Beispiel #6
0
		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);
		}
Beispiel #7
0
		public CMFormatDescription GetFormatDescription ()
		{
			var desc = default(CMFormatDescription);
			var descHandle = CMSampleBufferGetFormatDescription (handle);
			if (descHandle != IntPtr.Zero)
			{
				desc = new CMFormatDescription (descHandle, false);
			}
			return desc;					
		}
Beispiel #8
0
		public VTStatus CanAcceptFormatDescriptor (CMFormatDescription newDescriptor)
		{
			if (Handle == IntPtr.Zero)
				throw new ObjectDisposedException ("DecompressionSession");

			return VTDecompressionSessionCanAcceptFormatDescription (Handle, newDescriptor.Handle);
		}
Beispiel #9
0
        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));
        }