Skip to main content

CodecRegistry

Struct CodecRegistry 

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

Implementations§

Source§

impl CodecRegistry

Source

pub fn new() -> Self

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 first_decoder( &self, params: &CodecParameters, ) -> Result<Box<dyn Decoder>>

First registered decoder factory for params.codec_id, invoked with params. No priority walk, no preference filter, no init-time fallback to a lower-priority impl. Errors if no decoder is registered for the codec.

Intended for single-impl scenarios — typically a codec crate’s own self-tests, where exactly one impl has been registered into a freshly-constructed registry. Production callers selecting among multiple candidates (e.g. h264_sw vs h264_videotoolbox) should use oxideav_pipeline::make_decoder_with instead, which applies CodecPreferences and walks priorities.

Source

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

First registered encoder factory — see first_decoder.

Source

pub fn decoder_by_impl( &self, impl_name: &str, params: &CodecParameters, ) -> Result<Box<dyn Decoder>>

Look up a decoder by exact implementation name ("h264_sw", "aac_audiotoolbox", …). Errors if the impl isn’t registered or if it has no decoder factory.

Source

pub fn encoder_by_impl( &self, impl_name: &str, params: &CodecParameters, ) -> Result<Box<dyn Encoder>>

Look up an encoder by exact implementation name — see decoder_by_impl.

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.