pub struct Frame {
pub timestamp: Timestamp,
pub surface: Surface,
}Expand description
One raw (uncompressed) video frame: the pixels plus when they are shown.
The currency of the crate’s raw side: capture and
decode produce these, and
encode::Encoder::encode consumes them,
handing back the compressed encode::Encoded.
Fields§
§timestamp: TimestampPresentation timestamp. It rides through the encoder with the picture, so a backend that buffers or reorders still stamps each packet with the time of the frame it actually encoded.
surface: SurfaceThe pixels, and where they currently live.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn resize(&self, size: Size) -> Result<Frame, Error>
pub fn resize(&self, size: Size) -> Result<Frame, Error>
A copy of this frame scaled to size (both dimensions even and non-zero),
preserving the timestamp. CUDA and macOS CVPixelBuffer frames scale on
the GPU and stay there, so resize ->
encode never touches the CPU. Other
frames scale on the CPU. When one output size is enough, prefer decoding
straight to it (decode::Config::resize), which
is free on decoders with a hardware scaler; this method is for fanning one
decoded stream out to several sizes.