AudioConverterComplexInputDataProc

Type Alias AudioConverterComplexInputDataProc 

Source
pub type AudioConverterComplexInputDataProc = Option<unsafe extern "C-unwind" fn(AudioConverterRef, NonNull<u32>, NonNull<AudioBufferList>, *mut *mut AudioStreamPacketDescription, *mut c_void) -> i32>;
Available on crate features AudioConverter and objc2-core-audio-types only.
Expand description

Callback function for supplying input data to AudioConverterFillComplexBuffer.

Parameter inAudioConverter: The AudioConverter requesting input.

Parameter ioNumberDataPackets: On entry, the minimum number of packets of input audio data the converter would like in order to fulfill its current FillBuffer request. On exit, the number of packets of audio data actually being provided for input, or 0 if there is no more input.

Parameter ioData: This points to an audio buffer list to be filled in by the callback to refer to the buffer(s) provided by the callback. On exit, the members of ioData should be set to point to the audio data being provided for input.

Parameter outDataPacketDescription: If non-null, on exit, the callback is expected to fill this in with an AudioStreamPacketDescription for each packet of input data being provided.

Parameter inUserData: The inInputDataProcUserData parameter passed to AudioConverterFillComplexBuffer().

Returns: An OSStatus result code.

This callback function supplies input to AudioConverterFillComplexBuffer.

The AudioConverter requests a minimum number of packets (*ioNumberDataPackets). The callback may return one or more packets. If this is less than the minimum, the callback will simply be called again in the near future. Note that ioNumberDataPackets counts packets in terms of the converter’s input format (not its output format). Also note that the callback must provide a whole number of packets.

The callback may be asked to provide multiple input packets in a single call, even for compressed formats. The callback must update the number of packets pointed to by ioNumberDataPackets to indicate the number of packets actually being provided, and if the packets require packet descriptions, these must be filled into the array pointed to by outDataPacketDescription, one packet description per packet.

The callback is given an audio buffer list pointed to by ioData. This buffer list may refer to existing buffers owned and allocated by the audio converter, in which case the callback may use them and copy input audio data into them. However, the buffer list may also be empty (mDataByteSize == 0 and/or mData == NULL), in which case the callback must provide its own buffers. The callback manipulates the members of ioData to point to one or more buffers of audio data (multiple buffers are used with non-interleaved PCM data). The callback is responsible for not freeing or altering this buffer until it is called again.

For input data that varies from one packet to another in either size (bytes per packet) or duration (frames per packet), such as when decoding compressed audio, the callback should expect outDataPacketDescription to be non-null and point to array of packet descriptions, which the callback must fill in, one for every packet provided by the callback. Each packet must have a valid packet description, regardless of whether or not these descriptions are different from each other. Packet descriptions are required even if there is only one packet.

If the callback returns an error, it must return zero packets of data. AudioConverterFillComplexBuffer will stop producing output and return whatever output has already been produced to its caller, along with the error code. This mechanism can be used when an input proc has temporarily run out of data, but has not yet reached end of stream.

See also Apple’s documentation

Aliased Type§

pub enum AudioConverterComplexInputDataProc {
    None,
    Some(unsafe extern "C-unwind" fn(*mut OpaqueAudioConverter, NonNull<u32>, NonNull<AudioBufferList>, *mut *mut AudioStreamPacketDescription, *mut c_void) -> i32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C-unwind" fn(*mut OpaqueAudioConverter, NonNull<u32>, NonNull<AudioBufferList>, *mut *mut AudioStreamPacketDescription, *mut c_void) -> i32)

Some value of type T.