From 8c8b788f73b4953e8a91b7bedd6597f5a92b16b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 19 Jun 2020 10:32:45 +0100 Subject: [PATCH] shout2: advertise documentation caps properly shout2send caps depend on what the libshout2 version in question supports, but the documentation caps should always be the same. Part-of: --- docs/gst_plugins_cache.json | 2 +- ext/shout2/gstshout2.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/gst_plugins_cache.json b/docs/gst_plugins_cache.json index a630651749..792664ccbf 100644 --- a/docs/gst_plugins_cache.json +++ b/docs/gst_plugins_cache.json @@ -36186,7 +36186,7 @@ "long-name": "Icecast network sink", "pad-templates": { "sink": { - "caps": "application/ogg:\naudio/ogg:\nvideo/ogg:\naudio/mpeg:\n mpegversion: 1\n layer: [ 1, 3 ]\n", + "caps": "application/ogg:\naudio/ogg:\nvideo/ogg:\naudio/mpeg:\n mpegversion: 1\n layer: [ 1, 3 ]\nvideo/webm:\naudio/webm:\n", "direction": "sink", "presence": "always" } diff --git a/ext/shout2/gstshout2.c b/ext/shout2/gstshout2.c index 6acf2e8508..b301bc8b35 100644 --- a/ext/shout2/gstshout2.c +++ b/ext/shout2/gstshout2.c @@ -94,11 +94,18 @@ enum #else #define WEBM_CAPS "" #endif + +#define SHOUT2SEND_BASIC_CAPS "application/ogg; audio/ogg; video/ogg; "\ + "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]" + +#define SHOUT2SEND_DOC_CAPS SHOUT2SEND_BASIC_CAPS "; video/webm; audio/webm" + +#define SHOUT2SEND_CAPS SHOUT2SEND_BASIC_CAPS WEBM_CAPS + static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("application/ogg; audio/ogg; video/ogg; " - "audio/mpeg, mpegversion = (int) 1, layer = (int) [ 1, 3 ]" WEBM_CAPS)); + GST_STATIC_CAPS (SHOUT2SEND_CAPS)); static void gst_shout2send_finalize (GstShout2send * shout2send); @@ -151,6 +158,8 @@ gst_shout2send_class_init (GstShout2sendClass * klass) GObjectClass *gobject_class; GstElementClass *gstelement_class; GstBaseSinkClass *gstbasesink_class; + GstPadTemplate *tmpl; + GstCaps *doc_caps; gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; @@ -231,7 +240,13 @@ gst_shout2send_class_init (GstShout2sendClass * klass) gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_shout2send_event); gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_shout2send_setcaps); - gst_element_class_add_static_pad_template (gstelement_class, &sink_template); + tmpl = gst_static_pad_template_get (&sink_template); + gst_element_class_add_pad_template (gstelement_class, tmpl); + + /* our caps depend on the libshout2 version */ + doc_caps = gst_caps_from_string (SHOUT2SEND_DOC_CAPS); + gst_pad_template_set_documentation_caps (tmpl, doc_caps); + gst_clear_caps (&doc_caps); gst_element_class_set_static_metadata (gstelement_class, "Icecast network sink",