diff options
author | Peter Körner <git@mazdermind.de> | 2018-10-03 16:17:22 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2018-11-07 23:20:20 +0200 |
commit | e76941be58f42adcbb1c9f8f12d543a1c2900a70 (patch) | |
tree | e605d1f99553c106469235912aa77080f631e485 /gst/multifile | |
parent | a7c6f0ce5edca9a0fefcca2a3430fcfd5a028ecc (diff) | |
download | gstreamer-plugins-good-e76941be58f42adcbb1c9f8f12d543a1c2900a70.tar.gz |
splitmuxsink: accept pads named 'sink' on the muxer, handle static pads as well
https://bugzilla.gnome.org/show_bug.cgi?id=797241
Diffstat (limited to 'gst/multifile')
-rw-r--r-- | gst/multifile/gstsplitmuxsink.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index 9cc8bad00..fb7d55dcb 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -1938,12 +1938,16 @@ gst_splitmux_sink_request_new_pad (GstElement * element, goto already_have_video; /* FIXME: Look for a pad template with matching caps, rather than by name */ + GST_DEBUG_OBJECT (element, + "searching for pad-template with name 'video_%%u'"); mux_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (splitmux->muxer), "video_%u"); /* Fallback to find sink pad templates named 'video' (flvmux) */ if (!mux_template) { + GST_DEBUG_OBJECT (element, + "searching for pad-template with name 'video'"); mux_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (splitmux->muxer), "video"); @@ -1951,30 +1955,69 @@ gst_splitmux_sink_request_new_pad (GstElement * element, is_video = TRUE; name = NULL; } else { + GST_DEBUG_OBJECT (element, "searching for pad-template with name '%s'", + templ->name_template); mux_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (splitmux->muxer), templ->name_template); /* Fallback to find sink pad templates named 'audio' (flvmux) */ if (!mux_template) { + GST_DEBUG_OBJECT (element, + "searching for pad-template with name 'audio'"); mux_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (splitmux->muxer), "audio"); name = NULL; } } + if (mux_template == NULL) { - /* Fallback to find sink pad templates named 'sink_%d' (mpegtsmux) */ + GST_DEBUG_OBJECT (element, + "searching for pad-template with name 'sink_%%d'"); mux_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (splitmux->muxer), "sink_%d"); name = NULL; } + if (mux_template == NULL) { + GST_DEBUG_OBJECT (element, "searching for pad-template with name 'sink'"); + mux_template = + gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS + (splitmux->muxer), "sink"); + name = NULL; + } } - res = gst_element_request_pad (splitmux->muxer, mux_template, name, caps); - if (res == NULL) + if (mux_template == NULL) { + GST_ERROR_OBJECT (element, + "unable to find a suitable sink pad-template on the muxer"); + goto fail; + } + GST_DEBUG_OBJECT (element, "found sink pad-template '%s' on the muxer", + mux_template->name_template); + + if (mux_template->presence == GST_PAD_REQUEST) { + GST_DEBUG_OBJECT (element, "requesting pad from pad-template"); + + res = gst_element_request_pad (splitmux->muxer, mux_template, name, caps); + if (res == NULL) + goto fail; + } else if (mux_template->presence == GST_PAD_ALWAYS) { + GST_DEBUG_OBJECT (element, "accessing always pad from pad-template"); + + res = + gst_element_get_static_pad (splitmux->muxer, + mux_template->name_template); + if (res == NULL) + goto fail; + } else { + GST_ERROR_OBJECT (element, + "unexpected pad presence %d", mux_template->presence); + + goto fail; + } if (is_video) gname = g_strdup ("video"); |