gst/playback/: More leak and compile fixes.
authorWim Taymans <wim.taymans@gmail.com>
Mon, 18 Jul 2005 11:32:34 +0000 (11:32 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 18 Jul 2005 11:32:34 +0000 (11:32 +0000)
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
gst/playback/gstdecodebin.c
gst/playback/gstplaybin.c
gst/playback/gststreaminfo.c
gst/playback/gststreamselector.c

index df51374..95e8901 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2005-07-18  Wim Taymans  <wim@fluendo.com>
 
+       * 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  <wim@fluendo.com>
+
        * examples/seeking/seek.c: (make_vorbis_theora_pipeline),
        (query_rates), (query_positions_elems), (query_positions_pads),
        (do_seek), (seek_cb), (stop_seek):
index 91d1575..b78accf 100644 (file)
@@ -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);
       }
index 9647fbc..3f46c1a 100644 (file)
@@ -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);
   }
 
index 1c70974..18442e4 100644 (file)
@@ -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);
     }
index a52431b..d2ca7b0 100644 (file)
@@ -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;
 }