v4l2: fix multiplanar capture

After switching to using V4L2_CAP_DEVICE_CAPS we lost support for
multiplanar device types. After some research, it looks like
vcap.capabilities treated the multiplanar flag of output and capture
devices equally, but not the new device_caps.

https://bugzilla.gnome.org/show_bug.cgi?id=768195
This commit is contained in:
Luis de Bethencourt 2016-07-08 17:28:19 +00:00
parent 6fe88d8a76
commit eaa01071e0

View file

@ -489,16 +489,17 @@ gst_v4l2_adjust_buf_type (GstV4l2Object * v4l2object)
* in a contiguous manner. In this case the first v4l2 plane * in a contiguous manner. In this case the first v4l2 plane
* contains all the gst planes. * contains all the gst planes.
*/ */
#define CHECK_CAPS (V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE)
switch (v4l2object->type) { switch (v4l2object->type) {
case V4L2_BUF_TYPE_VIDEO_OUTPUT: case V4L2_BUF_TYPE_VIDEO_OUTPUT:
if (v4l2object->device_caps & CHECK_CAPS) { if (v4l2object->device_caps &
(V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE)) {
GST_DEBUG ("adjust type to multi-planar output"); GST_DEBUG ("adjust type to multi-planar output");
v4l2object->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; v4l2object->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
} }
break; break;
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (v4l2object->device_caps & CHECK_CAPS) { if (v4l2object->device_caps &
(V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE)) {
GST_DEBUG ("adjust type to multi-planar capture"); GST_DEBUG ("adjust type to multi-planar capture");
v4l2object->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; v4l2object->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
} }
@ -506,7 +507,6 @@ gst_v4l2_adjust_buf_type (GstV4l2Object * v4l2object)
default: default:
break; break;
} }
#undef CHECK_CAPS
} }
/****************************************************** /******************************************************