From 0d21b72ff72bf0425cf9173d07f2e22d397f5c94 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 18 Jul 2005 11:32:34 +0000 Subject: [PATCH] gst/playback/: More leak and compile fixes. Original commit message from CVS: * gst/playback/gstdecodebin.c: (remove_element_chain): * gst/playback/gstplaybin.c: (add_sink): * gst/playback/gststreaminfo.c: (gst_stream_info_dispose), (gst_stream_info_set_mute): * gst/playback/gststreamselector.c: (gst_stream_selector_get_linked_pad), (gst_stream_selector_getcaps), (gst_stream_selector_chain): More leak and compile fixes. --- ChangeLog | 11 +++++++++++ gst/playback/gstdecodebin.c | 18 ++++++++---------- gst/playback/gstplaybin.c | 10 ++++------ gst/playback/gststreaminfo.c | 28 ++++++++++++---------------- gst/playback/gststreamselector.c | 29 +++++++++++++++++++---------- 5 files changed, 54 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index df51374ded..95e8901555 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-07-18 Wim Taymans + + * gst/playback/gstdecodebin.c: (remove_element_chain): + * gst/playback/gstplaybin.c: (add_sink): + * gst/playback/gststreaminfo.c: (gst_stream_info_dispose), + (gst_stream_info_set_mute): + * gst/playback/gststreamselector.c: + (gst_stream_selector_get_linked_pad), + (gst_stream_selector_getcaps), (gst_stream_selector_chain): + More leak and compile fixes. + 2005-07-18 Wim Taymans * examples/seeking/seek.c: (make_vorbis_theora_pipeline), diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index 91d15757fd..b78accf286 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -741,18 +741,16 @@ remove_element_chain (GstDecodeBin * decode_bin, GstPad * pad) GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer)); { - GstObject *parent = gst_pad_get_parent (peer); + GstElement *parent = gst_pad_get_parent_element (peer); if (parent) { - if (GST_IS_ELEMENT (parent)) { - if (parent != GST_OBJECT (decode_bin)) { - GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s", - GST_DEBUG_PAD_NAME (peer)); - } else { - GST_DEBUG_OBJECT (decode_bin, "recursing element %s on pad %s:%s", - GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad)); - remove_element_chain (decode_bin, peer); - } + if (parent != GST_ELEMENT (decode_bin)) { + GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s", + GST_DEBUG_PAD_NAME (peer)); + } else { + GST_DEBUG_OBJECT (decode_bin, "recursing element %s on pad %s:%s", + GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad)); + remove_element_chain (decode_bin, peer); } gst_object_unref (parent); } diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index 9647fbca97..3f46c1ac91 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -717,7 +717,7 @@ add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad) { GstPad *sinkpad; GstPadLinkReturn res; - GstObject *parent; + GstElement *parent; gst_bin_add (GST_BIN (play_bin), sink); @@ -727,12 +727,10 @@ add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad) gst_object_unref (sinkpad); /* this is only for debugging */ - parent = gst_pad_get_parent (srcpad); + parent = gst_pad_get_parent_element (srcpad); if (parent) { - if (GST_IS_ELEMENT (parent)) { - GST_DEBUG ("Adding sink with state %d (parent: %d, peer: %d)\n", - GST_STATE (sink), GST_STATE (play_bin), GST_STATE (parent)); - } + GST_DEBUG ("Adding sink with state %d (parent: %d, peer: %d)\n", + GST_STATE (sink), GST_STATE (play_bin), GST_STATE (parent)); gst_object_unref (parent); } diff --git a/gst/playback/gststreaminfo.c b/gst/playback/gststreaminfo.c index 1c70974a6a..18442e461b 100644 --- a/gst/playback/gststreaminfo.c +++ b/gst/playback/gststreaminfo.c @@ -234,15 +234,13 @@ gst_stream_info_dispose (GObject * object) stream_info = GST_STREAM_INFO (object); if (stream_info->object) { - GstObject *parent; + GstElement *parent; - parent = gst_pad_get_parent ((GstPad *) + parent = gst_pad_get_parent_element ((GstPad *) GST_PAD_CAST (stream_info->object)); if (parent != NULL) { - if (GST_IS_ELEMENT (parent)) { - g_signal_handlers_disconnect_by_func (parent, - G_CALLBACK (stream_info_change_state), stream_info); - } + g_signal_handlers_disconnect_by_func (parent, + G_CALLBACK (stream_info_change_state), stream_info); gst_object_unref (parent); } @@ -293,24 +291,22 @@ gst_stream_info_set_mute (GstStreamInfo * stream_info, gboolean mute) } if (mute != stream_info->mute) { - GstObject *element; + GstElement *element; stream_info->mute = mute; //gst_pad_set_active_recursive ((GstPad *) //GST_PAD_CAST (stream_info->object), !mute); g_warning ("FIXME"); - element = gst_pad_get_parent ((GstPad *) + element = gst_pad_get_parent_element ((GstPad *) GST_PAD_CAST (stream_info->object)); if (element) { - if (GST_IS_ELEMENT (element)) { - if (mute) { - g_signal_connect (element, "state-change", - G_CALLBACK (stream_info_change_state), stream_info); - } else { - g_signal_handlers_disconnect_by_func (element, - G_CALLBACK (stream_info_change_state), stream_info); - } + if (mute) { + g_signal_connect (element, "state-change", + G_CALLBACK (stream_info_change_state), stream_info); + } else { + g_signal_handlers_disconnect_by_func (element, + G_CALLBACK (stream_info_change_state), stream_info); } gst_object_unref (element); } diff --git a/gst/playback/gststreamselector.c b/gst/playback/gststreamselector.c index a52431b5da..d2ca7b0be5 100644 --- a/gst/playback/gststreamselector.c +++ b/gst/playback/gststreamselector.c @@ -164,6 +164,8 @@ gst_stream_selector_get_linked_pad (GstPad * pad, gboolean strict) else if (pad == sel->last_active_sinkpad || !strict) otherpad = sel->srcpad; + gst_object_unref (sel); + return otherpad; } @@ -171,17 +173,22 @@ static GstCaps * gst_stream_selector_getcaps (GstPad * pad) { GstPad *otherpad = gst_stream_selector_get_linked_pad (pad, FALSE); + GstObject *parent; + parent = gst_object_get_parent (GST_OBJECT (pad)); if (!otherpad) { - GST_DEBUG_OBJECT (gst_pad_get_parent (pad), - "Pad %s not linked, returning ANY", gst_pad_get_name (pad)); + GST_DEBUG_OBJECT (parent, + "Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad)); + gst_object_unref (parent); return gst_caps_new_any (); } - GST_DEBUG_OBJECT (gst_pad_get_parent (pad), - "Pad %s is linked (to %s), returning allowed-caps", - gst_pad_get_name (pad), gst_pad_get_name (otherpad)); + GST_DEBUG_OBJECT (parent, + "Pad %s:%s is linked (to %s:%s), returning allowed-caps", + GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (otherpad)); + + gst_object_unref (parent); return gst_pad_peer_get_caps (otherpad); } @@ -241,17 +248,19 @@ gst_stream_selector_chain (GstPad * pad, GstBuffer * buf) /* first, check if the active pad changed. If so, redo * negotiation and fail if that fails. */ if (pad != sel->last_active_sinkpad) { - GST_LOG_OBJECT (sel, "stream change detected, switching from %s to %s", + GST_LOG_OBJECT (sel, "stream change detected, switching from %s to %s:%s", sel->last_active_sinkpad ? - gst_pad_get_name (sel->last_active_sinkpad) : "none", - gst_pad_get_name (pad)); + GST_OBJECT_NAME (sel->last_active_sinkpad) : "none", + GST_DEBUG_PAD_NAME (pad)); sel->last_active_sinkpad = pad; } /* forward */ - GST_DEBUG_OBJECT (sel, "Forwarding buffer %p from pad %s", - "buf", gst_pad_get_name (pad)); + GST_DEBUG_OBJECT (sel, "Forwarding buffer %p from pad %s:%s", + buf, GST_DEBUG_PAD_NAME (pad)); res = gst_pad_push (sel->srcpad, buf); + gst_object_unref (sel); + return res; }