playbin2/playsink: update subtitle handling for streamsynchronizer

Streamsynchronizer excepts to see stream-changed msg for all streams, but to
arrange for this, video and subtitle streams need to be decoupled by means
of queues (due to pad blocks that may occur).

Fixes #626463.
This commit is contained in:
Mark Nauwelaerts 2010-08-11 10:27:35 +02:00
parent ff8bdcfe94
commit 6c5b437118
2 changed files with 21 additions and 7 deletions

View file

@ -2691,10 +2691,9 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) { for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
GstSourceSelect *select = &group->selector[i]; GstSourceSelect *select = &group->selector[i];
/* Wait for stream-changed messages on all selectors except /* All streamsynchronizer streams should see stream-changed message,
* the text selector because of the sparse nature of text streams. * to arrange for blocking unblocking. */
*/ if (select->sinkpad) {
if (select->sinkpad && select->type != GST_PLAY_SINK_TYPE_TEXT) {
GstStructure *s; GstStructure *s;
GstMessage *msg; GstMessage *msg;
GstEvent *event; GstEvent *event;

View file

@ -1498,6 +1498,8 @@ gen_text_chain (GstPlaySink * playsink)
(_("Missing element '%s' - check your GStreamer installation."), (_("Missing element '%s' - check your GStreamer installation."),
"subtitleoverlay"), ("subtitle rendering disabled")); "subtitleoverlay"), ("subtitle rendering disabled"));
} else { } else {
GstElement *element;
gst_bin_add (bin, chain->overlay); gst_bin_add (bin, chain->overlay);
g_object_set (G_OBJECT (chain->overlay), "silent", FALSE, NULL); g_object_set (G_OBJECT (chain->overlay), "silent", FALSE, NULL);
@ -1513,12 +1515,25 @@ gen_text_chain (GstPlaySink * playsink)
gst_element_link_pads_full (chain->queue, "src", chain->overlay, gst_element_link_pads_full (chain->queue, "src", chain->overlay,
"video_sink", GST_PAD_LINK_CHECK_TEMPLATE_CAPS); "video_sink", GST_PAD_LINK_CHECK_TEMPLATE_CAPS);
textsinkpad = /* make another little queue to decouple streams */
gst_element_get_static_pad (chain->overlay, "subtitle_sink"); element = gst_element_factory_make ("queue", "subqueue");
if (element == NULL) {
post_missing_element_message (playsink, "queue");
GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
(_("Missing element '%s' - check your GStreamer installation."),
"queue"), ("rendering might be suboptimal"));
} else {
g_object_set (G_OBJECT (element), "max-size-buffers", 3,
"max-size-bytes", 0, "max-size-time", (gint64) 0, NULL);
gst_bin_add (bin, element);
gst_element_link_pads_full (element, "src", chain->overlay,
"subtitle_sink", GST_PAD_LINK_CHECK_TEMPLATE_CAPS);
textsinkpad = gst_element_get_static_pad (element, "sink");
srcpad = gst_element_get_static_pad (chain->overlay, "src"); srcpad = gst_element_get_static_pad (chain->overlay, "src");
} }
} }
} }
}
if (videosinkpad == NULL) { if (videosinkpad == NULL) {
/* if we still don't have a videosink, we don't have an overlay. the only /* if we still don't have a videosink, we don't have an overlay. the only