Skip to main content

MediaStreamClassifierRegistry

Struct MediaStreamClassifierRegistry 

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

Registry of media stream classifier providers.

Provider names and aliases are matched case-insensitively. Duplicate ids or aliases are rejected at registration time so a selector always resolves to at most one provider.

MediaStreamClassifierRegistry::create_default_box and MediaStreamClassifierRegistry::create_default_arc read MimeConfig::media_stream_classifier_default first. When the configured selector is empty or auto, the registry tries all available providers ordered by descending provider priority and then by provider id. Otherwise it creates the named provider.

Implementations§

Source§

impl MediaStreamClassifierRegistry

Source

pub fn new() -> Self

Creates an empty classifier registry.

§Returns

Empty registry.

Source

pub fn builtin() -> Self

Creates a registry containing only built-in classifier providers.

§Returns

Registry with the FFprobe provider.

Source

pub fn default_registry() -> MimeResult<Self>

Gets a snapshot of the process-wide default classifier registry.

The returned registry is cloned from the global default registry, so callers can inspect or create classifiers without holding a global lock.

§Returns

Snapshot of the default registry.

§Errors

Returns MimeError::ClassifierBackend when the global registry lock has been poisoned by another thread.

Source

pub fn register_default<P>(provider: P) -> MimeResult<()>
where P: MediaStreamClassifierProvider + 'static,

Registers a provider in the process-wide default classifier registry.

Successfully registered providers become visible to MediaStreamClassifierRegistry::default_registry snapshots throughout the current process.

§Parameters
  • provider: Provider to register globally.
§Errors

Returns MimeError::DuplicateClassifierName when the provider id or one of its aliases already exists in the default registry. Returns MimeError::ClassifierBackend when the global registry lock has been poisoned by another thread.

Source

pub fn register<P>(&mut self, provider: P) -> MimeResult<()>
where P: MediaStreamClassifierProvider + 'static,

Registers a provider.

§Parameters
  • provider: Provider to register.
§Errors

Returns MimeError::DuplicateClassifierName when the provider id or one of its aliases conflicts with an existing provider.

Source

pub fn register_shared<P>(&mut self, provider: Arc<P>) -> MimeResult<()>
where P: MediaStreamClassifierProvider + 'static,

Registers a shared provider.

§Parameters
  • provider: Shared provider to register.
§Errors

Returns a MimeError when the provider descriptor is invalid or one of its names conflicts with an existing provider.

Source

pub fn register_arc<P>(&mut self, provider: Arc<P>) -> MimeResult<()>
where P: MediaStreamClassifierProvider + 'static,

Registers a shared provider.

§Parameters
  • provider: Shared provider to register.
§Errors

Returns a MimeError when the provider descriptor is invalid or one of its names conflicts with an existing provider.

Source

pub fn provider_names(&self) -> Vec<&str>

Gets canonical provider names in registration order.

§Returns

Provider ids.

Source

pub fn find_provider( &self, name: &str, ) -> Option<&dyn ServiceProvider<MediaStreamClassifierSpec>>

Finds a provider by id or alias.

§Parameters
  • name: Provider id or alias. Matching is case-insensitive.
§Returns

Matching provider, or None.

Source

pub fn resolve_provider( &self, name: &str, ) -> MimeResult<&dyn ServiceProvider<MediaStreamClassifierSpec>>

Resolves a provider by id or alias.

§Parameters
  • name: Provider id or alias. Names are normalized before lookup.
§Returns

Matching provider.

§Errors

Returns MimeError::EmptyClassifierName or MimeError::InvalidClassifierName when name is invalid, or MimeError::UnknownClassifier when no provider matches.

Source

pub fn create_box( &self, name: &str, config: &MimeConfig, ) -> MimeResult<Box<dyn MediaStreamClassifier>>

Creates a boxed classifier from a provider name.

§Parameters
  • name: Provider id or alias.
  • config: MIME configuration passed to the provider.
§Returns

Boxed media stream classifier trait object.

§Errors

Returns MimeError::UnknownClassifier when no provider matches name, MimeError::ClassifierUnavailable when the provider is unavailable, or another MimeError when provider initialization fails.

Source

pub fn create_arc( &self, name: &str, config: &MimeConfig, ) -> MimeResult<Arc<dyn MediaStreamClassifier>>

Creates a shared classifier from a provider name.

§Parameters
  • name: Provider id or alias.
  • config: MIME configuration passed to the provider.
§Returns

Shared media stream classifier trait object.

§Errors

Returns MimeError::UnknownClassifier when no provider matches name, MimeError::ClassifierUnavailable when the provider is unavailable, or another MimeError when provider initialization fails.

Source

pub fn create_default_box( &self, config: &MimeConfig, ) -> MimeResult<Box<dyn MediaStreamClassifier>>

Creates a boxed classifier from the configured default selector.

§Parameters
  • config: MIME configuration.
§Returns

First boxed classifier that can be created.

§Errors

Returns MimeError::NoAvailableClassifier when no configured provider can be created.

Source

pub fn create_default_arc( &self, config: &MimeConfig, ) -> MimeResult<Arc<dyn MediaStreamClassifier>>

Creates a shared classifier from the configured default selector.

§Parameters
  • config: MIME configuration.
§Returns

First shared classifier that can be created.

§Errors

Returns MimeError::NoAvailableClassifier when no configured provider can be created.

Trait Implementations§

Source§

impl Clone for MediaStreamClassifierRegistry

Source§

fn clone(&self) -> MediaStreamClassifierRegistry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MediaStreamClassifierRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MediaStreamClassifierRegistry

Source§

fn default() -> MediaStreamClassifierRegistry

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> 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, D> IntoConfigDefault<T> for D
where D: IntoValueDefault<T>,

Source§

fn into_config_default(self) -> T

Converts this fallback value into T.
Source§

impl<T> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Converts this argument into the default value.
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.