Skip to main content

MultiTrackExecutor

Struct MultiTrackExecutor 

Source
pub struct MultiTrackExecutor<M: Muxer> { /* private fields */ }
Expand description

Frame-level multi-track decode → filter → encode executor with DTS-ordered muxing.

§Usage

use oximedia_transcode::multi_track::{MultiTrackExecutor, PerTrack};
use oximedia_transcode::pipeline_context::{FilterGraph, Frame};

// Supply concrete FrameDecoder / FrameEncoder implementations:
let mut executor = MultiTrackExecutor::new(muxer);
executor.add_track(PerTrack::new(0, decoder0, FilterGraph::new(), encoder0));
executor.add_track(PerTrack::new(1, decoder1, FilterGraph::new(), encoder1));
let stats = executor.execute(&streams).await?;

Implementations§

Source§

impl<M: Muxer> MultiTrackExecutor<M>

Source

pub fn new(muxer: M) -> Self

Creates a new executor wrapping muxer.

Tracks must be added with add_track before calling execute or step.

Source

pub fn add_track(&mut self, track: PerTrack)

Adds a PerTrack to the executor.

Source

pub fn set_flush_interval(&mut self, n: u64)

Overrides the heap flush interval (default: 30 steps).

Source

pub fn muxer(&self) -> &M

Returns a shared reference to the inner muxer.

Source

pub fn into_muxer(self) -> M

Consumes the executor and returns the inner muxer.

Source

pub fn stats(&self) -> &MultiTrackStats

Returns the accumulated execution statistics.

Source

pub async fn step(&mut self) -> Result<bool>

Perform one step of the pipeline: attempt to decode one frame from every active track, filter and encode it, then push the result onto the DTS heap.

Periodically drains the heap to the muxer based on the minimum active DTS (safe-drain strategy).

Returns true if at least one track produced an encoded packet this step, false when all tracks are exhausted.

§Errors

Propagates errors from the filter graph, encoder, or muxer.

Source

pub async fn execute( &mut self, streams: &[StreamInfo], ) -> Result<MultiTrackStats>

Execute the full pipeline end-to-end.

  1. Registers streams with the muxer and writes the header.
  2. Calls step in a loop until all tracks are exhausted.
  3. Flushes each track’s encoder.
  4. Drains the remaining heap to the muxer in DTS order.
  5. Writes the muxer trailer.

Returns accumulated MultiTrackStats.

§Errors

Returns an error if any stage (filter, encode, mux header/packet/trailer) fails.

Auto Trait Implementations§

§

impl<M> Freeze for MultiTrackExecutor<M>
where M: Freeze,

§

impl<M> !RefUnwindSafe for MultiTrackExecutor<M>

§

impl<M> Send for MultiTrackExecutor<M>

§

impl<M> !Sync for MultiTrackExecutor<M>

§

impl<M> Unpin for MultiTrackExecutor<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for MultiTrackExecutor<M>
where M: UnsafeUnpin,

§

impl<M> !UnwindSafe for MultiTrackExecutor<M>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more