[][src]Struct v4l::buffers::userptr::UserBuffer

pub struct UserBuffer<'a> { /* fields omitted */ }

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 memory
  • meta - 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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.