Пример #1
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));
        }
Пример #2
0
        public int /*CMSampleBufferError*/ SetDataBuffer(CMBlockBuffer dataBuffer)
        {
            var dataBufferHandle = IntPtr.Zero;

            if (dataBuffer != null)
            {
                dataBufferHandle = dataBuffer.handle;
            }
            return((int)CMSampleBufferSetDataBuffer(handle, dataBufferHandle));
        }
Пример #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);
		}
Пример #4
0
		public int /*CMSampleBufferError*/ SetDataBuffer (CMBlockBuffer dataBuffer)
		{
			var dataBufferHandle = IntPtr.Zero;
			if (dataBuffer != null)
			{
				dataBufferHandle = dataBuffer.handle;
			}
			return (int)CMSampleBufferSetDataBuffer (handle, dataBufferHandle);
		}