AudioFileComponentReadPacketData

Function AudioFileComponentReadPacketData 

Source
pub unsafe extern "C-unwind" fn AudioFileComponentReadPacketData(
    in_component: AudioFileComponent,
    in_use_cache: bool,
    io_num_bytes: NonNull<u32>,
    out_packet_descriptions: *mut AudioStreamPacketDescription,
    in_starting_packet: i64,
    io_num_packets: NonNull<u32>,
    out_buffer: NonNull<c_void>,
) -> i32
Available on crate features AudioComponent and objc2-core-audio-types only.
Expand description

implements AudioFileReadPacketData.

For all uncompressed formats, packets == frames. If the byte size of the number packets requested is less than the buffer size, ioNumBytes will be reduced. If the buffer is too small for the number of packets requested, ioNumPackets and ioNumBytes will be reduced to the number of packets that can be accommodated and their byte size. Returns kAudioFileEndOfFileError when read encounters end of file.

Parameter inComponent: an AudioFileComponent

Parameter inUseCache: true if it is desired to cache the data upon read, else false

Parameter ioNumBytes: on input the size of outBuffer in bytes. on output, the number of bytes actually returned.

Parameter outPacketDescriptions: on output, an array of packet descriptions describing the packets being returned. NULL may be passed for this parameter. Nothing will be returned for linear pcm data.

Parameter inStartingPacket: the packet index of the first packet desired to be returned

Parameter ioNumPackets: on input, the number of packets to read, on output, the number of packets actually read.

Parameter outBuffer: outBuffer should be a pointer to user allocated memory.

Returns: returns noErr if successful.

ยงSafety

  • in_component must be a valid pointer.
  • io_num_bytes must be a valid pointer.
  • out_packet_descriptions must be a valid pointer or null.
  • io_num_packets must be a valid pointer.
  • out_buffer must be a valid pointer.