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]
Each pass’s deliveries and how much of its span it has read.
Sourcepub fn stage(&self) -> (Stage, usize)
pub fn stage(&self) -> (Stage, usize)
The stage the run is in and the pass that concerns: the first before any pass has begun, the last once all have ended.
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 ExtractSessionwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<InputFrom>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<OutputSpec>: Freeze,
PhantomData<Pass>: Freeze,
*const LeafNode<String, DataSetId> is !null: Freeze,
PhantomData<Box<(String, DataSetId)>>: Freeze,
PhantomData<f32>: Freeze,
PhantomData<PassProgress>: Freeze,
PhantomData<(MediaTime, ())>: Freeze,
*const LeafNode<String, MediaTime> is !null: Freeze,
PhantomData<Box<(String, MediaTime)>>: Freeze,
*const LeafNode<String, Gathered> is !null: Freeze,
PhantomData<Box<(String, Gathered)>>: Freeze,
impl Move for ExtractSession
impl RefUnwindSafe for ExtractSession
impl Send for ExtractSessionwhere
RawVecInner: Send,
NodeRef<Owned, String, Value, LeafOrInternal>: Send,
BoxRaw<(String, Value)>: Send,
NodeRef<Owned, String, DataSetId, LeafOrInternal>: Send,
BoxRaw<(String, DataSetId)>: Send,
RawTable<(MediaTime, ())>: Send,
NodeRef<Owned, String, MediaTime, LeafOrInternal>: Send,
BoxRaw<(String, MediaTime)>: Send,
NodeRef<Owned, String, Gathered, LeafOrInternal>: Send,
BoxRaw<(String, Gathered)>: Send,
impl Sync for ExtractSessionwhere
RawVecInner: Sync,
NodeRef<Owned, String, Value, LeafOrInternal>: Sync,
BoxRaw<(String, Value)>: Sync,
NodeRef<Owned, String, DataSetId, LeafOrInternal>: Sync,
BoxRaw<(String, DataSetId)>: Sync,
RawTable<(MediaTime, ())>: Sync,
NodeRef<Owned, String, MediaTime, LeafOrInternal>: Sync,
BoxRaw<(String, MediaTime)>: Sync,
NodeRef<Owned, String, Gathered, LeafOrInternal>: Sync,
BoxRaw<(String, Gathered)>: Sync,
impl Unpin for ExtractSessionwhere
*const u8 is !null: Unpin,
*const LeafNode<String, Value> is !null: Unpin,
Box<(String, Value)>: Unpin,
*const LeafNode<String, DataSetId> is !null: Unpin,
Box<(String, DataSetId)>: Unpin,
*const LeafNode<String, MediaTime> is !null: Unpin,
Box<(String, MediaTime)>: Unpin,
*const LeafNode<String, Gathered> is !null: Unpin,
Box<(String, Gathered)>: Unpin,
impl UnsafeUnpin for ExtractSessionwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<InputFrom>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<OutputSpec>: UnsafeUnpin,
PhantomData<Pass>: UnsafeUnpin,
*const LeafNode<String, DataSetId> is !null: UnsafeUnpin,
PhantomData<Box<(String, DataSetId)>>: UnsafeUnpin,
PhantomData<f32>: UnsafeUnpin,
PhantomData<PassProgress>: UnsafeUnpin,
PhantomData<(MediaTime, ())>: UnsafeUnpin,
*const LeafNode<String, MediaTime> is !null: UnsafeUnpin,
PhantomData<Box<(String, MediaTime)>>: UnsafeUnpin,
*const LeafNode<String, Gathered> is !null: UnsafeUnpin,
PhantomData<Box<(String, Gathered)>>: UnsafeUnpin,
impl UnwindSafe for ExtractSessionwhere
RawVecInner: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
BTreeMap<String, DataSetId>: UnwindSafe,
NonNull<u8>: UnwindSafe,
BTreeMap<String, MediaTime>: UnwindSafe,
BTreeMap<String, Gathered>: UnwindSafe,
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