pub struct VideoPlane<'a> { /* private fields */ }Expand description
An allocation-free view of one video plane’s initialized active bytes.
Plane order follows the pixel format: packed pixels; UYVY/A for UYVA;
Y/CbCr[/A] for P216/PA16; Y/V/U for YV12; Y/U/V for I420; Y/UV for NV12.
The view borrows its captured frame, which keeps the SDK allocation alive.
Immutable pixel views are Send + Sync, including views borrowed from
FrameSync. Scoped workers must finish before the frame is freed. This does
not transfer the SDK-owning frame reference or change its freeing thread.
let plane = frame.plane(0).unwrap();
let rows = plane.rows();
std::thread::scope(|scope| {
let worker = scope.spawn(move || {
rows.flatten().map(|&byte| u64::from(byte)).sum::<u64>()
});
assert_eq!(worker.join().unwrap(),
plane.rows().flatten().map(|&byte| u64::from(byte)).sum::<u64>());
});Implementations§
Source§impl<'a> VideoPlane<'a>
impl<'a> VideoPlane<'a>
Sourcepub fn row_stride(&self) -> usize
pub fn row_stride(&self) -> usize
Distance between row starts in bytes, including padding.
Sourcepub fn active_row_bytes(&self) -> usize
pub fn active_row_bytes(&self) -> usize
Number of initialized bytes in each row.
Sourcepub fn row(&self, index: usize) -> Option<&'a [u8]>
pub fn row(&self, index: usize) -> Option<&'a [u8]>
Get an active row, excluding padding, or None for an invalid index.
Trait Implementations§
Source§impl<'a> Clone for VideoPlane<'a>
impl<'a> Clone for VideoPlane<'a>
Source§fn clone(&self) -> VideoPlane<'a>
fn clone(&self) -> VideoPlane<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for VideoPlane<'a>
Source§impl<'a> Debug for VideoPlane<'a>
impl<'a> Debug for VideoPlane<'a>
impl Send for VideoPlane<'_>
impl Sync for VideoPlane<'_>
Auto Trait Implementations§
impl<'a> Freeze for VideoPlane<'a>
impl<'a> RefUnwindSafe for VideoPlane<'a>
impl<'a> Unpin for VideoPlane<'a>
impl<'a> UnsafeUnpin for VideoPlane<'a>
impl<'a> UnwindSafe for VideoPlane<'a>
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