pub struct CodecRegistry { /* private fields */ }Implementations§
Source§impl CodecRegistry
impl CodecRegistry
pub fn new() -> Self
Sourcepub fn register(&mut self, info: CodecInfo)
pub fn register(&mut self, info: CodecInfo)
Register one codec. Expands into:
- an entry in the id → implementations map (for
make_decoder/make_encoder); - an entry in the tag index for every claimed tag (for
resolve_tag).
Calling register multiple times with the same id is allowed
and how multi-implementation codecs (software-plus-hardware
FLAC, for example) are expressed.
pub fn has_decoder(&self, id: &CodecId) -> bool
pub fn has_encoder(&self, id: &CodecId) -> bool
Sourcepub fn make_decoder_with(
&self,
params: &CodecParameters,
prefs: &CodecPreferences,
) -> Result<Box<dyn Decoder>>
pub fn make_decoder_with( &self, params: &CodecParameters, prefs: &CodecPreferences, ) -> Result<Box<dyn Decoder>>
Build a decoder for params. Walks all implementations matching the
codec id in increasing priority order, skipping any excluded by the
caller’s preferences. Init-time fallback: if a higher-priority impl’s
constructor returns an error, the next candidate is tried.
Sourcepub fn make_encoder_with(
&self,
params: &CodecParameters,
prefs: &CodecPreferences,
) -> Result<Box<dyn Encoder>>
pub fn make_encoder_with( &self, params: &CodecParameters, prefs: &CodecPreferences, ) -> Result<Box<dyn Encoder>>
Build an encoder, with the same priority + fallback semantics.
Sourcepub fn make_decoder(&self, params: &CodecParameters) -> Result<Box<dyn Decoder>>
pub fn make_decoder(&self, params: &CodecParameters) -> Result<Box<dyn Decoder>>
Default-preference shorthand for make_decoder_with.
Sourcepub fn make_encoder(&self, params: &CodecParameters) -> Result<Box<dyn Encoder>>
pub fn make_encoder(&self, params: &CodecParameters) -> Result<Box<dyn Encoder>>
Default-preference shorthand for make_encoder_with.
Sourcepub fn decoder_ids(&self) -> impl Iterator<Item = &CodecId>
pub fn decoder_ids(&self) -> impl Iterator<Item = &CodecId>
Iterate codec ids that have at least one decoder implementation.
pub fn encoder_ids(&self) -> impl Iterator<Item = &CodecId>
Sourcepub fn implementations(&self, id: &CodecId) -> &[CodecImplementation]
pub fn implementations(&self, id: &CodecId) -> &[CodecImplementation]
All registered implementations of a given codec id.
Sourcepub fn encoder_options_schema(
&self,
id: &CodecId,
) -> Option<&'static [OptionField]>
pub fn encoder_options_schema( &self, id: &CodecId, ) -> Option<&'static [OptionField]>
Lookup the encoder options schema for a registered codec. Walks
implementations in registration order and returns the first
schema found. None means either the codec isn’t registered or
no implementation declared an encoder schema.
Sourcepub fn decoder_options_schema(
&self,
id: &CodecId,
) -> Option<&'static [OptionField]>
pub fn decoder_options_schema( &self, id: &CodecId, ) -> Option<&'static [OptionField]>
Lookup the decoder options schema — see
encoder_options_schema.
Sourcepub fn all_implementations(
&self,
) -> impl Iterator<Item = (&CodecId, &CodecImplementation)>
pub fn all_implementations( &self, ) -> impl Iterator<Item = (&CodecId, &CodecImplementation)>
Iterator over every (codec_id, impl) pair — useful for oxideav list
to show capability flags per implementation.
Sourcepub fn all_tag_registrations(
&self,
) -> impl Iterator<Item = (&CodecTag, &CodecId)>
pub fn all_tag_registrations( &self, ) -> impl Iterator<Item = (&CodecTag, &CodecId)>
Iterator over every (tag, codec_id) pair currently registered —
used by oxideav tags debug output and by tests that want to
walk the tag surface.
Sourcepub fn resolve_tag_ref(&self, ctx: &ProbeContext<'_>) -> Option<&CodecId>
pub fn resolve_tag_ref(&self, ctx: &ProbeContext<'_>) -> Option<&CodecId>
Inherent form of tag resolution that returns a reference.
The owned-value form used by container code lives behind the
CodecResolver trait impl below.
Walks every registration that claimed ctx.tag, calls its
probe with ctx, and returns the id of the registration that
scored highest. Probes that return 0.0 are discarded; ties
on confidence are broken by registration order (first wins).
Registrations with no probe are treated as returning 1.0.
Trait Implementations§
Source§impl CodecResolver for CodecRegistry
Implement the shared CodecResolver interface so container
demuxers can accept &dyn CodecResolver without depending on
this crate directly — the trait lives in oxideav-core.
impl CodecResolver for CodecRegistry
Implement the shared CodecResolver interface so container
demuxers can accept &dyn CodecResolver without depending on
this crate directly — the trait lives in oxideav-core.
Source§fn resolve_tag(&self, ctx: &ProbeContext<'_>) -> Option<CodecId>
fn resolve_tag(&self, ctx: &ProbeContext<'_>) -> Option<CodecId>
ctx.tag to a codec id. Implementations walk
every registration whose tag set contains the tag, call each
probe (treating None as “always 1.0”), and return the id with
the highest resulting confidence. Ties are broken by
registration order.