Example #1
0
        public CMFormatDescription GetFormatDescription()
        {
            var desc       = default(CMFormatDescription);
            var descHandle = CMSampleBufferGetFormatDescription(handle);

            if (descHandle != IntPtr.Zero)
            {
                desc = new CMFormatDescription(descHandle, false);
            }
            return(desc);
        }
Example #2
0
		public static CMSampleBuffer CreateWithPacketDescriptions (CMBlockBuffer dataBuffer, CMFormatDescription formatDescription, int samplesCount,
			CMTime sampleTimestamp, AudioStreamPacketDescription[] packetDescriptions, out CMSampleBufferError error)
		{
			if (formatDescription == null)
				throw new ArgumentNullException ("formatDescription");
			if (samplesCount <= 0)
				throw new ArgumentOutOfRangeException ("samplesCount");

			IntPtr buffer;
			error = CMAudioSampleBufferCreateWithPacketDescriptions (IntPtr.Zero,
				dataBuffer == null ? IntPtr.Zero : dataBuffer.Handle,
				true, IntPtr.Zero, IntPtr.Zero,
				formatDescription.Handle,
				samplesCount, sampleTimestamp,
				packetDescriptions,
				out buffer);

			if (error != CMSampleBufferError.None)
				return null;

			return new CMSampleBuffer (buffer, true);
		}
Example #3
0
        public static CMSampleBuffer CreateWithPacketDescriptions(CMBlockBuffer dataBuffer, CMFormatDescription formatDescription, int samplesCount,
                                                                  CMTime sampleTimestamp, AudioStreamPacketDescription[] packetDescriptions, out CMSampleBufferError error)
        {
            if (formatDescription == null)
            {
                throw new ArgumentNullException("formatDescription");
            }
            if (samplesCount <= 0)
            {
                throw new ArgumentOutOfRangeException("samplesCount");
            }

            IntPtr buffer;

            error = CMAudioSampleBufferCreateWithPacketDescriptions(IntPtr.Zero,
                                                                    dataBuffer == null ? IntPtr.Zero : dataBuffer.handle,
                                                                    true, IntPtr.Zero, IntPtr.Zero,
                                                                    formatDescription.handle,
                                                                    samplesCount, sampleTimestamp,
                                                                    packetDescriptions,
                                                                    out buffer);

            if (error != CMSampleBufferError.None)
            {
                return(null);
            }

            return(new CMSampleBuffer(buffer, true));
        }
		public CMFormatDescription GetFormatDescription ()
		{
			var desc = default(CMFormatDescription);
			var descHandle = CMSampleBufferGetFormatDescription (handle);
			if (descHandle != IntPtr.Zero)
			{
				desc = new CMFormatDescription (descHandle, false);
			}
			return desc;					
		}