[−][src]Struct v4l::buffers::userptr::UserBuffer
Buffer allocated in userspace (by the application)
Devices supporting user pointer mode will directly transfer image memory to the buffer "for free" by using direct memory access (DMA).
Implementations
impl<'a> UserBuffer<'a>
[src]
pub fn new(view: &'a [u8], meta: Metadata) -> Self
[src]
Returns a user buffer representation
Buffers created this way provide read-only access to the backing data, just like mapped ones. This is necessary because the MappedBufferManager allocated a number of buffers once and then keeps them allocated for the lifetime of the stream. Otherwise, we would have to allocate a new buffer for every frame, which is costly.
If you need to alter the data in this buffer, copy it out of the slice into your own container type and process it.
Arguments
view
- Slice of raw memorymeta
- Metadata, usually filled in by the driver
Example
use v4l::{buffer, Timestamp, UserBuffer}; let data: Vec<u8> = Vec::new(); let ts = Timestamp::new(0 /* sec */, 0 /* usec */); let flags = buffer::Flags::from(0); let meta = buffer::Metadata::new(0, ts, flags); let buf = UserBuffer::new(&data, meta);
Trait Implementations
impl<'a> Buffer for UserBuffer<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for UserBuffer<'a>
impl<'a> Send for UserBuffer<'a>
impl<'a> Sync for UserBuffer<'a>
impl<'a> Unpin for UserBuffer<'a>
impl<'a> UnwindSafe for UserBuffer<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,