playback: Update for negotiation related API changes

This commit is contained in:
Sebastian Dröge 2011-05-16 11:33:12 +02:00
parent a78bf729a9
commit 616181901e
9 changed files with 33 additions and 29 deletions

View file

@ -1513,7 +1513,7 @@ new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic)
/* see if any more pending dynamic connections exist */ /* see if any more pending dynamic connections exist */
more = gst_decode_bin_is_dynamic (decode_bin); 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); close_pad_link (element, pad, caps, decode_bin, more);
if (caps) if (caps)
gst_caps_unref (caps); gst_caps_unref (caps);
@ -1782,7 +1782,7 @@ close_link (GstElement * element, GstDecodeBin * decode_bin)
GST_OBJECT_NAME (pad)); GST_OBJECT_NAME (pad));
/* continue autoplugging on the pads */ /* 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); close_pad_link (element, pad, caps, decode_bin, more);
if (caps) if (caps)
gst_caps_unref (caps); gst_caps_unref (caps);

View file

@ -1891,7 +1891,7 @@ get_pad_caps (GstPad * pad)
* be fixed in some cases, in which case analyze_new_pad will set up a * be fixed in some cases, in which case analyze_new_pad will set up a
* notify::caps signal to continue autoplugging. */ * notify::caps signal to continue autoplugging. */
if (caps == NULL) if (caps == NULL)
caps = gst_pad_get_caps_reffed (pad); caps = gst_pad_get_caps (pad, NULL);
return caps; return caps;
} }

View file

