mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
v4l2provider: Fix device type detection
The type detection would lead to assertion as it would try to create a device without having found any type for it. It also didn't detect MPLANE devices properly.
This commit is contained in:
parent
f0678d73b1
commit
ab075b2013
1 changed files with 19 additions and 11 deletions
|
@ -136,22 +136,30 @@ gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider,
|
|||
gst_structure_set (props, "v4l2.device.device_caps", G_TYPE_UINT,
|
||||
v4l2obj->vcap.device_caps, NULL);
|
||||
|
||||
if (v4l2obj->device_caps & V4L2_CAP_VIDEO_CAPTURE)
|
||||
if (v4l2obj->device_caps &
|
||||
(V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE))
|
||||
type = GST_V4L2_DEVICE_TYPE_SOURCE;
|
||||
|
||||
if (v4l2obj->device_caps & V4L2_CAP_VIDEO_OUTPUT) {
|
||||
/* Morph it in case our initial guess was wrong */
|
||||
v4l2obj->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
|
||||
if (type == GST_V4L2_DEVICE_TYPE_INVALID)
|
||||
type = GST_V4L2_DEVICE_TYPE_SINK;
|
||||
else
|
||||
/* We ignore M2M devices that are both capture and output for now
|
||||
* The provider is not for them
|
||||
*/
|
||||
if (v4l2obj->device_caps &
|
||||
(V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_MPLANE)) {
|
||||
/* We ignore M2M devices that are both capture and output for now
|
||||
* The provider is not for them */
|
||||
if (type != GST_V4L2_DEVICE_TYPE_INVALID)
|
||||
goto close;
|
||||
|
||||
type = GST_V4L2_DEVICE_TYPE_SINK;
|
||||
|
||||
/* We have opened as a capture as we didn't know, now that know,
|
||||
* let's fixed it */
|
||||
if (v4l2obj->device_caps & V4L2_CAP_VIDEO_OUTPUT_MPLANE)
|
||||
v4l2obj->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
||||
else
|
||||
v4l2obj->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
}
|
||||
|
||||
if (type == GST_V4L2_DEVICE_TYPE_INVALID)
|
||||
goto close;
|
||||
|
||||
caps = gst_v4l2_object_get_caps (v4l2obj, NULL);
|
||||
|
||||
if (caps == NULL)
|
||||
|
|
Loading…
Reference in a new issue