pub struct V4l2Device { /* private fields */ }Expand description
V4L2 device instance
Implementations§
Source§impl V4l2Device
impl V4l2Device
Sourcepub fn query_cap(&self) -> V4l2Capability
pub fn query_cap(&self) -> V4l2Capability
Handle VIDIOC_QUERYCAP
Sourcepub fn enum_fmt(&self, index: u32) -> Option<V4l2FmtDesc>
pub fn enum_fmt(&self, index: u32) -> Option<V4l2FmtDesc>
Handle VIDIOC_ENUM_FMT
Sourcepub fn get_format(&self) -> V4l2PixFormat
pub fn get_format(&self) -> V4l2PixFormat
Handle VIDIOC_G_FMT
Sourcepub fn set_format(
&mut self,
fmt: V4l2PixFormat,
) -> Result<V4l2PixFormat, KernelError>
pub fn set_format( &mut self, fmt: V4l2PixFormat, ) -> Result<V4l2PixFormat, KernelError>
Handle VIDIOC_S_FMT
Sourcepub fn request_buffers(&mut self, count: u32) -> Result<u32, KernelError>
pub fn request_buffers(&mut self, count: u32) -> Result<u32, KernelError>
Handle VIDIOC_REQBUFS
Sourcepub fn query_buffer(&self, index: u32) -> Option<V4l2Buffer>
pub fn query_buffer(&self, index: u32) -> Option<V4l2Buffer>
Handle VIDIOC_QUERYBUF
Sourcepub fn queue_buffer(&mut self, index: u32) -> Result<(), KernelError>
pub fn queue_buffer(&mut self, index: u32) -> Result<(), KernelError>
Handle VIDIOC_QBUF – queue a buffer for capture
Sourcepub fn dequeue_buffer(&mut self) -> Result<V4l2Buffer, KernelError>
pub fn dequeue_buffer(&mut self) -> Result<V4l2Buffer, KernelError>
Handle VIDIOC_DQBUF – dequeue a filled buffer
Sourcepub fn stream_on(&mut self) -> Result<(), KernelError>
pub fn stream_on(&mut self) -> Result<(), KernelError>
Handle VIDIOC_STREAMON
Sourcepub fn stream_off(&mut self) -> Result<(), KernelError>
pub fn stream_off(&mut self) -> Result<(), KernelError>
Handle VIDIOC_STREAMOFF
Sourcepub fn generate_test_frame(
&mut self,
output: &mut [u8],
) -> Result<usize, KernelError>
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.
Sourcepub fn is_streaming(&self) -> bool
pub fn is_streaming(&self) -> bool
Check if the device is currently streaming
Sourcepub fn frame_counter(&self) -> u32
pub fn frame_counter(&self) -> u32
Get the current frame counter
Sourcepub fn num_buffers(&self) -> u32
pub fn num_buffers(&self) -> u32
Get the number of allocated buffers