v4l2src: fix support for bayer format

- Define a new function that identify if the v4l2object is raw based
on pixel format
- Only consider setting delta flag on buffer if the video is not raw.

Sponsored by Living Optics Ltd.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4848>
This commit is contained in:
Daniel Morin 2023-04-20 17:31:32 -04:00 committed by GStreamer Marge Bot
parent 513d897d6e
commit 6ece5f3b90
3 changed files with 19 additions and 1 deletions

View file

@ -1381,7 +1381,7 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer,
break;
}
if (GST_VIDEO_INFO_FORMAT (&obj->info) == GST_VIDEO_FORMAT_ENCODED) {
if (!gst_v4l2_object_is_raw (obj)) {
if ((group->buffer.flags & V4L2_BUF_FLAG_KEYFRAME) ||
GST_V4L2_PIXELFORMAT (obj) == V4L2_PIX_FMT_MJPEG ||
GST_V4L2_PIXELFORMAT (obj) == V4L2_PIX_FMT_JPEG ||

View file

@ -1668,6 +1668,22 @@ done:
return template;
}
gboolean
gst_v4l2_object_is_raw (GstV4l2Object * v4l2object)
{
gint i;
if (GST_VIDEO_INFO_FORMAT (&v4l2object->info) != GST_VIDEO_FORMAT_ENCODED)
return TRUE;
for (i = 0; i < GST_V4L2_FORMAT_COUNT; i++) {
if (gst_v4l2_formats[i].format == GST_V4L2_PIXELFORMAT (v4l2object)) {
return !!(gst_v4l2_formats[i].flags & GST_V4L2_RAW);
}
}
return FALSE;
}
/* Add an 'alternate' variant of the caps with the feature */
static void
add_alternate_variant (GstV4l2Object * v4l2object, GstCaps * caps,

View file

@ -322,6 +322,8 @@ GstStructure * gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc);
GstFlowReturn gst_v4l2_object_poll (GstV4l2Object * v4l2object, GstClockTime timeout);
gboolean gst_v4l2_object_subscribe_event (GstV4l2Object * v4l2object, guint32 event);
gboolean gst_v4l2_object_is_raw (GstV4l2Object * obj);
/* crop / compose */
gboolean gst_v4l2_object_set_crop (GstV4l2Object * obj, struct v4l2_rect *result);
gboolean gst_v4l2_object_get_crop_bounds (GstV4l2Object * obj, struct v4l2_rect *bounds);