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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/635>
This commit is contained in:
Tim-Philipp Müller 2020-06-19 10:32:45 +01:00
parent 5c68e06b00
commit 8c8b788f73
2 changed files with 19 additions and 4 deletions

View file

@ -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"
}

View file

@ -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",