From 616181901ebfdc774d6c617ea91db9437b98d716 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 May 2011 11:33:12 +0200 Subject: [PATCH] playback: Update for negotiation related API changes --- gst/playback/gstdecodebin.c | 4 ++-- gst/playback/gstdecodebin2.c | 2 +- gst/playback/gstplaybasebin.c | 4 ++-- gst/playback/gstplaybin.c | 4 ++-- gst/playback/gstplaybin2.c | 8 ++++---- gst/playback/gststreamselector.c | 18 +++++++++--------- gst/playback/gststreamsynchronizer.c | 6 +++--- gst/playback/gstsubtitleoverlay.c | 14 +++++++++----- gst/playback/gsturidecodebin.c | 2 +- 9 files changed, 33 insertions(+), 29 deletions(-) diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index eaa5ec7..95a65d5 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -1513,7 +1513,7 @@ new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic) /* see if any more pending dynamic connections exist */ more = gst_decode_bin_is_dynamic (decode_bin); - caps = gst_pad_get_caps (pad); + caps = gst_pad_get_caps (pad, NULL); close_pad_link (element, pad, caps, decode_bin, more); if (caps) gst_caps_unref (caps); @@ -1782,7 +1782,7 @@ close_link (GstElement * element, GstDecodeBin * decode_bin) GST_OBJECT_NAME (pad)); /* continue autoplugging on the pads */ - caps = gst_pad_get_caps (pad); + caps = gst_pad_get_caps (pad, NULL); close_pad_link (element, pad, caps, decode_bin, more); if (caps) gst_caps_unref (caps); diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 65c793c..7f0349d 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -1891,7 +1891,7 @@ get_pad_caps (GstPad * pad) * 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); + caps = gst_pad_get_caps (pad, NULL); return caps; } diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index 2a3e466..3591f89 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -1333,7 +1333,7 @@ new_decoded_pad_full (GstElement * element, GstPad * pad, gboolean last, GST_DEBUG ("play base: new decoded pad. Last: %d", last); /* first see if this pad has interesting caps */ - caps = gst_pad_get_caps (pad); + caps = gst_pad_get_caps (pad, NULL); if (caps == NULL || gst_caps_is_empty (caps) || gst_caps_is_any (caps)) goto no_type; @@ -1815,7 +1815,7 @@ has_all_raw_caps (GstPad * pad, gboolean * all_raw) guint i, num_raw = 0; gboolean res = FALSE; - caps = gst_pad_get_caps (pad); + caps = gst_pad_get_caps (pad, NULL); if (caps == NULL) return FALSE; diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index f1fc1ee..2a56156 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -1538,7 +1538,7 @@ link_failed: GstCaps *caps; /* could not link this stream */ - caps = gst_pad_get_caps (srcpad); + caps = gst_pad_get_caps (srcpad, NULL); capsstr = gst_caps_to_string (caps); g_warning ("could not link %s: %d", capsstr, linkres); GST_DEBUG_OBJECT (play_bin, @@ -1555,7 +1555,7 @@ subtitle_failed: GstCaps *caps; /* could not link this stream */ - caps = gst_pad_get_caps (subtitle_pad); + caps = gst_pad_get_caps (subtitle_pad, NULL); GST_WARNING_OBJECT (play_bin, "subtitle link failed when adding sink, " "caps = %" GST_PTR_FORMAT ", reason %d", caps, linkres); gst_caps_unref (caps); diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index 7869da4..9da661c 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -2462,7 +2462,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group) playbin = group->playbin; - caps = gst_pad_get_caps_reffed (pad); + caps = gst_pad_get_caps (pad, NULL); s = gst_caps_get_structure (caps, 0); name = gst_structure_get_name (s); @@ -2980,7 +2980,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps, if (GST_STATE (sink) < GST_STATE_READY) gst_element_set_state (sink, GST_STATE_READY); - sinkcaps = gst_pad_get_caps_reffed (sinkpad); + sinkcaps = gst_pad_get_caps (sinkpad, NULL); if (!gst_caps_is_any (sinkcaps)) ret = !gst_pad_accept_caps (sinkpad, caps); gst_caps_unref (sinkcaps); @@ -3012,7 +3012,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps, if (GST_STATE (sink) < GST_STATE_READY) gst_element_set_state (sink, GST_STATE_READY); - sinkcaps = gst_pad_get_caps_reffed (sinkpad); + sinkcaps = gst_pad_get_caps (sinkpad, NULL); if (!gst_caps_is_any (sinkcaps)) ret = !gst_pad_accept_caps (sinkpad, caps); gst_caps_unref (sinkcaps); @@ -3033,7 +3033,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps, if (GST_STATE (sink) < GST_STATE_READY) gst_element_set_state (sink, GST_STATE_READY); - sinkcaps = gst_pad_get_caps_reffed (sinkpad); + sinkcaps = gst_pad_get_caps (sinkpad, NULL); if (!gst_caps_is_any (sinkcaps)) ret = !gst_pad_accept_caps (sinkpad, caps); gst_caps_unref (sinkcaps); diff --git a/gst/playback/gststreamselector.c b/gst/playback/gststreamselector.c index 53ba368..b915628 100644 --- a/gst/playback/gststreamselector.c +++ b/gst/playback/gststreamselector.c @@ -101,7 +101,7 @@ static GstPadClass *selector_pad_parent_class = NULL; static void gst_selector_pad_reset (GstSelectorPad * pad); static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event); -static GstCaps *gst_selector_pad_getcaps (GstPad * pad); +static GstCaps *gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter); static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf); enum @@ -281,7 +281,7 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event) } static GstCaps * -gst_selector_pad_getcaps (GstPad * pad) +gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter) { GstStreamSelector *sel; GstCaps *caps; @@ -289,9 +289,9 @@ gst_selector_pad_getcaps (GstPad * pad) sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad)); GST_DEBUG_OBJECT (sel, "Getting caps of srcpad peer"); - caps = gst_pad_peer_get_caps (sel->srcpad); + caps = gst_pad_peer_get_caps (sel->srcpad, filter); if (caps == NULL) - caps = gst_caps_new_any (); + caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ()); gst_object_unref (sel); @@ -365,7 +365,7 @@ static GstPad *gst_stream_selector_request_new_pad (GstElement * element, static void gst_stream_selector_release_pad (GstElement * element, GstPad * pad); static GstIterator *gst_stream_selector_pad_iterate_linked_pads (GstPad * pad); -static GstCaps *gst_stream_selector_getcaps (GstPad * pad); +static GstCaps *gst_stream_selector_getcaps (GstPad * pad, GstCaps * filter); static GstElementClass *parent_class = NULL; @@ -552,7 +552,7 @@ gst_stream_selector_get_linked_pad (GstPad * pad, gboolean strict) } static GstCaps * -gst_stream_selector_getcaps (GstPad * pad) +gst_stream_selector_getcaps (GstPad * pad, GstCaps * filter) { GstPad *otherpad; GstObject *parent; @@ -563,15 +563,15 @@ gst_stream_selector_getcaps (GstPad * pad) if (!otherpad) { GST_DEBUG_OBJECT (parent, "Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad)); - caps = gst_caps_new_any (); + caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ()); } else { GST_DEBUG_OBJECT (parent, "Pad %s:%s is linked (to %s:%s), returning peer caps", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (otherpad)); /* if the peer has caps, use those. If the pad is not linked, this function * returns NULL and we return ANY */ - if (!(caps = gst_pad_peer_get_caps (otherpad))) - caps = gst_caps_new_any (); + if (!(caps = gst_pad_peer_get_caps (otherpad, filter))) + caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ()); gst_object_unref (otherpad); } diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c index 001d37e..e64c27b 100644 --- a/gst/playback/gststreamsynchronizer.c +++ b/gst/playback/gststreamsynchronizer.c @@ -151,19 +151,19 @@ gst_stream_synchronizer_query (GstPad * pad, GstQuery ** query) } static GstCaps * -gst_stream_synchronizer_getcaps (GstPad * pad) +gst_stream_synchronizer_getcaps (GstPad * pad, GstCaps * filter) { GstPad *opad; GstCaps *ret = NULL; opad = gst_stream_get_other_pad_from_pad (pad); if (opad) { - ret = gst_pad_peer_get_caps (opad); + ret = gst_pad_peer_get_caps (opad, filter); gst_object_unref (opad); } if (ret == NULL) - ret = gst_caps_new_any (); + ret = (filter ? gst_caps_ref (filter) : gst_caps_new_any ()); GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret); diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c index c0e223a..c4da020 100644 --- a/gst/playback/gstsubtitleoverlay.c +++ b/gst/playback/gstsubtitleoverlay.c @@ -699,7 +699,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) if (peer) { subcaps = gst_pad_get_negotiated_caps (peer); if (!subcaps) { - subcaps = gst_pad_get_caps_reffed (peer); + subcaps = gst_pad_get_caps (peer, NULL); if (!gst_caps_is_fixed (subcaps)) { gst_caps_unref (subcaps); subcaps = NULL; @@ -840,7 +840,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data) video_caps = gst_pad_get_negotiated_caps (video_peer); if (!video_caps) { - video_caps = gst_pad_get_caps_reffed (video_peer); + video_caps = gst_pad_get_caps (video_peer, NULL); if (!gst_caps_is_fixed (video_caps)) { gst_caps_unref (video_caps); video_caps = NULL; @@ -1721,7 +1721,7 @@ gst_subtitle_overlay_subtitle_sink_chain (GstPad * pad, GstBuffer * buffer) } static GstCaps * -gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad) +gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad, GstCaps * filter) { GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad)); GstCaps *ret; @@ -1729,6 +1729,10 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad) g_mutex_lock (self->factories_lock); if (G_UNLIKELY (!gst_subtitle_overlay_update_factory_list (self))) ret = GST_CAPS_NONE; + else if (filter) + ret = + gst_caps_intersect_full (filter, self->factory_caps, + GST_CAPS_INTERSECT_FIRST); else ret = gst_caps_ref (self->factory_caps); g_mutex_unlock (self->factories_lock); @@ -1743,7 +1747,7 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad) static gboolean gst_subtitle_overlay_subtitle_sink_acceptcaps (GstPad * pad, GstCaps * caps) { - GstCaps *othercaps = gst_subtitle_overlay_subtitle_sink_getcaps (pad); + GstCaps *othercaps = gst_subtitle_overlay_subtitle_sink_getcaps (pad, NULL); gboolean ret = gst_caps_can_intersect (caps, othercaps); gst_caps_unref (othercaps); @@ -1804,7 +1808,7 @@ gst_subtitle_overlay_subtitle_sink_link (GstPad * pad, GstPad * peer) caps = gst_pad_get_negotiated_caps (peer); if (!caps) { - caps = gst_pad_get_caps_reffed (peer); + caps = gst_pad_get_caps (peer, NULL); if (!gst_caps_is_fixed (caps)) { gst_caps_unref (caps); caps = NULL; diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index 63f6d72..6144c9b 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -1195,7 +1195,7 @@ has_all_raw_caps (GstPad * pad, GstCaps * rawcaps, gboolean * all_raw) gint capssize; gboolean res = FALSE; - caps = gst_pad_get_caps_reffed (pad); + caps = gst_pad_get_caps (pad, NULL); if (caps == NULL) return FALSE; -- 2.7.4