Skip to main content

TranscoderFactory

Trait TranscoderFactory 

Source
pub trait TranscoderFactory:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn rendition(&self) -> &RenditionSpec;
    fn build(&self, ctx: &TranscoderContext) -> Option<Box<dyn Transcoder>>;
}
Expand description

Factory that builds a Transcoder for one specific rendition of one specific (broadcast, track) stream.

One factory instance per rendition: for an ABR ladder of three rungs the caller registers three factory instances on the crate::TranscodeRunner, each carrying its own RenditionSpec. The factory either returns a fresh Box<dyn Transcoder> (one instance per source stream the factory opts into) or None to skip this stream.

Send + Sync + 'static so the factory lives behind an Arc shared across the registry callback’s worker thread.

Required Methods§

Source

fn name(&self) -> &str

Stable identifier used in metric labels and logs (e.g. "passthrough", "x264", "nvenc"). Pick something short, lowercase, snake_case.

Source

fn rendition(&self) -> &RenditionSpec

Target rendition this factory produces. Consumed by the crate::TranscodeRunner when building the TranscoderContext.

Source

fn build(&self, ctx: &TranscoderContext) -> Option<Box<dyn Transcoder>>

Build a fresh transcoder for ctx, or return None to skip this (broadcast, track) entirely. Returning None is the correct path when the factory wants to opt out – e.g. a video transcoder returning None for an audio track, or a factory targeting only source broadcasts (not already-transcoded renditions).

Implementors§