pub struct VideoFrameData {
pub width: u32,
pub height: u32,
pub data: Vec<u8>,
}Expand description
Raw video frame data in RGBA format.
This struct holds a single frame of video data that can be uploaded to a GPU texture. The data is expected to be in RGBA format with 4 bytes per pixel.
§Note on Public Fields
Fields are public for zero-copy access to pixel data. Use the constructor
VideoFrameData::new or VideoFrameData::placeholder to create
validated instances. Direct modification of fields after construction
may violate the width*height*4 == data.len() invariant.
Fields§
§width: u32Width of the frame in pixels.
height: u32Height of the frame in pixels.
data: Vec<u8>RGBA pixel data (4 bytes per pixel, row-major order).
Implementations§
Source§impl VideoFrameData
impl VideoFrameData
Sourcepub fn new(width: u32, height: u32, data: Vec<u8>) -> VideoTextureResult<Self>
pub fn new(width: u32, height: u32, data: Vec<u8>) -> VideoTextureResult<Self>
Create a new video frame from RGBA data.
§Errors
Returns an error if:
- The dimensions would cause integer overflow
- The data length doesn’t match width * height * 4
Sourcepub fn placeholder(width: u32, height: u32) -> VideoTextureResult<Self>
pub fn placeholder(width: u32, height: u32) -> VideoTextureResult<Self>
Create a placeholder frame with a solid color.
Used when a video stream is not yet available.
§Errors
Returns an error if the dimensions would cause integer overflow.
Trait Implementations§
Source§impl Clone for VideoFrameData
impl Clone for VideoFrameData
Source§fn clone(&self) -> VideoFrameData
fn clone(&self) -> VideoFrameData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for VideoFrameData
impl RefUnwindSafe for VideoFrameData
impl Send for VideoFrameData
impl Sync for VideoFrameData
impl Unpin for VideoFrameData
impl UnwindSafe for VideoFrameData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more