From: Daniel Morin Date: Thu, 20 Apr 2023 21:31:32 +0000 (-0400) Subject: v4l2src: fix support for bayer format X-Git-Tag: 1.22.7~211 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97ca841601a96574f6beab59a0f400640166abfc;p=platform%2Fupstream%2Fgstreamer.git 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: --- diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c index f6c1ba6..3e1098d 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c @@ -1378,7 +1378,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 || diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c index 1c08b45..6d8a725 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c @@ -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, diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h index f749e62..407b9a2 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h @@ -320,6 +320,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);