summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2003-06-27 23:46:13 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2003-06-27 23:46:13 +0000
commit3c1f0c5a8ef327285c85c279b9b2d0167268a3b1 (patch)
tree1aeb68ae5a973fa224a8cbed569fc424e5cc33be
parent0edcf0eccb9a62c46cad6a23dd3e25aabc5ecfcd (diff)
downloadgst-plugins-bad-3c1f0c5a8ef327285c85c279b9b2d0167268a3b1.tar.gz
gst-plugins-bad-3c1f0c5a8ef327285c85c279b9b2d0167268a3b1.tar.bz2
gst-plugins-bad-3c1f0c5a8ef327285c85c279b9b2d0167268a3b1.zip
some state change fixes
Original commit message from CVS: some state change fixes
-rw-r--r--gst/modplug/gstmodplug.cc16
-rw-r--r--gst/modplug/gstmodplug.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc
index 8085eb22..01cea4fe 100644
--- a/gst/modplug/gstmodplug.cc
+++ b/gst/modplug/gstmodplug.cc
@@ -370,6 +370,8 @@ gst_modplug_init (GstModPlug *modplug)
modplug->_16bit = TRUE;
modplug->channel = 2;
modplug->frequency = 44100;
+ modplug->audiobuffer = NULL;
+ modplug->buffer_in = NULL;
modplug->state = MODPLUG_STATE_NEED_TUNE;
}
@@ -688,6 +690,7 @@ gst_modplug_loop (GstElement *element)
}
modplug->mSoundFile->Create (modplug->buffer_in, modplug->song_size);
+ modplug->opened = TRUE;
gst_bytestream_flush (modplug->bs, modplug->song_size);
modplug->buffer_in = NULL;
@@ -783,8 +786,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);
+ modplug->bs = NULL;
+ if (modplug->opened)
+ {
+ modplug->mSoundFile->Destroy ();
+ modplug->opened = FALSE;
+ }
+ if (modplug->audiobuffer) g_free (modplug->audiobuffer);
modplug->buffer_in = NULL;
modplug->audiobuffer = NULL;
gst_caps_unref (modplug->streaminfo);
@@ -955,3 +963,7 @@ GstPluginDesc plugin_desc = {
"modplug",
plugin_init
};
+
+
+
+
diff --git a/gst/modplug/gstmodplug.h b/gst/modplug/gstmodplug.h
index 0e8356c8..97d6d00e 100644
--- a/gst/modplug/gstmodplug.h
+++ b/gst/modplug/gstmodplug.h
@@ -78,6 +78,7 @@ struct _GstModPlug {
guint64 song_size;
CSoundFile *mSoundFile;
+ gboolean opened; /* set to TRUE when mSoundFile is created */
};
struct _GstModPlugClass {