#[non_exhaustive]pub struct ProbeContext<'a> {
pub tag: &'a CodecTag,
pub header: Option<&'a [u8]>,
pub packet: Option<&'a [u8]>,
pub bits_per_sample: Option<u16>,
pub channels: Option<u16>,
pub sample_rate: Option<u32>,
pub width: Option<u32>,
pub height: Option<u32>,
}Expand description
Context passed to a codec’s probe function during tag resolution.
Built by the demuxer from whatever it has already parsed (stream
format block, a peek at the first packet, numeric hints like
bits_per_sample). Probes read fields directly; the struct is
#[non_exhaustive] so additional hints can be added later without
breaking codec crates that match on it.
The canonical construction pattern, for a demuxer:
let tag = CodecTag::wave_format(0x0001);
let ctx = ProbeContext::new(&tag)
.bits(24)
.channels(2)
.sample_rate(48_000);Codec authors read fields like ctx.bits_per_sample / ctx.tag
directly — #[non_exhaustive] forbids struct-literal construction
from outside this crate but does not restrict field access.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tag: &'a CodecTagThe tag being resolved — always set.
header: Option<&'a [u8]>Raw container-level stream-format blob if available
(e.g. WAVEFORMATEX, BITMAPINFOHEADER, MP4 sample-entry bytes,
Matroska CodecPrivate). Format is container-specific.
packet: Option<&'a [u8]>First packet bytes if the demuxer has already read one.
Most demuxers resolve tags at stream-discovery time before any
packet exists; this is None in that case.
bits_per_sample: Option<u16>Audio: bits per sample (from WAVEFORMATEX, MP4 sample entry,
Matroska BitDepth, etc.).
channels: Option<u16>§sample_rate: Option<u32>§width: Option<u32>§height: Option<u32>Implementations§
Source§impl<'a> ProbeContext<'a>
impl<'a> ProbeContext<'a>
Sourcepub fn new(tag: &'a CodecTag) -> Self
pub fn new(tag: &'a CodecTag) -> Self
Start building a context for tag with every hint field empty.
pub fn header(self, h: &'a [u8]) -> Self
pub fn packet(self, p: &'a [u8]) -> Self
pub fn bits(self, n: u16) -> Self
pub fn channels(self, n: u16) -> Self
pub fn sample_rate(self, n: u32) -> Self
pub fn width(self, n: u32) -> Self
pub fn height(self, n: u32) -> Self
Trait Implementations§
Source§impl<'a> Clone for ProbeContext<'a>
impl<'a> Clone for ProbeContext<'a>
Source§fn clone(&self) -> ProbeContext<'a>
fn clone(&self) -> ProbeContext<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more