pub struct Exporter { /* private fields */ }Expand description
Deterministic, retryable frame-sequence runner.
Implementations§
Source§impl Exporter
impl Exporter
Sourcepub const MISSING_FRAME_POLICY: MissingFramePolicy = MissingFramePolicy::Wait
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.
Sourcepub fn new(
snapshot: &EngineProject,
range: TimeRange,
frame_rate: FrameRate,
quality: QualityProfile,
codec: VideoCodec,
) -> Result<Self, EngineError>
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.
Sourcepub fn still(
snapshot: &EngineProject,
time: MediaTime,
frame_rate: FrameRate,
quality: QualityProfile,
) -> Result<Self, EngineError>
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.
Sourcepub const fn encoding(&self) -> YuvEncoding
pub const fn encoding(&self) -> YuvEncoding
How this export’s frames are packed into 4:2:0 YUV.
Sourcepub const fn with_pixels(self, pixels: PixelLayout) -> Self
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.
Sourcepub const fn pixels(&self) -> PixelLayout
pub const fn pixels(&self) -> PixelLayout
The layout this export’s frames are packed in.
Sourcepub const fn with_background(self, drawn: bool) -> Self
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).
Sourcepub const fn effective_range(&self) -> TimeRange
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.
Sourcepub fn audio_window(
&self,
sample_rate: u32,
) -> Result<ExportAudioWindow, EngineError>
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.
Sourcepub fn for_project(
project: &EngineProject,
quality: QualityProfile,
codec: VideoCodec,
) -> Result<Self, EngineError>
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.
Sourcepub const fn missing_frame_policy(&self) -> MissingFramePolicy
pub const fn missing_frame_policy(&self) -> MissingFramePolicy
Returns the policy used when source frames are unavailable.
Sourcepub const fn progress(&self) -> ExportProgress
pub const fn progress(&self) -> ExportProgress
Returns current deterministic export progress.
Sourcepub fn render_size(
&self,
project: &EngineProject,
) -> Result<RenderSize, EngineError>
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.
Sourcepub fn pending_time(&self) -> Option<MediaTime>
pub fn pending_time(&self) -> Option<MediaTime>
Returns the pending frame timestamp, or None after completion.
Sourcepub fn take_next(&mut self) -> Result<Option<(u64, MediaTime)>, EngineError>
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.
Sourcepub const fn frame_rate(&self) -> FrameRate
pub const fn frame_rate(&self) -> FrameRate
The frame grid the export renders on.
Sourcepub fn upcoming_times(&self, frames: u32) -> Result<Vec<MediaTime>, EngineError>
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.
Sourcepub fn prefetch_needs(
&self,
project: &EngineProject,
frames: u32,
) -> Result<Vec<ExportFrameNeeds>, EngineError>
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.
Sourcepub fn render_next(
&mut self,
project: &EngineProject,
renderer: &Renderer,
frames: &dyn FrameProvider,
) -> Result<ExportStep, EngineError>
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.
Sourcepub fn render_next_timed(
&mut self,
project: &EngineProject,
renderer: &Renderer,
frames: &dyn FrameProvider,
timings: &mut ExportStepTimings,
) -> Result<ExportStep, EngineError>
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.
Sourcepub 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>
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.
Sourcepub 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>
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
Sourcepub fn render_next_texture<R: FrameRenderer + ?Sized>(
&mut self,
project: &EngineProject,
renderer: &R,
frames: &dyn FrameProvider,
) -> Result<ExportTextureStep<R::Image>, EngineError>
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§
Auto Trait Implementations§
impl Freeze for Exporter
impl RefUnwindSafe for Exporter
impl Send for Exporter
impl Sync for Exporter
impl Unpin for Exporter
impl UnsafeUnpin for Exporter
impl UnwindSafe for Exporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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