pub struct Frame { /* private fields */ }Expand description
A decoded picture.
The data is behind an Arc so a frame can be handed to a renderer, an
encoder, and a callback at once without copying — none of them mutate it.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn packed(
width: u32,
height: u32,
format: PixelFormat,
color: ColorSpace,
pts: Duration,
data: Vec<u8>,
) -> Result<Self>
pub fn packed( width: u32, height: u32, format: PixelFormat, color: ColorSpace, pts: Duration, data: Vec<u8>, ) -> Result<Self>
A frame over data, with the planes laid out end to end and no padding.
§Errors
Error::BadFrame if data is not the size that layout implies, or
either dimension is zero.
Sourcepub fn with_planes(
width: u32,
height: u32,
format: PixelFormat,
color: ColorSpace,
pts: Duration,
planes: Vec<Plane>,
data: Vec<u8>,
) -> Result<Self>
pub fn with_planes( width: u32, height: u32, format: PixelFormat, color: ColorSpace, pts: Duration, planes: Vec<Plane>, data: Vec<u8>, ) -> Result<Self>
A frame whose planes are where the decoder put them.
§Errors
Error::BadFrame if the plane count is wrong for the format, or any
plane’s last row runs past the end of data.
Sourcepub fn format(&self) -> PixelFormat
pub fn format(&self) -> PixelFormat
The sample layout.
Sourcepub fn color(&self) -> ColorSpace
pub fn color(&self) -> ColorSpace
What the samples mean.
Sourcepub fn with_pts(&self, pts: Duration) -> Self
pub fn with_pts(&self, pts: Duration) -> Self
Retimes the frame, for a player that offsets a stream against a master clock. Cheap: the data is shared, not copied.
Sourcepub fn plane_data(&self, plane: usize) -> Option<&[u8]>
pub fn plane_data(&self, plane: usize) -> Option<&[u8]>
One plane’s bytes, from its offset to the end of its last row.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more