summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2003-06-27 23:39:46 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2003-06-27 23:39:46 +0000
commitf45029f506009fd1410fa727c79f8b2fb86a8cf3 (patch)
tree79114e61fe42bbfeb7338aa633d4e1a40ee09a44
parent8cc455262e9f64c6099451d08576f151c9558e9e (diff)
fix state change for modplug fixes #116152
Original commit message from CVS: fix state change for modplug fixes #116152
-rw-r--r--ChangeLog5
-rw-r--r--gst/modplug/gstmodplug.cc13
-rw-r--r--gst/modplug/gstmodplug.h1
3 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 142d26516..ca51be50a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-28 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * gst/modplug/gstmodplug.cc:
+ * gst/modplug/gstmodplug.h: fix state change cleanup
+
2003-06-12 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/videotestsrc/gstvideotestsrc.c:
diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc
index adc3a7da4..4b7cf19b7 100644
--- a/gst/modplug/gstmodplug.cc
+++ b/gst/modplug/gstmodplug.cc
@@ -371,6 +371,8 @@ gst_modplug_init (GstModPlug *modplug)
modplug->_16bit = TRUE;
modplug->channel = 2;
modplug->frequency = 44100;
+ modplug->audiobuffer = NULL;
+ modplug->buffer_in = NULL;
}
@@ -656,6 +658,7 @@ gst_modplug_loop (GstElement *element)
}
modplug->mSoundFile->Create (modplug->buffer_in, modplug->song_size);
+ modplug->opened = TRUE;
modplug->audiobuffer = (guchar *) g_malloc (modplug->length);
@@ -744,9 +747,13 @@ gst_modplug_change_state (GstElement *element)
break;
case GST_STATE_PAUSED_TO_READY:
gst_bytestream_destroy (modplug->bs);
- modplug->mSoundFile->Destroy ();
- g_free (modplug->audiobuffer);
- g_free (modplug->buffer_in);
+ modplug->bs = NULL;
+ if (modplug->opened)
+ {
+ modplug->mSoundFile->Destroy ();
+ modplug->opened = FALSE;
+ }
+ if (modplug->audiobuffer) g_free (modplug->audiobuffer);
modplug->audiobuffer = NULL;
modplug->buffer_in = NULL;
modplug->state = MODPLUG_STATE_NEED_TUNE;
diff --git a/gst/modplug/gstmodplug.h b/gst/modplug/gstmodplug.h
index 901670c80..2ba837b3c 100644
--- a/gst/modplug/gstmodplug.h
+++ b/gst/modplug/gstmodplug.h
@@ -80,6 +80,7 @@ struct _GstModPlug {
guint64 bytes_read;
CSoundFile *mSoundFile;
+ gboolean opened; /* set to TRUE when mSoundFile is created */
};
struct _GstModPlugClass {