From d415816cb1cf817bbbd633788ba6b349b6469684 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Mon, 25 Dec 2023 18:36:44 +0100
Subject: [PATCH] rtpvrawdepay: only announce supported formats in sink
 template

For most video formats we currently just assume that they
have a depth of 8 bits, whilst advertising that we can
handle 8/10/12/16 bit depth.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5866>
---
 .../gst-plugins-good/docs/gst_plugins_cache.json    |  2 +-
 .../gst-plugins-good/gst/rtp/gstrtpvrawdepay.c      | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
index 51fc9efc77..4aa6cb8133 100644
--- a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
+++ b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
@@ -17227,7 +17227,7 @@
                 "long-name": "RTP Raw Video depayloader",
                 "pad-templates": {
                     "sink": {
-                        "caps": "application/x-rtp:\n          media: video\n     clock-rate: 90000\n  encoding-name: RAW\n       sampling: { (string)RGB, (string)RGBA, (string)BGR, (string)BGRA, (string)YCbCr-4:4:4, (string)YCbCr-4:2:2, (string)YCbCr-4:2:0, (string)YCbCr-4:1:1 }\n          depth: { (string)8, (string)10, (string)12, (string)16 }\n",
+                        "caps": "application/x-rtp:\n          media: video\n     clock-rate: 90000\n  encoding-name: RAW\n       sampling: { (string)RGB, (string)RGBA, (string)BGR, (string)BGRA, (string)YCbCr-4:4:4, (string)YCbCr-4:2:2, (string)YCbCr-4:2:0, (string)YCbCr-4:1:1 }\n          depth: 8\napplication/x-rtp:\n          media: video\n     clock-rate: 90000\n  encoding-name: RAW\n       sampling: YCbCr-4:2:2\n          depth: 10\n",
                         "direction": "sink",
                         "presence": "always"
                     },
diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtpvrawdepay.c b/subprojects/gst-plugins-good/gst/rtp/gstrtpvrawdepay.c
index d3bb5af05e..74e8494a99 100644
--- a/subprojects/gst-plugins-good/gst/rtp/gstrtpvrawdepay.c
+++ b/subprojects/gst-plugins-good/gst/rtp/gstrtpvrawdepay.c
@@ -41,7 +41,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
     );
 
 static GstStaticPadTemplate gst_rtp_vraw_depay_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS ("application/x-rtp, "
@@ -55,7 +55,16 @@ GST_STATIC_PAD_TEMPLATE ("sink",
          * "width = (string) [1 32767],"
          * "height = (string) [1 32767],"
          */
-        "depth = (string) { \"8\", \"10\", \"12\", \"16\" }")
+        "depth = (string) 8; "
+        "application/x-rtp, "
+        "media = (string) video, "
+        "clock-rate = (int) 90000, "
+        "encoding-name = (string) RAW, sampling = (string) YCbCr-4:2:2,"
+        /* we cannot express these as strings
+         * "width = (string) [1 32767],"
+         * "height = (string) [1 32767],"
+         */
+        "depth = (string) 10")
     );
 
 #define gst_rtp_vraw_depay_parent_class parent_class