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: pipelined and synchronous exports are byte-identical. Repeating a late frame would break that, so this is a constant. Player can choose differently because real-time playback has no such guarantee.

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.

All refusals happen here, before a host opens an encoder: 4:2:0 output at quality must have even dimensions, and frames are packed per YuvEncoding::export for codec. Later steps refuse any other snapshot with EngineError::ExportProjectChanged.

§Errors

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

Source

pub fn still( snapshot: &EngineProject, time: MediaTime, frame_rate: FrameRate, quality: QualityProfile, ) -> Result<Self, EngineError>

An exporter of the single frame_rate frame containing time, for hosts that take the picture via Self::render_next_texture rather than 4:2:0, so odd sizes are allowed.

§Errors

Returns an error for invalid quality or a time past the timeline.

Source

pub const fn encoding(&self) -> YuvEncoding

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

Source

pub const fn with_pixels(self, pixels: PixelLayout) -> Self

This exporter writing pixels (alpha2_media::resolve_pixels) instead of 8-bit 4:2:0. A layout with alpha drops the project background. The even-size rule of Self::new still applies, 4:4:4 included.

Source

pub const fn pixels(&self) -> PixelLayout

The layout this export’s frames are packed in.

Source

pub const fn with_background(self, drawn: bool) -> Self

This exporter with the project background drawn or, if drawn is false, replaced by transparent black (for example a still taken via Self::render_next_texture).

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)).

The first frame may start up to one frame before the request. Its start is the output’s zero, so hosts place audio and report the export from this range.

Source

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

The export_audio_window of Self::effective_range at sample_rate.

§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 over 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, for preparing 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>

Skips rendering the pending frame (supplied elsewhere, such as an earlier bake) and advances the cursor as a render would. Returns its index and time, or None when done.

§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, without moving the cursor. 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 cursor is not changed. frames counts the current frame and is clamped to 120.

§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.

Renders exactly what Exporter::render_next does. A waiting step records only the stages that ran.

§Errors

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

Source

pub fn render_next_into_yuv420p<R: FrameRenderer + ?Sized>( &mut self, project: &EngineProject, renderer: &R, frames: &dyn FrameProvider, targets: &mut Yuv420pTargets<'_>, timings: Option<&mut ExportStepTimings>, ) -> Result<ExportPlaneStep, EngineError>

Renders the next frame straight into caller-owned YUV420 planes on either renderer.

The cursor advances as for Self::render_next; a waiting step writes nothing. timings records the whole draw as its submit span.

§Errors

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

Source

pub fn render_next_into_planes<R: FrameRenderer + ?Sized>( &mut self, project: &EngineProject, renderer: &R, frames: &dyn FrameProvider, targets: &mut [PlaneTarget<'_>], timings: Option<&mut ExportStepTimings>, ) -> Result<ExportPlaneStep, EngineError>

Self::render_next_into_yuv420p for this export’s layout (Self::pixels), one buffer per plane in PixelLayout::planes order.

§Errors

As Self::render_next_into_yuv420p.

Source

pub fn render_next_texture<R: FrameRenderer + ?Sized>( &mut self, project: &EngineProject, renderer: &R, frames: &dyn FrameProvider, ) -> Result<ExportTextureStep<R::Image>, EngineError>

Renders the next frame and hands over its texture without readback or packing.

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> 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> 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,