pub struct AudioChunk { /* private fields */ }Expand description
One exported block of decoded audio: owned, interleaved 32-bit float samples plus metadata.
Samples are packed native-endian f32, interleaved:
as_slice.len() == frames * channels, channels
interleaved ([L0, R0, L1, R1, …] for stereo) — the buffer layout
whisper / candle / ort pipelines consume, at whatever sample rate and
channel shape this chunk reports (normalize via the extractor’s
sample_rate/channels options when a model needs a fixed shape).
One chunk corresponds to one filtered AVFrame; the number of frames per
chunk is not contractual (typically ~1024) and must not be relied upon.
Implementations§
Source§impl AudioChunk
impl AudioChunk
Sourcepub fn pts_us(&self) -> Option<i64>
pub fn pts_us(&self) -> Option<i64>
Presentation time in microseconds, passed through from the source
frame and normalized to the start of the extraction window (the stream
start when no start_time_us was set). None when the frame carried
no usable timestamp.
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Samples per second.
Sourcepub fn channel_layout(&self) -> &str
pub fn channel_layout(&self) -> &str
FFmpeg’s textual channel-layout description of this chunk (e.g.
"mono", "stereo", "5.1"), read from the exported frame: the
source layout under the default passthrough, or the converted layout
when channels requested one.
Above two channels this distinguishes layouts a bare count cannot
(6 channels may be "5.1" or "6.0"). Empty when FFmpeg cannot
describe the layout.