Skip to main content

Exporter

Struct Exporter 

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

Deterministic, retryable frame-sequence runner.

Implementations§

Source§

impl Exporter

Source

pub const MISSING_FRAME_POLICY: MissingFramePolicy = MissingFramePolicy::Wait

The only policy an export can apply.

Export output must not depend on decode timing: a pipelined export and a synchronous one are required to be byte-identical, which scripts/test-host-cli-parity.mjs asserts. Repeating the previous frame when a source is late would make the result a function of how fast the host decoded, so this is a constant rather than a setting. Player configures the same policy because a dropped real-time frame has no such guarantee to break.

Source

pub fn new( snapshot: &EngineProject, range: TimeRange, frame_rate: FrameRate, quality: QualityProfile, codec: VideoCodec, ) -> Result<Self, EngineError>

Creates an exporter for frame intervals intersecting a half-open timeline range.

Everything an export can be refused for is refused here, before a host opens an encoder: the output 4:2:0 frames are the project size at quality, and they must be even in both dimensions. They are packed for codec: YuvEncoding::export. Every later step takes this snapshot (or a clone of it) and refuses any other with EngineError::ExportProjectChanged, so an export renders one project, at the size checked here.

§Errors

Returns an error for an empty range, invalid quality, timeline overflow, or EngineError::OddExportDimensions.

Source

pub const fn encoding(&self) -> YuvEncoding

How this export’s frames are packed into 4:2:0 YUV.

Source

pub const fn effective_range(&self) -> TimeRange

The timeline range this export covers: the requested range widened to the frame grid, [floor(start), ceil(end)).

A video export renders whole frames, so its first frame can start up to one frame before the requested start. That frame’s start is the output’s zero, and a host places audio, and reports the export, from this range rather than from the request.

Source

pub fn audio_window( &self, sample_rate: u32, ) -> Result<ExportAudioWindow, EngineError>

The samples this export’s audio covers at sample_rate: the export_audio_window of Self::effective_range.

§Errors

Returns EngineError::OutOfRange when the range does not fit in memory-addressable samples.

Source

pub fn for_project( project: &EngineProject, quality: QualityProfile, codec: VideoCodec, ) -> Result<Self, EngineError>

Creates an exporter spanning everything a project shows, its clips and caption cues (EngineProject::timeline_range), packed for codec.

§Errors

Returns an error for an empty project or invalid schedule.

Source

pub const fn missing_frame_policy(&self) -> MissingFramePolicy

Returns the policy used when source frames are unavailable.

Source

pub const fn progress(&self) -> ExportProgress

Returns current deterministic export progress.

Source

pub fn render_size( &self, project: &EngineProject, ) -> Result<RenderSize, EngineError>

The size frames of project render at: where a host prepares their captions.

§Errors

Returns an error when the quality profile cannot size the project.

Source

pub fn pending_time(&self) -> Option<MediaTime>

Returns the pending frame timestamp, or None after completion.

Source

pub fn take_next(&mut self) -> Result<Option<(u64, MediaTime)>, EngineError>

Takes the pending frame as supplied from elsewhere (a copy baked by an earlier export of the same snapshot) and advances the cursor exactly as a render does. Returns its index and time, or None after completion.

§Errors

Returns EngineError::OutOfRange if the cursor would overflow.

Source

pub const fn frame_rate(&self) -> FrameRate

The frame grid the export renders on.

Source

pub fn upcoming_times(&self, frames: u32) -> Result<Vec<MediaTime>, EngineError>

The times of the pending frame and up to frames - 1 after it, in order, as Self::take_next and the renders after it will reach them: fewer near the end of the range, none after completion. The cursor is not changed, and frames is clamped as in Self::prefetch_needs.

§Errors

Returns EngineError::OutOfRange if a time overflows.

Source

pub fn prefetch_needs( &self, project: &EngineProject, frames: u32, ) -> Result<Vec<ExportFrameNeeds>, EngineError>

Returns decode requirements for the pending frame and bounded lookahead.

The exporter cursor is not changed. frames is the total number of scheduled frames requested, including the current frame, and is clamped to 120 to keep one request bounded.

§Errors

Returns evaluation or timeline overflow errors, and EngineError::ExportProjectChanged for another snapshot.

Source

pub fn render_next( &mut self, project: &EngineProject, renderer: &Renderer, frames: &dyn FrameProvider, ) -> Result<ExportStep, EngineError>

Attempts one frame without blocking on host decode.

Waiting does not change progress. A successful render advances the exact rational frame cursor once, so retries cannot skip timestamps.

§Errors

Returns timeline evaluation, quality, or rendering failures, and EngineError::ExportProjectChanged for another snapshot.

Source

pub fn render_next_timed( &mut self, project: &EngineProject, renderer: &Renderer, frames: &dyn FrameProvider, timings: &mut ExportStepTimings, ) -> Result<ExportStep, EngineError>

Attempts one frame and reports where the step spent its time.

This renders exactly what Exporter::render_next renders. A step that only waits leaves timings holding the stages that ran.

§Errors

Returns timeline evaluation, quality, or rendering failures, and EngineError::ExportProjectChanged for another snapshot.

Source

pub fn render_next_texture( &mut self, project: &EngineProject, renderer: &Renderer, frames: &dyn FrameProvider, ) -> Result<ExportTextureStep, EngineError>

Renders the next frame and hands its texture over, with no readback and no pack: for a host that moves the picture on by other means, such as presenting it to a canvas an encoder captures.

The cursor advances exactly as it does for Self::render_next.

§Errors

Returns an engine error when evaluation or rendering fails, and EngineError::ExportProjectChanged for another snapshot.

Trait Implementations§

Source§

impl Clone for Exporter

Source§

fn clone(&self) -> Self

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 Exporter

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,