⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

V4l2Device

Struct V4l2Device 

Source
pub struct V4l2Device { /* private fields */ }
Expand description

V4L2 device instance

Implementations§

Source§

impl V4l2Device

Source

pub const fn new() -> Self

Create a new V4L2 device

Source

pub fn init(&mut self)

Initialize the device

Source

pub fn query_cap(&self) -> V4l2Capability

Handle VIDIOC_QUERYCAP

Source

pub fn enum_fmt(&self, index: u32) -> Option<V4l2FmtDesc>

Handle VIDIOC_ENUM_FMT

Source

pub fn get_format(&self) -> V4l2PixFormat

Handle VIDIOC_G_FMT

Source

pub fn set_format( &mut self, fmt: V4l2PixFormat, ) -> Result<V4l2PixFormat, KernelError>

Handle VIDIOC_S_FMT

Source

pub fn request_buffers(&mut self, count: u32) -> Result<u32, KernelError>

Handle VIDIOC_REQBUFS

Source

pub fn query_buffer(&self, index: u32) -> Option<V4l2Buffer>

Handle VIDIOC_QUERYBUF

Source

pub fn queue_buffer(&mut self, index: u32) -> Result<(), KernelError>

Handle VIDIOC_QBUF – queue a buffer for capture

Source

pub fn dequeue_buffer(&mut self) -> Result<V4l2Buffer, KernelError>

Handle VIDIOC_DQBUF – dequeue a filled buffer

Source

pub fn stream_on(&mut self) -> Result<(), KernelError>

Handle VIDIOC_STREAMON

Source

pub fn stream_off(&mut self) -> Result<(), KernelError>

Handle VIDIOC_STREAMOFF

Source

pub fn generate_test_frame( &mut self, output: &mut [u8], ) -> Result<usize, KernelError>

Generate a test frame into a queued buffer

Produces SMPTE-style color bars in YUYV 4:2:2 format. Called by the capture loop to fill queued buffers.

Source

pub fn is_streaming(&self) -> bool

Check if the device is currently streaming

Source

pub fn frame_counter(&self) -> u32

Get the current frame counter

Source

pub fn num_buffers(&self) -> u32

Get the number of allocated buffers

Trait Implementations§

Source§

impl Default for V4l2Device

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for V4l2Device

§

impl RefUnwindSafe for V4l2Device

§

impl Send for V4l2Device

§

impl Sync for V4l2Device

§

impl Unpin for V4l2Device

§

impl UnwindSafe for V4l2Device

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

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

Performs the conversion.