v4l2 autodetect

Nicolas Dufresne nicolas.dufresne at collabora.com
Tue Jul 14 06:32:24 PDT 2015


Le mardi 14 juillet 2015 à 03:53 -0700, Leo.Fernando a écrit :
> the card's user manual has the sudocode to detect width and height 
> and
> framerate. i wanted to uses this values and set the caps
> 
> s_ctl_struct.id = V4L2_CID_X_RES_DETECTED; 
> ioctl(fd, VIDIOC_G_CTRL, &s_ctl_struct); 
> printf("(vidWidth = %d)\n", s_ctl_struct.value); 
> 
> s_ctl_struct.id = V4L2_CID_Y_RES_DETECTED; 
> ioctl(fd, VIDIOC_G_CTRL, &s_ctl_struct); 
> printf("(vidHeight = %d)\n", s_ctl_struct.value); 
> 
> s_ctl_struct.id = V4L2_CID_FPS_DETECTED; 
> ioctl(fd, VIDIOC_G_CTRL, &s_ctl_struct); 
> printf("(vidFPS = %d)\n", s_ctl_struct.value);

This is completely custom (also wrong, since there is mechanism for all
this in the V4L2 API). That means this kind of code will never make it
to v4l2src upstream. But you don't have to modify the v4l2src if all
you want is read the value and set the caps to that. You can set the
v4l2src to ready state, then get the file descriptor through "device
-fd" property. You can then run your own ioctl.

Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150714/a733a6a3/attachment.sig>


More information about the gstreamer-devel mailing list