pub struct ExtractSession { /* private fields */ }Expand description
One run of an extractor over a range, driven by the host.
The host loops on Self::next: it supplies each Need, hands each Delivery to the
extractor and passes the extractor’s Emits to Self::emit, and stops at
Step::Done. Cancelling is not calling next again. Self::finish returns validated
data sets. The session never decodes, renders or reads files.
Implementations§
Source§impl ExtractSession
impl ExtractSession
Sourcepub fn new(
project: &Project,
descriptor: &Descriptor,
request: ExtractRequest,
) -> Result<Self, RequestError>
pub fn new( project: &Project, descriptor: &Descriptor, request: ExtractRequest, ) -> Result<Self, RequestError>
Starts a run of the extractor descriptor describes, as request asks, over project.
§Errors
RequestError when the descriptor or request breaks a rule.
Sourcepub fn context(&self) -> RunContext
pub fn context(&self) -> RunContext
The run’s context, for the extractor’s begin.
Sourcepub const fn descriptor(&self) -> &Descriptor
pub const fn descriptor(&self) -> &Descriptor
The descriptor the session runs.
Sourcepub const fn request(&self) -> &ExtractRequest
pub const fn request(&self) -> &ExtractRequest
The request the session runs.
Sourcepub fn progress(&self) -> &[PassProgress]
pub fn progress(&self) -> &[PassProgress]
Completed and total deliveries of each pass.
Sourcepub fn next(&mut self) -> Step
pub fn next(&mut self) -> Step
The next step. Calling it again before supplying an outstanding need repeats the need.
Sourcepub fn supply_video(&mut self, frame: SuppliedFrame) -> Result<(), SessionError>
pub fn supply_video(&mut self, frame: SuppliedFrame) -> Result<(), SessionError>
Answers an outstanding frame need.
§Errors
SessionError::UnexpectedSupply when no frame is asked for, or the frame’s size, buffer
or pts does not answer the need.
Sourcepub fn supply_placed_video(
&mut self,
frame: SuppliedFrame,
) -> Result<(), SessionError>
pub fn supply_placed_video( &mut self, frame: SuppliedFrame, ) -> Result<(), SessionError>
Answers an outstanding RGBA frame need with a frame whose pixels the supplier wrote into
the extractor’s crate::extract::Extractor::frame_buffer: its rgba is empty, and so
is the delivered VideoInput::bytes.
§Errors
As Self::supply_video, and when the need is not for RGBA frames.
Sourcepub fn supply_video_into(
&mut self,
frame: SuppliedFrame,
buffer: &mut [u8],
) -> Result<(), SessionError>
pub fn supply_video_into( &mut self, frame: SuppliedFrame, buffer: &mut [u8], ) -> Result<(), SessionError>
Answers an outstanding frame need, writing the delivered pixels (RGBA, or their luma)
into buffer, which holds exactly their bytes; the delivered VideoInput::bytes is
then empty.
§Errors
As Self::supply_video, and when buffer has another length.
Sourcepub fn supply_end(&mut self) -> Result<(), SessionError>
pub fn supply_end(&mut self) -> Result<(), SessionError>
Answers an outstanding source-frame need: no such frame exists, so the pass ends.
§Errors
SessionError::UnexpectedSupply when no source frame is asked for.
Sourcepub fn supply_audio(&mut self, block: SuppliedAudio) -> Result<(), SessionError>
pub fn supply_audio(&mut self, block: SuppliedAudio) -> Result<(), SessionError>
Answers an outstanding audio need with exactly the asked frames.
§Errors
SessionError::UnexpectedSupply when no audio is asked for, or the block’s channel
count or length does not answer the need.
Sourcepub fn emit(&mut self, emits: &[Emit]) -> Result<(), SessionError>
pub fn emit(&mut self, emits: &[Emit]) -> Result<(), SessionError>
Validates and records emits; on a refusal nothing of emits is recorded.
During a pass, times lie inside the range (or are a delivered frame’s pts), go no further
than what the pass has delivered, and move in the pass direction per output. After
Step::Done any time inside the range is accepted. A requested output holds at most
OutputSpec::max_items; emits to a declared output the request does not name are
checked and dropped.
§Errors
SessionError::InvalidEmit naming the first offending emit and the rule.
Sourcepub fn finish(&mut self) -> Result<Vec<DataSet>, SessionError>
pub fn finish(&mut self) -> Result<Vec<DataSet>, SessionError>
The recorded outputs as data sets: merged across passes, sorted, with made_by set and
made_from left for the surface helper.
§Errors
SessionError::InvalidResult before Step::Done, for a time emitted twice, or for a
set that breaks a data limit.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ExtractSession
impl Freeze for ExtractSession
impl Move for ExtractSession
impl RefUnwindSafe for ExtractSession
impl Send for ExtractSession
impl Sync for ExtractSession
impl Unpin for ExtractSession
impl UnsafeUnpin for ExtractSession
impl UnwindSafe for ExtractSession
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> 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