d3d11decoder: Copy HDR10 related caps field manually
authorSeungha Yang <seungha@centricular.com>
Sat, 16 Apr 2022 12:27:57 +0000 (21:27 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sat, 16 Apr 2022 18:36:41 +0000 (18:36 +0000)
If negotiate() is called from the set_format() chain, sinkpad may not
hold caps yet, so baseclass cannot copy it over to srcpad caps.
Copy them manually.

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

subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp

index c517b68..3e0aae1 100644 (file)
@@ -1452,6 +1452,8 @@ gst_d3d11_decoder_negotiate (GstD3D11Decoder * decoder,
   gboolean alternate_supported = FALSE;
   gboolean d3d11_supported = FALSE;
   GstVideoCodecState *input_state;
+  GstStructure *s;
+  const gchar *str;
 
   g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE);
   g_return_val_if_fail (GST_IS_VIDEO_DECODER (videodec), FALSE);
@@ -1543,6 +1545,19 @@ gst_d3d11_decoder_negotiate (GstD3D11Decoder * decoder,
 
   state->caps = gst_video_info_to_caps (&state->info);
 
+  s = gst_caps_get_structure (input_state->caps, 0);
+  str = gst_structure_get_string (s, "mastering-display-info");
+  if (str) {
+    gst_caps_set_simple (state->caps,
+        "mastering-display-info", G_TYPE_STRING, str, nullptr);
+  }
+
+  str = gst_structure_get_string (s, "content-light-level");
+  if (str) {
+    gst_caps_set_simple (state->caps,
+        "content-light-level", G_TYPE_STRING, str, nullptr);
+  }
+
   g_clear_pointer (&decoder->output_state, gst_video_codec_state_unref);
   decoder->output_state = state;