Struct nokhwa::backends::capture::V4LCaptureDevice[][src]

pub struct V4LCaptureDevice<'a> { /* fields omitted */ }
Expand description

The backend struct that interfaces with V4L2. To see what this does, please see CaptureBackendTrait

Quirks

Implementations

impl<'a> V4LCaptureDevice<'a>[src]

pub fn new(
    index: usize,
    cam_fmt: Option<CameraFormat>
) -> Result<Self, NokhwaError>
[src]

Creates a new capture device using the V4L2 backend. Indexes are gives to devices by the OS, and usually numbered by order of discovery.

If camera_format is None, it will be spawned with with 640x480@15 FPS, MJPEG CameraFormat default.

Errors

This function will error if the camera is currently busy or if V4L2 can’t read device information.

pub fn new_with(
    index: usize,
    width: u32,
    height: u32,
    fps: u32,
    fourcc: FrameFormat
) -> Result<Self, NokhwaError>
[src]

Create a new V4L Camera with desired settings.

Errors

This function will error if the camera is currently busy or if V4L2 can’t read device information.

pub fn inner_device(&self) -> &Device[src]

Get the inner device (immutable) for e.g. Controls

pub fn inner_device_mut(&mut self) -> &mut Device[src]

Get the inner device (mutable) for e.g. Controls

Trait Implementations

impl<'a> CaptureBackendTrait for V4LCaptureDevice<'a>[src]

fn get_info(&self) -> CameraInfo[src]

Gets the camera information such as Name and Index as a CameraInfo.

fn get_camera_format(&self) -> CameraFormat[src]

Gets the current CameraFormat.

fn set_camera_format(
    &mut self,
    new_fmt: CameraFormat
) -> Result<(), NokhwaError>
[src]

Will set the current CameraFormat This will reset the current stream if used while stream is opened. Read more

fn get_compatible_list_by_resolution(
    &self,
    fourcc: FrameFormat
) -> Result<HashMap<Resolution, Vec<u32>>, NokhwaError>
[src]

A hashmap of Resolutions mapped to framerates Read more

fn get_compatible_fourcc(&mut self) -> Result<Vec<FrameFormat>, NokhwaError>[src]

A Vector of compatible FrameFormats. Read more

fn get_resolution(&self) -> Resolution[src]

Gets the current camera resolution (See: Resolution, CameraFormat).

fn set_resolution(&mut self, new_res: Resolution) -> Result<(), NokhwaError>[src]

Will set the current Resolution This will reset the current stream if used while stream is opened. Read more

fn get_framerate(&self) -> u32[src]

Gets the current camera framerate (See: CameraFormat).

fn set_framerate(&mut self, new_fps: u32) -> Result<(), NokhwaError>[src]

Will set the current framerate This will reset the current stream if used while stream is opened. Read more

fn get_frameformat(&self) -> FrameFormat[src]

Gets the current camera’s frame format (See: FrameFormat, CameraFormat).

fn set_frameformat(&mut self, fourcc: FrameFormat) -> Result<(), NokhwaError>[src]

Will set the current FrameFormat This will reset the current stream if used while stream is opened. Read more

fn open_stream(&mut self) -> Result<(), NokhwaError>[src]

Will open the camera stream with set parameters. This will be called internally if you try and call get_frame() before you call open_stream(). Read more

fn is_stream_open(&self) -> bool[src]

Checks if stream if open. If it is, it will return true.

fn get_frame(&mut self) -> Result<ImageBuffer<Rgb<u8>, Vec<u8>>, NokhwaError>[src]

Will get a frame from the camera as a Raw RGB image buffer. Depending on the backend, if you have not called open_stream() before you called this, it will either return an error. Read more

fn get_frame_raw(&mut self) -> Result<Vec<u8>, NokhwaError>[src]

Will get a frame from the camera without any processing applied, meaning you will usually get a frame you need to decode yourself. Read more

fn stop_stream(&mut self) -> Result<(), NokhwaError>[src]

Will drop the stream. Read more

Auto Trait Implementations

impl<'a> RefUnwindSafe for V4LCaptureDevice<'a>

impl<'a> Send for V4LCaptureDevice<'a>

impl<'a> Sync for V4LCaptureDevice<'a>

impl<'a> Unpin for V4LCaptureDevice<'a>

impl<'a> !UnwindSafe for V4LCaptureDevice<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.