mfvideoenc: Disable RGB format support
authorSeungha Yang <seungha@centricular.com>
Thu, 15 Jul 2021 07:44:18 +0000 (16:44 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 15 Jul 2021 16:50:26 +0000 (16:50 +0000)
Some GPUs support BGRA format and it will be converted to subsampled
YUV format by GPU internally. Disable this implicit conversion
since the conversion parameters such as input/output colorimetry
are not exposed nor it's written in bitstream (e.g., VUI).
We prefer explicit conversion via our conversion elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2410>

sys/mediafoundation/gstmfvideoenc.cpp

index c3a7e7912ba0428af8657db661c8722a29f5130d..f03edfb43c04128e4d33e223c3c81820303713b4 100644 (file)
@@ -1528,12 +1528,20 @@ gst_mf_video_enc_enum_internal (GstMFTransform * transform, GUID & subtype,
 
   for (i = 0; i < info_size / sizeof (MFT_REGISTER_TYPE_INFO); i++) {
     GstVideoFormat format;
+    const GstVideoFormatInfo *format_info;
     GValue val = G_VALUE_INIT;
 
     format = gst_mf_video_subtype_to_video_format (&infos[i].guidSubtype);
     if (format == GST_VIDEO_FORMAT_UNKNOWN)
       continue;
 
+    format_info = gst_video_format_get_info (format);
+    if (GST_VIDEO_FORMAT_INFO_IS_RGB (format_info)) {
+      GST_DEBUG_OBJECT (transform, "Skip %s format",
+          GST_VIDEO_FORMAT_INFO_NAME (format_info));
+      continue;
+    }
+
     if (!supported_formats) {
       supported_formats = g_new0 (GValue, 1);
       g_value_init (supported_formats, GST_TYPE_LIST);