pub trait Filter: Send {
// Required methods
fn name(&self) -> &'static str;
fn filter(&mut self, frame: VideoFrame) -> Result<VideoFrame>;
// Provided methods
fn output_dims(&self, in_w: u32, in_h: u32) -> (u32, u32) { ... }
fn output_color_range(&self) -> Option<ColorRange> { ... }
fn set_source_color_range(&mut self, _range: ColorRange) { ... }
}Expand description
One frame transform. Implementors map a video frame to a new video frame.
Required Methods§
Sourcefn filter(&mut self, frame: VideoFrame) -> Result<VideoFrame>
fn filter(&mut self, frame: VideoFrame) -> Result<VideoFrame>
Transform one frame.
Provided Methods§
Sourcefn output_dims(&self, in_w: u32, in_h: u32) -> (u32, u32)
fn output_dims(&self, in_w: u32, in_h: u32) -> (u32, u32)
Report the output dimensions this filter produces for a given input size, without running it (so the muxer can size the output stream up front). Defaults to unchanged.
Sourcefn output_color_range(&self) -> Option<ColorRange>
fn output_color_range(&self) -> Option<ColorRange>
The luma/chroma range this filter’s output is in, when the filter is the
one that decides it. Only a colour conversion knows this; everything else
passes the incoming range through, hence the None default.
The muxer needs it: writing full-range samples into a container that labels them limited-range silently rescales them on the way out.
Sourcefn set_source_color_range(&mut self, _range: ColorRange)
fn set_source_color_range(&mut self, _range: ColorRange)
Tell the filter what range its input is in. Only a colour conversion cares, and only when the spec string did not pin the range itself.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".