Skip to main content

CodecRegistry

Struct CodecRegistry 

Source
pub struct CodecRegistry { /* private fields */ }

Implementations§

Source§

impl CodecRegistry

Source

pub fn new() -> CodecRegistry

Source

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.

Source

pub fn has_decoder(&self, id: &CodecId) -> bool

Source

pub fn has_encoder(&self, id: &CodecId) -> bool

Source

pub fn make_decoder_with( &self, params: &CodecParameters, prefs: &CodecPreferences, ) -> Result<Box<dyn Decoder>, Error>

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.

Source

pub fn make_encoder_with( &self, params: &CodecParameters, prefs: &CodecPreferences, ) -> Result<Box<dyn Encoder>, Error>

Build an encoder, with the same priority + fallback semantics.

Source

pub fn make_decoder( &self, params: &CodecParameters, ) -> Result<Box<dyn Decoder>, Error>

Default-preference shorthand for make_decoder_with.

Source

pub fn make_encoder( &self, params: &CodecParameters, ) -> Result<Box<dyn Encoder>, Error>

Default-preference shorthand for make_encoder_with.

Source

pub fn decoder_ids(&self) -> impl Iterator<Item = &CodecId>

Iterate codec ids that have at least one decoder implementation.

Source

pub fn encoder_ids(&self) -> impl Iterator<Item = &CodecId>

Source

pub fn implementations(&self, id: &CodecId) -> &[CodecImplementation]

All registered implementations of a given codec id.

Source

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.

Source

pub fn decoder_options_schema( &self, id: &CodecId, ) -> Option<&'static [OptionField]>

Lookup the decoder options schema — see encoder_options_schema.

Source

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.

Source

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.

Source

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.

Source§

fn resolve_tag(&self, ctx: &ProbeContext<'_>) -> Option<CodecId>

Resolve the tag in 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.
Source§

impl Default for CodecRegistry

Source§

fn default() -> CodecRegistry

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.