From eec80f9dc74ea3b08d4f50b61012fc85de0dc5cf Mon Sep 17 00:00:00 2001
From: Thomas Vander Stichele <thomas@apestaart.org>
Date: Fri, 8 Jul 2005 13:35:04 +0000
Subject: [PATCH] plug memleak in oggdemux, fix format strings in vorbisdec

Original commit message from CVS:
plug memleak in oggdemux, fix format strings in vorbisdec
---
 ChangeLog              | 10 ++++++++++
 ext/ogg/gstoggdemux.c  |  2 ++
 ext/vorbis/vorbisdec.c |  7 ++++---
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 55369cdbc9..0188676c1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-07-08  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
+	  plug a memleak, allows me to import 1479 albums in one go
+	  in jamboree
+	* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
+	(vorbis_handle_type_packet), (vorbis_dec_chain),
+	(vorbis_dec_change_state):
+	  fix some format strings
+
 2005-07-08  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* docs/libs/tmpl/gstcolorbalance.sgml:
diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
index 2fd7816e6a..7f47612e18 100644
--- a/ext/ogg/gstoggdemux.c
+++ b/ext/ogg/gstoggdemux.c
@@ -268,6 +268,8 @@ gst_ogg_pad_dispose (GObject * object)
 {
   GstOggPad *pad = GST_OGG_PAD (object);
 
+  gst_element_set_state (pad->element, GST_STATE_NULL);
+
   gst_object_replace ((GstObject **) (&pad->elem_pad), NULL);
   gst_object_replace ((GstObject **) (&pad->element), NULL);
   gst_object_replace ((GstObject **) (&pad->elem_out), NULL);
diff --git a/ext/vorbis/vorbisdec.c b/ext/vorbis/vorbisdec.c
index 2174d55018..c8f1e969a5 100644
--- a/ext/vorbis/vorbisdec.c
+++ b/ext/vorbis/vorbisdec.c
@@ -395,7 +395,7 @@ vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
           dec->granulepos = -1;
         }
       }
-      GST_DEBUG ("vd: discont %lld", dec->granulepos);
+      GST_DEBUG ("vd: discont %" G_GUINT64_FORMAT, dec->granulepos);
 
       dec->granulepos = -1;
 
@@ -735,7 +735,7 @@ vorbis_dec_chain (GstPad * pad, GstBuffer * buffer)
    */
   packet.e_o_s = 0;
 
-  GST_DEBUG ("vorbis granule: %lld", packet.granulepos);
+  GST_DEBUG ("vorbis granule: %" G_GUINT64_FORMAT, packet.granulepos);
 
   /* switch depending on packet type */
   if (packet.packet[0] & 1) {
@@ -748,7 +748,7 @@ vorbis_dec_chain (GstPad * pad, GstBuffer * buffer)
     result = vorbis_handle_data_packet (vd, &packet);
   }
 
-  GST_DEBUG ("offset end: %lld", GST_BUFFER_OFFSET_END (buffer));
+  GST_DEBUG ("offset end: %" G_GUINT64_FORMAT, GST_BUFFER_OFFSET_END (buffer));
 
   /* granulepos is the last sample in the packet */
   if (GST_BUFFER_OFFSET_END_IS_VALID (buffer))
@@ -791,6 +791,7 @@ vorbis_dec_change_state (GstElement * element)
     case GST_STATE_PLAYING_TO_PAUSED:
       break;
     case GST_STATE_PAUSED_TO_READY:
+      GST_DEBUG_OBJECT (vd, "PAUSED -> READY, clearing vorbis structures");
       vorbis_block_clear (&vd->vb);
       vorbis_dsp_clear (&vd->vd);
       vorbis_comment_clear (&vd->vc);