AudioCodecProduceOutputPackets

Function AudioCodecProduceOutputPackets 

Source
pub unsafe extern "C-unwind" fn AudioCodecProduceOutputPackets(
    in_codec: AudioCodec,
    out_output_data: NonNull<c_void>,
    io_output_data_byte_size: NonNull<u32>,
    io_number_packets: NonNull<u32>,
    out_packet_description: *mut AudioStreamPacketDescription,
    out_status: NonNull<u32>,
) -> i32
Available on crate features AudioCodec and AudioComponent and objc2-core-audio-types only.
Expand description

Produce as many output packets as requested and the amount of input data allows for. The outStatus argument returns information about the codec’s status to allow for proper data management. See the constants above for the possible values that can be returned.

The outPacketDescription argument is an array of AudioStreamPacketDescription structs that describes the packet layout returned in outOutputData. This argument is optional. Pass NULL if this information is not to be returned. Note that this information is only provided when the output format isn’t linear PCM.

Note that decoders will always only produce linear PCM data in multiples of the number frames in a packet of the encoded format (as returned by kAudioCodecPropertyPacketFrameSize). Encoders will consume this many frames of linear PCM data to produce a packet of their format.

Parameter inCodec: The AudioCodec instance

Parameter outOutputData: Pointer to the output data buffer

Parameter ioOutputDataByteSize: A pointer to the size

Parameter ioNumberPackets: number of input/output packets

Returns: The OSStatus value

§Safety

  • in_codec must be a valid pointer.
  • out_output_data must be a valid pointer.
  • io_output_data_byte_size must be a valid pointer.
  • io_number_packets must be a valid pointer.
  • out_packet_description must be a valid pointer or null.
  • out_status must be a valid pointer.