diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-06-16 19:15:20 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-06-16 19:17:05 +0200 |
commit | 6d2621d02c8469132244d7b57ba3e28ddecffed2 (patch) | |
tree | b1a446c7c87a56adf8cb29793eed3a09155524eb | |
parent | c2fc44d0ec3167d7ec7567bc3996aa5652ed0690 (diff) |
decodebin2: improve autoplugging
Use the pad caps when they are available to continue the autoplugging. If the
pad caps are set, they are fixed and then we can directly continue autoplugging.
-rw-r--r-- | gst/playback/gstdecodebin2.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index e7013376a..5a08dba44 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -1972,7 +1972,19 @@ pad_added_cb (GstElement * element, GstPad * pad, GstDecodeChain * chain) GST_DEBUG_OBJECT (pad, "pad added, chain:%p", chain); - caps = gst_pad_get_caps_reffed (pad); + /* first check the pad caps, if this is set, we are positively sure it is + * fixed and exactly what the element will produce. */ + GST_OBJECT_LOCK (pad); + if ((caps = GST_PAD_CAPS (pad))) + gst_caps_ref (caps); + GST_OBJECT_UNLOCK (pad); + + /* then use the getcaps function if we don't have caps. These caps might not + * be fixed in some cases, in which case analyze_new_pad will set up a + * notify::caps signal to continue autoplugging. */ + if (caps == NULL) + caps = gst_pad_get_caps_reffed (pad); + analyze_new_pad (dbin, element, pad, caps, chain); if (caps) gst_caps_unref (caps); |