What is the best way to call set/get V4L2 controls from GStreamer capture ?

asked 2018-07-03 03:33:36 -0600

Major Squirrel gravatar image

Good evening,

I have implemented a driver (kernel module) for a MIPI camera sensor which outputs BGGR 10-bit data (bayer). The capture interface I am using to make it work with OpenCV is GStreamer (cv::CAP_GSTREAMER). My driver interacts with the camera sensor through V4L2 implementation, more specifically I have implemented callback for VIDIOC_S_CTRL and VIDIOC_G_CTRL ioctl operations. This way, I can configure the sensor registers easily.

Unfortunately, the GStreamer interface for a cv::VideoCapture doesn't handle many V4L2 controls and I would need to implement V4L2_CID_HFLIP and V4L2_CID_VFLIP (horizontal and vertical flips).

The problem I am facing is that I can't find a way to call V4L2 callbacks from the GStreamer capture interface. For instance, it seems that I don't have any access to the file descriptor from the GStreamer capture interface in order to call some ioctl() functions.

What would be the best way to call set/get V4L2 controls from the GStreamer capture interface ?

Regards,

edit retag flag offensive close merge delete

Comments

I have tried to get the device file descriptor from GStreamer using g_object_get(G_OBJECT(v4l2src), "device-fd", &device_fd, NULL) and using it with ioctl call, but the latter function returns "Bad file descriptor"

Major Squirrel gravatar imageMajor Squirrel ( 2018-07-03 08:11:47 -0600 )edit