omxvideo: use GST_VIDEO_CAPS_MAKE() for template caps
authorGuillaume Desmottes <guillaume.desmottes@collabora.com>
Fri, 4 Jan 2019 09:11:38 +0000 (10:11 +0100)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Fri, 25 Jan 2019 23:48:11 +0000 (23:48 +0000)
Simplify the code and so we advertise the formats actually supported by
gst-omx.

omx/gstomxvideo.c
omx/gstomxvideo.h
omx/gstomxvideodec.c
omx/gstomxvideoenc.c

index 44d919a..9feda19 100644 (file)
@@ -33,6 +33,7 @@
 GST_DEBUG_CATEGORY (gst_omx_video_debug_category);
 #define GST_CAT_DEFAULT gst_omx_video_debug_category
 
+/* Keep synced with GST_OMX_VIDEO_SUPPORTED_FORMATS */
 GstVideoFormat
 gst_omx_video_get_format_from_omx (OMX_COLOR_FORMATTYPE omx_colorformat)
 {
index 993f3d6..9251547 100644 (file)
 
 G_BEGIN_DECLS
 
+/* Keep synced with gst_omx_video_get_format_from_omx(). Sort by decreasing quality */
+#define GST_OMX_VIDEO_SUPPORTED_FORMATS "{ NV16_10LE32, NV12_10LE32, " \
+  "NV16, YUY2, YVYU, UYVY, NV12, I420, RGB16, BGR16, ABGR, ARGB, BGR, GRAY8 }"
+
 typedef struct
 {
   GstVideoFormat format;
index 9ef8576..1072b82 100644 (file)
@@ -189,9 +189,7 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
       GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
       "RGBA") "; "
 #endif
-      "video/x-raw, "
-      "width = " GST_VIDEO_SIZE_RANGE ", "
-      "height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
+      GST_VIDEO_CAPS_MAKE (GST_OMX_VIDEO_SUPPORTED_FORMATS);
 }
 
 static void
index 86da12c..f27c408 100644 (file)
@@ -490,9 +490,8 @@ gst_omx_video_enc_class_init (GstOMXVideoEncClass * klass)
       GST_DEBUG_FUNCPTR (gst_omx_video_enc_decide_allocation);
 
   klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
-  klass->cdata.default_sink_template_caps = "video/x-raw, "
-      "width = " GST_VIDEO_SIZE_RANGE ", "
-      "height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
+  klass->cdata.default_sink_template_caps =
+      GST_VIDEO_CAPS_MAKE (GST_OMX_VIDEO_SUPPORTED_FORMATS);
 
   klass->handle_output_frame =
       GST_DEBUG_FUNCPTR (gst_omx_video_enc_handle_output_frame);