From 9ffb8859d78ad1c111b6d2b2e1ded0c11aaacfee Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Wed, 3 Nov 2010 14:37:07 +0530 Subject: [PATCH] discoverer: Don't wait for subtitle streams to preroll Subtitle streams being parse can cause the pipeline to wait indefinitely to PREROLL. This makes subtitle streams got to PAUSED even if no data is available. This should not be a cause for concern as we don't expect to get much data for subtitle streams other than language tags from the container. https://bugzilla.gnome.org/show_bug.cgi?id=632291 --- gst-libs/gst/pbutils/gstdiscoverer.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 4a7d72d27d..58d3e5288b 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -443,6 +443,15 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad, { PrivateStream *ps; GstPad *sinkpad = NULL; + GstCaps *caps; + static GstCaps *subs_caps = NULL; + + if (!subs_caps) { + subs_caps = gst_caps_from_string ("text/plain; text/x-pango-markup; " + "subpicture/x-pgs; subpicture/x-dvb; application/x-subtitle-unknown; " + "application/x-ssa; application/x-ass; subtitle/x-kate; " + "video/x-dvd-subpicture; "); + } GST_DEBUG_OBJECT (dc, "pad %s:%s", GST_DEBUG_PAD_NAME (pad)); @@ -459,6 +468,16 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad, g_object_set (ps->sink, "silent", TRUE, NULL); g_object_set (ps->queue, "max-size-buffers", 1, "silent", TRUE, NULL); + caps = gst_pad_get_caps_reffed (pad); + + if (gst_caps_can_intersect (caps, subs_caps)) { + /* Subtitle streams are sparse and don't provide any information - don't + * wait for data to preroll */ + g_object_set (ps->sink, "async", FALSE, NULL); + } + + gst_caps_unref (caps); + gst_bin_add_many (dc->priv->pipeline, ps->queue, ps->sink, NULL); if (!gst_element_link_pads_full (ps->queue, "src", ps->sink, "sink",