pub struct TrackAudioPacketProvider<S> { /* private fields */ }Expand description
An AudioPacketProvider that reads an AAC or Vorbis track’s compressed
packets from a ByteSource on demand, holding only track’s index (and
whatever S itself caches) rather than every packet’s bytes.
The audio counterpart of TrackSampleProvider, with the same requirement
that S::read_at’s future resolve the first time it is polled: a source
that suspends makes Self::read report ErrorKind::Unsupported
rather than block.
Self::new builds the whole index without reading any packet. An AAC
packet’s decoded interval comes from the track’s sample durations, and a
Vorbis packet’s from the block sizes of it and the packet before it, which
Track::vorbis_packet_heads names. An Opus packet’s interval is in its
own table-of-contents byte, which only the packet has, so Opus tracks use
crate::TrackSampleLoader::opus_packet_provider or
Track::to_encoded_audio_samples; Self::new rejects them.