Skip to main content

Extractor

Trait Extractor 

Source
pub trait Extractor {
    // Required methods
    fn describe(&self) -> &Descriptor;
    fn begin(&mut self, context: &RunContext) -> Result<(), ExtractorError>;
    fn pass(&mut self, pass: &PassInfo) -> Result<(), ExtractorError>;
    fn video(
        &mut self,
        frame: &VideoInput,
        out: &mut Emitter,
    ) -> Result<(), ExtractorError>;
    fn audio(
        &mut self,
        block: &AudioInput,
        out: &mut Emitter,
    ) -> Result<(), ExtractorError>;
    fn end(&mut self, out: &mut Emitter) -> Result<(), ExtractorError>;

    // Provided method
    fn frame_buffer(&mut self, len: usize) -> Option<&mut [u8]> { ... }
}
Expand description

A function that is supplied frames or audio and returns primitives. Runs ahead of time over a range; what it emits is recorded as data sets.

Required Methods§

Source

fn describe(&self) -> &Descriptor

What the extractor reads and emits.

Source

fn begin(&mut self, context: &RunContext) -> Result<(), ExtractorError>

The run begins; model loading belongs here.

§Errors

The extractor’s failure, which ends the run.

Source

fn pass(&mut self, pass: &PassInfo) -> Result<(), ExtractorError>

A pass begins.

§Errors

The extractor’s failure, which ends the run.

Source

fn video( &mut self, frame: &VideoInput, out: &mut Emitter, ) -> Result<(), ExtractorError>

A video frame of the current pass.

§Errors

The extractor’s failure, which ends the run.

Source

fn audio( &mut self, block: &AudioInput, out: &mut Emitter, ) -> Result<(), ExtractorError>

An audio block of the current pass.

§Errors

The extractor’s failure, which ends the run.

Source

fn end(&mut self, out: &mut Emitter) -> Result<(), ExtractorError>

Every pass ended; whole-range work belongs here and may emit any time in the range.

§Errors

The extractor’s failure, which ends the run.

Provided Methods§

Source

fn frame_buffer(&mut self, len: usize) -> Option<&mut [u8]>

Memory of exactly len bytes for the next supplied frame’s delivered pixels, for an extractor that would otherwise copy them. When it gives some and the frame is written there, the video call that delivers it gets empty VideoInput::bytes. None, the default, keeps the pixels in bytes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§