@ -1333,7 +1333,7 @@ new_decoded_pad_full (GstElement * element, GstPad * pad, gboolean last,
GST_DEBUG ("play base: new decoded pad. Last: %d", last); GST_DEBUG ("play base: new decoded pad. Last: %d", last);
/* first see if this pad has interesting caps */ /* 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)) if (caps == NULL || gst_caps_is_empty (caps) || gst_caps_is_any (caps))
goto no_type; goto no_type;
@ -1815,7 +1815,7 @@ has_all_raw_caps (GstPad * pad, gboolean * all_raw)
guint i, num_raw = 0; guint i, num_raw = 0;
gboolean res = FALSE; gboolean res = FALSE;
caps = gst_pad_get_caps (pad); caps = gst_pad_get_caps (pad, NULL);
if (caps == NULL) if (caps == NULL)
return FALSE; return FALSE;

View file

@ -1538,7 +1538,7 @@ link_failed:
GstCaps *caps; GstCaps *caps;
/* could not link this stream */ /* could not link this stream */
caps = gst_pad_get_caps (srcpad); caps = gst_pad_get_caps (srcpad, NULL);
capsstr = gst_caps_to_string (caps); capsstr = gst_caps_to_string (caps);
g_warning ("could not link %s: %d", capsstr, linkres); g_warning ("could not link %s: %d", capsstr, linkres);
GST_DEBUG_OBJECT (play_bin, GST_DEBUG_OBJECT (play_bin,
@ -1555,7 +1555,7 @@ subtitle_failed:
GstCaps *caps; GstCaps *caps;
/* could not link this stream */ /* 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, " GST_WARNING_OBJECT (play_bin, "subtitle link failed when adding sink, "
"caps = %" GST_PTR_FORMAT ", reason %d", caps, linkres); "caps = %" GST_PTR_FORMAT ", reason %d", caps, linkres);
gst_caps_unref (caps); gst_caps_unref (caps);

View file

@ -2462,7 +2462,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
playbin = group->playbin; playbin = group->playbin;
caps = gst_pad_get_caps_reffed (pad); caps = gst_pad_get_caps (pad, NULL);
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
name = gst_structure_get_name (s); 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) if (GST_STATE (sink) < GST_STATE_READY)
gst_element_set_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)) if (!gst_caps_is_any (sinkcaps))
ret = !gst_pad_accept_caps (sinkpad, caps); ret = !gst_pad_accept_caps (sinkpad, caps);
gst_caps_unref (sinkcaps); gst_caps_unref (sinkcaps);
@ -3012,7 +3012,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
if (GST_STATE (sink) < GST_STATE_READY) if (GST_STATE (sink) < GST_STATE_READY)
gst_element_set_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)) if (!gst_caps_is_any (sinkcaps))
ret = !gst_pad_accept_caps (sinkpad, caps); ret = !gst_pad_accept_caps (sinkpad, caps);
gst_caps_unref (sinkcaps); gst_caps_unref (sinkcaps);
@ -3033,7 +3033,7 @@ autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
if (GST_STATE (sink) < GST_STATE_READY) if (GST_STATE (sink) < GST_STATE_READY)
gst_element_set_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)) if (!gst_caps_is_any (sinkcaps))
ret = !gst_pad_accept_caps (sinkpad, caps); ret = !gst_pad_accept_caps (sinkpad, caps);
gst_caps_unref (sinkcaps); gst_caps_unref (sinkcaps);

View file

@ -101,7 +101,7 @@ static GstPadClass *selector_pad_parent_class = NULL;
static void gst_selector_pad_reset (GstSelectorPad * pad); static void gst_selector_pad_reset (GstSelectorPad * pad);
static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event); 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); static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
enum enum
@ -281,7 +281,7 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
} }
static GstCaps * static GstCaps *
gst_selector_pad_getcaps (GstPad * pad) gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter)
{ {
GstStreamSelector *sel; GstStreamSelector *sel;
GstCaps *caps; GstCaps *caps;
@ -289,9 +289,9 @@ gst_selector_pad_getcaps (GstPad * pad)
sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad)); sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (sel, "Getting caps of srcpad peer"); 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) if (caps == NULL)
caps = gst_caps_new_any (); caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
gst_object_unref (sel); 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, static void gst_stream_selector_release_pad (GstElement * element,
GstPad * pad); GstPad * pad);
static GstIterator *gst_stream_selector_pad_iterate_linked_pads (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; static GstElementClass *parent_class = NULL;
@ -552,7 +552,7 @@ gst_stream_selector_get_linked_pad (GstPad * pad, gboolean strict)
} }
static GstCaps * static GstCaps *
gst_stream_selector_getcaps (GstPad * pad) gst_stream_selector_getcaps (GstPad * pad, GstCaps * filter)
{ {
GstPad *otherpad; GstPad *otherpad;
GstObject *parent; GstObject *parent;
@ -563,15 +563,15 @@ gst_stream_selector_getcaps (GstPad * pad)
if (!otherpad) { if (!otherpad) {
GST_DEBUG_OBJECT (parent, GST_DEBUG_OBJECT (parent,
"Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad)); "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 { } else {
GST_DEBUG_OBJECT (parent, GST_DEBUG_OBJECT (parent,
"Pad %s:%s is linked (to %s:%s), returning peer caps", "Pad %s:%s is linked (to %s:%s), returning peer caps",
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (otherpad)); 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 /* if the peer has caps, use those. If the pad is not linked, this function
* returns NULL and we return ANY */ * returns NULL and we return ANY */
if (!(caps = gst_pad_peer_get_caps (otherpad))) if (!(caps = gst_pad_peer_get_caps (otherpad, filter)))
caps = gst_caps_new_any (); caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
gst_object_unref (otherpad); gst_object_unref (otherpad);
} }

View file

@ -151,19 +151,19 @@ gst_stream_synchronizer_query (GstPad * pad, GstQuery ** query)
} }
static GstCaps * static GstCaps *
gst_stream_synchronizer_getcaps (GstPad * pad) gst_stream_synchronizer_getcaps (GstPad * pad, GstCaps * filter)
{ {
GstPad *opad; GstPad *opad;
GstCaps *ret = NULL; GstCaps *ret = NULL;
opad = gst_stream_get_other_pad_from_pad (pad); opad = gst_stream_get_other_pad_from_pad (pad);
if (opad) { if (opad) {
ret = gst_pad_peer_get_caps (opad); ret = gst_pad_peer_get_caps (opad, filter);
gst_object_unref (opad); gst_object_unref (opad);
} }
if (ret == NULL) 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); GST_LOG_OBJECT (pad, "Returning caps: %" GST_PTR_FORMAT, ret);

View file

@ -699,7 +699,7 @@ _pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
if (peer) { if (peer) {
subcaps = gst_pad_get_negotiated_caps (peer); subcaps = gst_pad_get_negotiated_caps (peer);
if (!subcaps) { if (!subcaps) {
subcaps = gst_pad_get_caps_reffed (peer); subcaps = gst_pad_get_caps (peer, NULL);
if (!gst_caps_is_fixed (subcaps)) { if (!gst_caps_is_fixed (subcaps)) {
gst_caps_unref (subcaps); gst_caps_unref (subcaps);
subcaps = NULL; 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); video_caps = gst_pad_get_negotiated_caps (video_peer);
if (!video_caps) { 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)) { if (!gst_caps_is_fixed (video_caps)) {
gst_caps_unref (video_caps); gst_caps_unref (video_caps);
video_caps = NULL; video_caps = NULL;
@ -1721,7 +1721,7 @@ gst_subtitle_overlay_subtitle_sink_chain (GstPad * pad, GstBuffer * buffer)
} }
static GstCaps * 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)); GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
GstCaps *ret; GstCaps *ret;
@ -1729,6 +1729,10 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad)
g_mutex_lock (self->factories_lock); g_mutex_lock (self->factories_lock);
if (G_UNLIKELY (!gst_subtitle_overlay_update_factory_list (self))) if (G_UNLIKELY (!gst_subtitle_overlay_update_factory_list (self)))
ret = GST_CAPS_NONE; ret = GST_CAPS_NONE;
else if (filter)
ret =
gst_caps_intersect_full (filter, self->factory_caps,
GST_CAPS_INTERSECT_FIRST);
else else
ret = gst_caps_ref (self->factory_caps); ret = gst_caps_ref (self->factory_caps);
g_mutex_unlock (self->factories_lock); g_mutex_unlock (self->factories_lock);
@ -1743,7 +1747,7 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad)
static gboolean static gboolean
gst_subtitle_overlay_subtitle_sink_acceptcaps (GstPad * pad, GstCaps * caps) 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); gboolean ret = gst_caps_can_intersect (caps, othercaps);
gst_caps_unref (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); caps = gst_pad_get_negotiated_caps (peer);
if (!caps) { if (!caps) {
caps = gst_pad_get_caps_reffed (peer); caps = gst_pad_get_caps (peer, NULL);
if (!gst_caps_is_fixed (caps)) { if (!gst_caps_is_fixed (caps)) {
gst_caps_unref (caps); gst_caps_unref (caps);
caps = NULL; caps = NULL;

View file

@ -1195,7 +1195,7 @@ has_all_raw_caps (GstPad * pad, GstCaps * rawcaps, gboolean * all_raw)
gint capssize; gint capssize;
gboolean res = FALSE; gboolean res = FALSE;
caps = gst_pad_get_caps_reffed (pad); caps = gst_pad_get_caps (pad, NULL);
if (caps == NULL) if (caps == NULL)
return FALSE; return FALSE;