pub struct TranscodeRunner { /* private fields */ }Expand description
Builder that collects TranscoderFactory registrations and
installs them onto a FragmentBroadcasterRegistry. Typical
usage – three rungs of the default ladder:
let registry = FragmentBroadcasterRegistry::new();
let _handle = TranscodeRunner::new()
.with_ladder(RenditionSpec::default_ladder(), |spec| {
PassthroughTranscoderFactory::new(spec)
})
.install(®istry);
// hold _handle for the server lifetimeImplementations§
Source§impl TranscodeRunner
impl TranscodeRunner
Sourcepub fn with_factory<F: TranscoderFactory>(self, factory: F) -> Self
pub fn with_factory<F: TranscoderFactory>(self, factory: F) -> Self
Register a transcoder factory by value.
Sourcepub fn with_factory_arc(self, factory: Arc<dyn TranscoderFactory>) -> Self
pub fn with_factory_arc(self, factory: Arc<dyn TranscoderFactory>) -> Self
Register a pre-arc’d factory. Useful when the caller
already shares an Arc<dyn TranscoderFactory> with other
server-side state.
Sourcepub fn with_ladder<F, Fn_>(self, ladder: Vec<RenditionSpec>, build: Fn_) -> Self
pub fn with_ladder<F, Fn_>(self, ladder: Vec<RenditionSpec>, build: Fn_) -> Self
Convenience: register one factory per rendition in the
supplied ladder, building each factory from its rendition
via build. Mirrors the RenditionSpec::default_ladder()
-> three PassthroughTranscoderFactory pattern without
forcing the caller to unroll it.
Sourcepub fn factory_count(&self) -> usize
pub fn factory_count(&self) -> usize
How many factories are currently registered. Useful for
Default-instantiated runners that want to gate their own
install calls.
Sourcepub fn install(
self,
registry: &FragmentBroadcasterRegistry,
) -> TranscodeRunnerHandle
pub fn install( self, registry: &FragmentBroadcasterRegistry, ) -> TranscodeRunnerHandle
Wire an on_entry_created callback on registry so every
new (broadcast, track) pair gets one drain task per
transcoder the registered factories opt into. Returns a
handle the caller MUST hold for the server lifetime;
dropping it aborts every spawned task.
Callback semantics mirror [lvqr_agent::AgentRunner::install]:
the callback runs on the thread that wins the
get_or_create insertion race, subscribes synchronously
so no emit can race ahead of the drain loop, and spawns
the per-transcoder drain task on the current tokio
runtime. If no tokio runtime is available the warn logs
and no task spawns.