CM V4L2 SOURCE
The cmV4l2Source is used to get data from the sensor by the V4L2 Interface. It supports the input data format setting and multiple connections for output. The V4L2 device only supports one connection at a time, but cmV4l2Source can output data to multi-pipelines.
API Instructions
create/destroy
/*
* @device V4l2 device, default "/dev/video0"
* @return Handle
*/
gpointer cm_video_v4l2_source_create(gchar* device);
void cm_video_v4l2_source_destroy(gpointer hd);
start/stop
void cm_video_v4l2_source_start(gpointer hd);
void cm_video_v4l2_source_stop(gpointer hd);
parameters
If the sensor supports different choices such as YUV, Bayer, 4K, FHD, and so on, set the caps string to get the right video format.
/* @caps_str0 Input data format, "video/...,colorimetry=(string)1:4:7:1,..." */
void cm_video_v4l2_source_set_caps_str0(gpointer hd, const gchar* caps_str0);
/* @return Actual data format from device, "video/...,width=..." */
const char* cm_video_v4l2_source_get_caps_str(gpointer had);
/* The media info(out caps string) is ready, the source whether ready to be linked*/
gboolean cm_video_v4l2_source_is_ready(gpointer hd);
data
others
Demo and Test
YUV demo
Structure
Get data from the sensor and output them to the data callback.
Main codes
For more details please refer to the demo file.
Test result
The YUV data can be saved to the file and played on the PC by YUV tools.