From ddf2489be446928f063e195d365071e8402ecc7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 May 2011 10:25:10 +0200 Subject: [PATCH] pad: Re-implement notify::caps --- gst/gstpad.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gst/gstpad.c b/gst/gstpad.c index 6cf6a0c07c..3b6942e8f6 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2037,6 +2037,7 @@ gst_pad_link_full (GstPad * srcpad, GstPad * sinkpad, GstPadLinkCheck flags) { GstPadLinkReturn result; GstElement *parent; + GstCaps *oldcaps, *newcaps; g_return_val_if_fail (GST_IS_PAD (srcpad), GST_PAD_LINK_REFUSED); g_return_val_if_fail (GST_PAD_IS_SRC (srcpad), GST_PAD_LINK_WRONG_DIRECTION); @@ -2068,12 +2069,17 @@ gst_pad_link_full (GstPad * srcpad, GstPad * sinkpad, GstPadLinkCheck flags) /* make sure we push the events from the source to this new peer, for this we * copy the events on the sinkpad and mark EVENTS_PENDING */ + oldcaps = get_pad_caps (sinkpad); replace_events (srcpad->priv->events, sinkpad->priv->events); + newcaps = get_pad_caps (sinkpad); GST_OBJECT_FLAG_SET (sinkpad, GST_PAD_NEED_EVENTS); GST_OBJECT_UNLOCK (sinkpad); GST_OBJECT_UNLOCK (srcpad); + if (oldcaps != newcaps) + g_object_notify_by_pspec ((GObject *) sinkpad, pspec_caps); + /* FIXME released the locks here, concurrent thread might link * something else. */ if (GST_PAD_LINKFUNC (srcpad)) { @@ -4419,6 +4425,7 @@ gst_pad_push_event (GstPad * pad, GstEvent * event) { GstPad *peerpad; gboolean result; + GstCaps *oldcaps = NULL, *newcaps = NULL; g_return_val_if_fail (GST_IS_PAD (pad), FALSE); g_return_val_if_fail (event != NULL, FALSE); @@ -4484,13 +4491,19 @@ gst_pad_push_event (GstPad * pad, GstEvent * event) GST_LOG_OBJECT (pad, "storing sticky event %s at index %u", GST_EVENT_TYPE_NAME (event), idx); + oldcaps = get_pad_caps (pad); gst_event_replace (&pad->priv->events[idx], event); + newcaps = get_pad_caps (pad); } if ((peerpad = GST_PAD_PEER (pad))) gst_object_ref (peerpad); GST_OBJECT_UNLOCK (pad); + if (oldcaps != newcaps) + g_object_notify_by_pspec ((GObject *) pad, pspec_caps); + + /* backwards compatibility mode for caps */ if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) { GstCaps *caps;