mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
v4l2: Add a macro to check for M2M
https://bugzilla.gnome.org/show_bug.cgi?id=794842
This commit is contained in:
parent
0649b0ab0f
commit
3735e57fb2
3 changed files with 20 additions and 14 deletions
|
@ -153,12 +153,7 @@ gst_v4l2_probe_and_register (GstPlugin * plugin)
|
||||||
else
|
else
|
||||||
device_caps = vcap.capabilities;
|
device_caps = vcap.capabilities;
|
||||||
|
|
||||||
if (!((device_caps & (V4L2_CAP_VIDEO_M2M | V4L2_CAP_VIDEO_M2M_MPLANE)) ||
|
if (!GST_V4L2_IS_M2M (device_caps))
|
||||||
/* But legacy driver may expose both CAPTURE and OUTPUT */
|
|
||||||
((device_caps &
|
|
||||||
(V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE)) &&
|
|
||||||
(device_caps &
|
|
||||||
(V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_MPLANE)))))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GST_DEBUG ("Probing '%s' located at '%s'",
|
GST_DEBUG ("Probing '%s' located at '%s'",
|
||||||
|
|
|
@ -41,6 +41,24 @@ G_BEGIN_DECLS
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GST_V4L2_IS_M2M:
|
||||||
|
* @_dcaps: The device capabilities
|
||||||
|
*
|
||||||
|
* Checks if the device caps represent an M2M device. Note that modern M2M
|
||||||
|
* devices uses V4L2_CAP_VIDEO_M2M* flag, but legacy uses to set both CAPTURE
|
||||||
|
* and OUTPUT flags instead.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if this is a M2M device.
|
||||||
|
*/
|
||||||
|
#define GST_V4L2_IS_M2M(_dcaps) \
|
||||||
|
(((_dcaps) & (V4L2_CAP_VIDEO_M2M | V4L2_CAP_VIDEO_M2M_MPLANE)) ||\
|
||||||
|
(((_dcaps) & \
|
||||||
|
(V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE)) && \
|
||||||
|
((_dcaps) & \
|
||||||
|
(V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_MPLANE))))
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GstV4l2Iterator GstV4l2Iterator;
|
typedef struct _GstV4l2Iterator GstV4l2Iterator;
|
||||||
typedef struct _GstV4l2Error GstV4l2Error;
|
typedef struct _GstV4l2Error GstV4l2Error;
|
||||||
|
|
||||||
|
|
|
@ -575,14 +575,7 @@ gst_v4l2_open (GstV4l2Object * v4l2object)
|
||||||
goto not_output;
|
goto not_output;
|
||||||
|
|
||||||
if (GST_IS_V4L2_VIDEO_DEC (v4l2object->element) &&
|
if (GST_IS_V4L2_VIDEO_DEC (v4l2object->element) &&
|
||||||
/* Today's M2M device only expose M2M */
|
!GST_V4L2_IS_M2M (v4l2object->device_caps))
|
||||||
!((v4l2object->device_caps & (V4L2_CAP_VIDEO_M2M |
|
|
||||||
V4L2_CAP_VIDEO_M2M_MPLANE)) ||
|
|
||||||
/* But legacy driver may expose both CAPTURE and OUTPUT */
|
|
||||||
((v4l2object->device_caps &
|
|
||||||
(V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE)) &&
|
|
||||||
(v4l2object->device_caps &
|
|
||||||
(V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_MPLANE)))))
|
|
||||||
goto not_m2m;
|
goto not_m2m;
|
||||||
|
|
||||||
gst_v4l2_adjust_buf_type (v4l2object);
|
gst_v4l2_adjust_buf_type (v4l2object);
|
||||||
|
|
Loading…
Reference in a new issue