Skip to main content

FFramesSyncedVideoFrame

Trait FFramesSyncedVideoFrame 

Source
pub trait FFramesSyncedVideoFrame<'media> {
    // Required methods
    fn into_image(&self) -> ImageData<'media>;
    fn into_resized_image(
        &self,
        options: &FrameConvertOptions,
    ) -> Option<ImageData<'media>>;
    fn height(&self) -> u32;
    fn width(&self) -> u32;
    fn timestamp_seconds(&self) -> f32;
    fn timestamp(&self) -> i64;
    fn stream_fps(&self) -> f32;
    fn stream_duration_in_seconds(&self) -> f32;
}

Required Methods§

Source

fn into_image(&self) -> ImageData<'media>

Gets the original image from the frame This will perform color space conversion but will preserve the original frame size. If you need to render the video frame in the smaller size, use into_resized_image.

This method take self to reuse frame data allocations, but you should not call this method more than once per the render function

Source

fn into_resized_image( &self, options: &FrameConvertOptions, ) -> Option<ImageData<'media>>

Performs color space conversion and resizes the image to the specified size. Recommended to use this method if you render image in the smaller size than the original video e.g. as a pattern of some other shape or as a filler of standalone image.

This method take self to reuse frame data allocations, but you should not call this method more than once per the render function

Source

fn height(&self) -> u32

Get the native height of the frame

Source

fn width(&self) -> u32

Get the native size of the frame

Source

fn timestamp_seconds(&self) -> f32

Get the frame index of the origin video

Source

fn timestamp(&self) -> i64

Returns the native frame timestamp in the decoders’ timebase

Source

fn stream_fps(&self) -> f32

Get the FPS of the origin video

Source

fn stream_duration_in_seconds(&self) -> f32

Get the duration of the origin video in frames

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'media> FFramesSyncedVideoFrame<'media> for FFmpegFrameBuf

Available on non-WebAssembly only.
Source§

fn width(&self) -> u32

Returns the original stream video width

Source§

fn height(&self) -> u32

Returns the original stream video height

Source§

fn into_image(&self) -> ImageData<'media>

Source§

fn into_resized_image( &self, options: &FrameConvertOptions, ) -> Option<ImageData<'media>>

Source§

fn timestamp_seconds(&self) -> f32

Source§

fn timestamp(&self) -> i64

Source§

fn stream_duration_in_seconds(&self) -> f32

Source§

fn stream_fps(&self) -> f32

Implementors§