CodecRegistryHandle

Struct CodecRegistryHandle 

Source
pub struct CodecRegistryHandle { /* private fields */ }
Expand description

Thread-safe handle for codec registration/lookups.

§Example

use std::sync::Arc;
use styx_codec::{Codec, CodecDescriptor, CodecError, CodecKind, CodecRegistry};
use styx_core::prelude::{FourCc, FrameLease};

struct Passthrough {
    desc: CodecDescriptor,
}

impl Codec for Passthrough {
    fn descriptor(&self) -> &CodecDescriptor { &self.desc }
    fn process(&self, input: FrameLease) -> Result<FrameLease, CodecError> { Ok(input) }
}

let registry = CodecRegistry::new();
registry.register(
    FourCc::new(*b"RG24"),
    Arc::new(Passthrough {
        desc: CodecDescriptor {
            kind: CodecKind::Decoder,
            input: FourCc::new(*b"RG24"),
            output: FourCc::new(*b"RG24"),
            name: "passthrough",
            impl_name: "passthrough",
        },
    }),
);
let handle = registry.handle();
let _ = handle.lookup(FourCc::new(*b"RG24"))?;

Implementations§

Source§

impl CodecRegistryHandle

Source

pub fn lookup(&self, fourcc: FourCc) -> Result<Arc<dyn Codec>, RegistryError>

Lookup a codec by FourCc.

Source

pub fn lookup_named( &self, fourcc: FourCc, impl_name: &str, ) -> Result<Arc<dyn Codec>, RegistryError>

Lookup a codec by FourCc and implementation name.

Source

pub fn lookup_named_kind( &self, fourcc: FourCc, kind: CodecKind, impl_name: &str, ) -> Result<Arc<dyn Codec>, RegistryError>

Lookup a codec by FourCc, kind, and implementation name.

Source

pub fn lookup_preferred( &self, fourcc: FourCc, preferred_impls: &[&str], prefer_hardware: bool, ) -> Result<Arc<dyn Codec>, RegistryError>

Lookup a codec by FourCc honoring an ordered list of preferred impl names and hardware preference.

Source

pub fn lookup_by_impl( &self, kind: CodecKind, impl_name: &str, ) -> Result<(FourCc, Arc<dyn Codec>), RegistryError>

Find a codec by implementation name and kind across all FourCc entries.

Source

pub fn process( &self, fourcc: FourCc, frame: FrameLease, ) -> Result<FrameLease, RegistryError>

Process a frame with the registered codec.

Source

pub fn process_named( &self, fourcc: FourCc, impl_name: &str, frame: FrameLease, ) -> Result<FrameLease, RegistryError>

Process with a specific implementation name.

Source

pub fn process_preferred( &self, fourcc: FourCc, preferred_impls: &[&str], prefer_hardware: bool, frame: FrameLease, ) -> Result<FrameLease, RegistryError>

Process with an ordered implementation preference and optional hardware bias.

Source

pub fn set_preference(&self, fourcc: FourCc, preference: Preference)

Configure preferences for a FourCc (impl order + hardware bias).

Source

pub fn disable_impl(&self, fourcc: FourCc, impl_name: &str)

Disable a codec implementation by impl_name for the given FourCc.

Source

pub fn enable_only(&self, fourcc: FourCc, impl_names: &[&str])

Enable only the listed impl_names for a FourCc (removes others).

Source

pub fn register_dynamic(&self, fourcc: FourCc, codec: Arc<dyn Codec>)

Dynamically register a new codec impl at runtime.

Source

pub fn set_impl_priority(&self, fourcc: FourCc, impl_name: &str, priority: i32)

Assign an explicit priority for an impl name (lower wins).

Source

pub fn set_default_hardware_bias(&self, prefer: bool)

Toggle the default bias toward hardware implementations.

Source

pub fn set_policy(&self, policy: CodecPolicy)

Install a full policy for a FourCc.

Source

pub fn lookup_auto( &self, fourcc: FourCc, ) -> Result<Arc<dyn Codec>, RegistryError>

Lookup honoring stored preferences when present.

Source

pub fn lookup_auto_kind( &self, fourcc: FourCc, kind: CodecKind, ) -> Result<Arc<dyn Codec>, RegistryError>

Lookup honoring stored preferences when present, constrained to a codec kind.

Source

pub fn lookup_auto_kind_by_name( &self, fourcc: FourCc, kind: CodecKind, codec_name: &str, ) -> Result<Arc<dyn Codec>, RegistryError>

Lookup honoring stored preferences, constrained to a codec kind and algorithm family name.

Source

pub fn process_auto( &self, fourcc: FourCc, frame: FrameLease, ) -> Result<FrameLease, RegistryError>

Process honoring stored preferences when present.

Source

pub fn process_auto_kind( &self, fourcc: FourCc, kind: CodecKind, frame: FrameLease, ) -> Result<FrameLease, RegistryError>

Process honoring stored preferences when present, constrained to a codec kind.

Source

pub fn process_auto_kind_by_name( &self, fourcc: FourCc, kind: CodecKind, codec_name: &str, frame: FrameLease, ) -> Result<FrameLease, RegistryError>

Process honoring stored preferences, constrained to a codec kind and algorithm family name.

Source

pub fn stats(&self) -> CodecStats

Stats snapshot.

Source

pub fn list_registered(&self) -> Vec<(FourCc, Vec<CodecDescriptor>)>

Snapshot of all registered codecs grouped by FourCc (descriptor-only).

Source

pub fn list_registered_by_kind( &self, kind: CodecKind, ) -> Vec<(FourCc, Vec<CodecDescriptor>)>

List registered codecs filtered by kind.

Trait Implementations§

Source§

impl Clone for CodecRegistryHandle

Source§

fn clone(&self) -> CodecRegistryHandle

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.