Skip to main content

ExtractSession

Struct ExtractSession 

Source
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

Source

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.

Source

pub fn context(&self) -> RunContext

The run’s context, for the extractor’s begin.

Source

pub const fn descriptor(&self) -> &Descriptor

The descriptor the session runs.

Source

pub const fn request(&self) -> &ExtractRequest

The request the session runs.

Source

pub fn progress(&self) -> &[PassProgress]

Each pass’s deliveries and how much of its span it has read.

Source

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.

Source

pub fn next(&mut self) -> Step

The next step. Calling it again before supplying an outstanding need repeats the need.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Debug for ExtractSession

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for ExtractSession

§

impl Freeze for ExtractSession

§

impl Move for ExtractSession

§

impl RefUnwindSafe for ExtractSession

§

impl Send for ExtractSession
where 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 ExtractSession
where 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 ExtractSession
where *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 ExtractSession

§

impl UnwindSafe for ExtractSession

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