pub trait ToRGBA: Send + Sync {
// Required methods
fn get_num_bytes(&self) -> RVec<usize>;
fn get_num_bytes_rgba(&self) -> usize;
fn get_total_bytes(&self) -> usize;
fn load_frame(
&self,
inputs: &RSlice<'_, RSlice<'_, u8>>,
) -> LoadedVideoFrame;
fn process_frame(&self, sources: LoadedVideoFrame) -> VideoFrame;
}Expand description
Provides functions for loading video frames onto the GPU.
Required Methods§
Sourcefn get_num_bytes(&self) -> RVec<usize>
fn get_num_bytes(&self) -> RVec<usize>
Used internally by Phaneron to get the size of a frame before loading.
Sourcefn get_num_bytes_rgba(&self) -> usize
fn get_num_bytes_rgba(&self) -> usize
Used internally by Phaneron to get the size of a frame after it is loaded onto the GPU.
Sourcefn get_total_bytes(&self) -> usize
fn get_total_bytes(&self) -> usize
Used internally by Phaneron during the loading process.
Sourcefn load_frame(&self, inputs: &RSlice<'_, RSlice<'_, u8>>) -> LoadedVideoFrame
fn load_frame(&self, inputs: &RSlice<'_, RSlice<'_, u8>>) -> LoadedVideoFrame
Loads a frame onto the GPU. For YUV formats, each of the Y,U, and V planes should be
provided in its own slice, thus a slice of slices is taken as an argument.
This does not perform the format conversion, only the copy.
Both this function and process_frame may be called in a background task/thread outside of the
process_frame function. A node should ensure that it only copies a “reasonable” amount of frames
onto the GPU at any point in time.
Sourcefn process_frame(&self, sources: LoadedVideoFrame) -> VideoFrame
fn process_frame(&self, sources: LoadedVideoFrame) -> VideoFrame
After loading a frame it must be processed into the common video format by calling this function.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".