diff options
author | Stefan Kost <ensonic@users.sourceforge.net> | 2007-07-25 05:55:00 +0000 |
---|---|---|
committer | Stefan Kost <ensonic@users.sourceforge.net> | 2007-07-25 05:55:00 +0000 |
commit | 3ff914844181a756f4c27ddd6241edb24f860704 (patch) | |
tree | a3381f0730b959e59cbbbb604857f989a5d3ce76 /ext | |
parent | 9c8ef16a8af5ca68e61f217b023a7f935587255b (diff) | |
download | gst-plugins-bad-3ff914844181a756f4c27ddd6241edb24f860704.tar.gz gst-plugins-bad-3ff914844181a756f4c27ddd6241edb24f860704.tar.bz2 gst-plugins-bad-3ff914844181a756f4c27ddd6241edb24f860704.zip |
ext/timidity/gsttimidity.*: Don't initialize timidity in plugin_init for similar reason as below.
Original commit message from CVS:
* ext/timidity/gsttimidity.c: (gst_timidity_init),
(gst_timidity_change_state), (plugin_init):
* ext/timidity/gsttimidity.h:
Don't initialize timidity in plugin_init for similar reason as below.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/timidity/gsttimidity.c | 29 | ||||
-rw-r--r-- | ext/timidity/gsttimidity.h | 2 |
2 files changed, 18 insertions, 13 deletions
diff --git a/ext/timidity/gsttimidity.c b/ext/timidity/gsttimidity.c index 3b590c90..bbd89c98 100644 --- a/ext/timidity/gsttimidity.c +++ b/ext/timidity/gsttimidity.c @@ -48,6 +48,10 @@ #include "gsttimidity.h" +#ifndef TIMIDITY_CFG +#define TIMIDITY_CFG "/etc/timidity.cfg" +#endif + GST_DEBUG_CATEGORY_STATIC (gst_timidity_debug); #define GST_CAT_DEFAULT gst_timidity_debug @@ -134,6 +138,13 @@ gst_timidity_init (GstTimidity * filter, GstTimidityClass * g_class) { GstElementClass *klass = GST_ELEMENT_GET_CLASS (filter); + /* initialise timidity library */ + if (mid_init (TIMIDITY_CFG) == 0) { + filter->initialized = TRUE; + } else { + GST_WARNING ("can't initialize timidity with config: " TIMIDITY_CFG); + } + filter->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, "sink"), "sink"); @@ -743,6 +754,11 @@ gst_timidity_change_state (GstElement * element, GstStateChange transition) GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstTimidity *timidity = GST_TIMIDITY (element); + if (!timidity->initialized) { + GST_WARNING ("Timidity renderer is not initialized"); + return GST_STATE_CHANGE_FAILURE; + } + switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: timidity->out_caps = @@ -807,19 +823,6 @@ plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (gst_timidity_debug, "timidity", 0, "Timidity plugin"); - /* initialise timidity library, fail loading the plugin if this fails */ -#ifdef TIMIDITY_CFG - if (mid_init (TIMIDITY_CFG) != 0) { - GST_WARNING ("can't initialize timidity with config: " TIMIDITY_CFG); - return FALSE; - } -#else - if (mid_init ("/etc/timidity.cfg") != 0) { - GST_WARNING ("can't initialize timidity with config: /etc/timidity.cfg"); - return FALSE; - } -#endif - if (!gst_type_find_register (plugin, "audio/midi", GST_RANK_PRIMARY, gst_timidity_typefind, exts, gst_caps_new_simple ("audio/midi", NULL), NULL, NULL)) { diff --git a/ext/timidity/gsttimidity.h b/ext/timidity/gsttimidity.h index 0e58b3b6..81e16743 100644 --- a/ext/timidity/gsttimidity.h +++ b/ext/timidity/gsttimidity.h @@ -51,6 +51,8 @@ struct _GstTimidity GstPad *sinkpad, *srcpad; + gboolean initialized; + /* input stream properties */ gint64 mididata_size, mididata_offset; gchar *mididata; |