Crate v4l2r

Source
Expand description

This library provides two levels of abstraction over V4L2:

  • The ioctl module provides direct, thin wrappers over the V4L2 ioctls with added safety. Note that “safety” here is in terms of memory safety: this layer won’t guard against passing invalid data that the ioctls will reject - it just makes sure that data passed from and to the kernel can be accessed safely. Since this is a 1:1 mapping over the V4L2 ioctls, working at this level is a bit laborious, although more comfortable than doing the same in C.

  • The device module (still WIP) provides a higher-level abstraction over the V4L2 entities, like device and queue. Strong typing will ensure that most inconsistencies while using the V4L2 API can be caught at compile-time.

These two layers should provide the foundations for higher-level libraries to provide safe, specialized APIs that support various V4L2 usage scenarios (camera, decoder/encoder, etc).

Re-exports§

pub use nix;

Modules§

controls
Safe definitions around V4L2 extended controls.
decoder
High-level interface for a V4L2 video decoder. Currently only supports the stateful interface.
device
Interface to the V4L2 primitives that is both safe and higher-level than ioctl, while staying low-level enough to allow the implementation of any kind of V4L2 program on top of it.
encoder
High-level interface for a V4L2 video encoder.
ioctl
This module provides safer versions of the V4L2 ioctls through simple functions working on a RawFd, and safer variants of the main V4L2 structures. This module can be used directly, but the device module is very likely to be a better fit for application code.
memory
Abstracts the different kinds of backing memory (MMAP, USERPTR, DMABUF) supported by V4L2.

Structs§

Format
Unified representation of a V4L2 format capable of handling both single and multi-planar formats. When the single-planar API is used, only one plane shall be used - attempts to have more will be rejected by the ioctl wrappers.
PixelFormat
A Fourcc pixel format, used to pass formats to V4L2. It can be converted back and forth from a 32-bit integer, or a 4-bytes string.
PlaneLayout
Description of a single plane in a format.
Rect
A more elegant representation for v4l2_rect.

Enums§

Colorspace
Equivalent of enum v4l2_colorspace.
FormatConversionError
Quantization
Equivalent of enum v4l2_quantization.
QueueClass
Possible classes for this queue.
QueueDirection
Possible directions for the queue
QueueType
Types of queues currently supported by this library.
XferFunc
Equivalent of enum v4l2_xfer_func.
YCbCrEncoding
Equivalent of enum v4l2_ycbcr_encoding.