Skip to main content

FFramesRenderBackend

Trait FFramesRenderBackend 

Source
pub trait FFramesRenderBackend {
    // Required methods
    fn render_frame<'a, 'media: 'a, TVideo: Video + Sync + Sized + Send>(
        self,
        frame: Frame,
        video: &'a TVideo,
        usvg_options: &Options<'_>,
        font_db: &Database,
        ctx: FFramesContext<'a, 'media>,
    ) -> FFramesRendererResult<Vec<u8>>;
    fn render<'a, 'media: 'a, TVideo: Video + Sync + Sized + Send>(
        self,
        output: impl AsRef<Path>,
        video: &'a TVideo,
        logger: Arc<dyn FFramesLogger>,
        usvg_options: &'a Options<'_>,
        encoder_options: &'a RenderOptions<'a, 'media>,
        font_db: &'a Database,
        timeline: &'a ResolvedRenderingTimeline<'_, AudioTimelineSamples>,
        ctx: &'a FFramesContext<'a, 'media>,
    ) -> FFramesRendererResult<()>
       where Self: Sized;

    // Provided methods
    fn fast_shapes(&self) -> bool { ... }
    fn frame_renderer(&self) -> Option<impl FrameRenderer + '_> { ... }
    fn negotiate_encoder_input(
        &self,
        encoder: &VideoEncoderInfo<'_>,
    ) -> RenderEncodingResult<EncoderInput> { ... }
    fn encoder_frame_renderer(
        &self,
        input: &EncoderInput,
        width: u32,
        height: u32,
    ) -> FFramesRendererResult<impl EncoderFrameRenderer + '_> { ... }
    fn svgr_rasterizer(&self) -> Option<Box<dyn SvgrRasterizer + '_>> { ... }
}

Required Methods§

Source

fn render_frame<'a, 'media: 'a, TVideo: Video + Sync + Sized + Send>( self, frame: Frame, video: &'a TVideo, usvg_options: &Options<'_>, font_db: &Database, ctx: FFramesContext<'a, 'media>, ) -> FFramesRendererResult<Vec<u8>>

Source

fn render<'a, 'media: 'a, TVideo: Video + Sync + Sized + Send>( self, output: impl AsRef<Path>, video: &'a TVideo, logger: Arc<dyn FFramesLogger>, usvg_options: &'a Options<'_>, encoder_options: &'a RenderOptions<'a, 'media>, font_db: &'a Database, timeline: &'a ResolvedRenderingTimeline<'_, AudioTimelineSamples>, ctx: &'a FFramesContext<'a, 'media>, ) -> FFramesRendererResult<()>
where Self: Sized,

Provided Methods§

Source

fn fast_shapes(&self) -> bool

Whether this backend draws usvgr::Node::FastShape natively. When true, frames are converted with usvgr::Options::fast_shapes: circle, ellipse and rounded rect stay shapes instead of becoming generic paths.

The default (false) keeps the exact path geometry the CPU backend is tested against.

Source

fn frame_renderer(&self) -> Option<impl FrameRenderer + '_>

Renders single frames (fframes::Previewer, the CLI’s frame, strip and onion) the way this backend renders the video, so previews match the output. None uses the built-in CPU renderer.

Source

fn negotiate_encoder_input( &self, encoder: &VideoEncoderInfo<'_>, ) -> RenderEncodingResult<EncoderInput>

Picks what the video encoders of a render are opened with, before any of them exists. A backend that can produce the encoder’s frames natively answers with the format it delivers: another software format it converts to on the GPU, or hardware frames (EncoderInput::hardware_frames) the encoder reads without the pixels ever being copied into memory.

The default keeps the pixel format requested in EncoderOptions.

Source

fn encoder_frame_renderer( &self, input: &EncoderInput, width: u32, height: u32, ) -> FFramesRendererResult<impl EncoderFrameRenderer + '_>

Rasterizes frames into what the encoder takes (input is the outcome of Self::negotiate_encoder_input), one renderer per rendering thread.

The default renders RGBA with Self::frame_renderer and converts it on the CPU.

Source

fn svgr_rasterizer(&self) -> Option<Box<dyn SvgrRasterizer + '_>>

Renders svgr trees inside Video::render_frame for crate::FFramesContext::render_svgr during the renders and previews of this backend. The default renders on the CPU with tiny-skia (feature cpu_renderer).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§