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, id: CodecId, implementation: CodecImplementation)

Register a codec implementation. The same codec id may be registered multiple times — for example a software FLAC decoder and (later) a hardware one would both register under id "flac".

Source

pub fn register_decoder_impl( &mut self, id: CodecId, caps: CodecCapabilities, factory: DecoderFactory, )

Convenience: register a decoder-only implementation built from a caps + factory pair.

Source

pub fn register_encoder_impl( &mut self, id: CodecId, caps: CodecCapabilities, factory: EncoderFactory, )

Convenience: register an encoder-only implementation.

Source

pub fn register_both( &mut self, id: CodecId, caps: CodecCapabilities, decode: DecoderFactory, encode: EncoderFactory, )

Convenience: register a single implementation that handles both decode and encode for a codec id.

Source

pub fn register_decoder(&mut self, id: CodecId, factory: DecoderFactory)

Backwards-compat shim: register a decoder-only impl with default software capabilities. Prefer register_decoder_impl for new code.

Source

pub fn register_encoder(&mut self, id: CodecId, factory: EncoderFactory)

Backwards-compat shim: register an encoder-only impl with default software capabilities.

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>>

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>>

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

Source

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

Default-preference shorthand for make_decoder_with.

Source

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

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 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.

Trait Implementations§

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.