v4l2codecs: Unify the src template caps format
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 14 Jul 2020 15:11:11 +0000 (11:11 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 21 Jan 2022 19:32:30 +0000 (19:32 +0000)
Notably NV12_4L4 ended up being applied to only VP9 decoder. This fixes the
situation by using a central define for all static src pad templated formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/965>

subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c
subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecmpeg2dec.c
subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp8dec.c
subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp9dec.c
subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.h

index 00adb23..ce61d04 100644 (file)
@@ -24,6 +24,7 @@
 #include "gstv4l2codecallocator.h"
 #include "gstv4l2codech264dec.h"
 #include "gstv4l2codecpool.h"
+#include "gstv4l2format.h"
 #include "linux/v4l2-controls.h"
 
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
@@ -52,7 +53,7 @@ GST_STATIC_PAD_TEMPLATE (GST_VIDEO_DECODER_SINK_NAME,
 static GstStaticPadTemplate src_template =
 GST_STATIC_PAD_TEMPLATE (GST_VIDEO_DECODER_SRC_NAME,
     GST_PAD_SRC, GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ NV12, YUY2, NV12_32L32 }")));
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_V4L2_DEFAULT_VIDEO_FORMATS)));
 
 struct _GstV4l2CodecH264Dec
 {
index e3bc78a..38c8fd4 100644 (file)
@@ -25,6 +25,7 @@
 #include "gstv4l2codecallocator.h"
 #include "gstv4l2codecmpeg2dec.h"
 #include "gstv4l2codecpool.h"
+#include "gstv4l2format.h"
 #include "linux/v4l2-controls.h"
 
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
@@ -55,7 +56,7 @@ GST_STATIC_PAD_TEMPLATE (GST_VIDEO_DECODER_SINK_NAME,
 static GstStaticPadTemplate src_template =
 GST_STATIC_PAD_TEMPLATE (GST_VIDEO_DECODER_SRC_NAME,
     GST_PAD_SRC, GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ NV12, YUY2, NV12_32L32 }")));
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_V4L2_DEFAULT_VIDEO_FORMATS)));
 
 struct _GstV4l2CodecMpeg2Dec
 {
index 8a0634a..a319741 100644 (file)
@@ -25,6 +25,7 @@
 #include "gstv4l2codecalphadecodebin.h"
 #include "gstv4l2codecpool.h"
 #include "gstv4l2codecvp8dec.h"
+#include "gstv4l2format.h"
 
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
 
@@ -56,7 +57,7 @@ GST_STATIC_PAD_TEMPLATE (GST_VIDEO_DECODER_SINK_NAME,
 static GstStaticPadTemplate src_template =
 GST_STATIC_PAD_TEMPLATE (GST_VIDEO_DECODER_SRC_NAME,
     GST_PAD_SRC, GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ NV12, YUY2, NV12_32L32 }")));
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_V4L2_DEFAULT_VIDEO_FORMATS)));
 
 struct _GstV4l2CodecVp8Dec
 {
index 8017ab0..fd635e8 100644 (file)
@@ -26,6 +26,7 @@
 #include "gstv4l2codecalphadecodebin.h"
 #include "gstv4l2codecpool.h"
 #include "gstv4l2codecvp9dec.h"
+#include "gstv4l2format.h"
 #include "linux/v4l2-controls.h"
 #include "linux/videodev2.h"
 
@@ -57,8 +58,7 @@ GST_STATIC_PAD_TEMPLATE (GST_VIDEO_DECODER_SINK_NAME,
 static GstStaticPadTemplate src_template =
 GST_STATIC_PAD_TEMPLATE (GST_VIDEO_DECODER_SRC_NAME,
     GST_PAD_SRC, GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE
-        ("{ NV12, YUY2, NV12_32L32, NV12_4L4 }")));
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_V4L2_DEFAULT_VIDEO_FORMATS)));
 
 struct _GstV4l2CodecVp9Dec
 {
index bcb0918..ef693b6 100644 (file)
@@ -24,6 +24,8 @@
 #include <gst/video/video.h>
 #include "linux/videodev2.h"
 
+#define GST_V4L2_DEFAULT_VIDEO_FORMATS "{ NV12, YUY2, NV12_4L4, NV12_32L32 }"
+
 gboolean   gst_v4l2_format_to_video_info (struct v4l2_format * fmt,
                                           GstVideoInfo * out_info);