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.
This commit is contained in:
Stefan Kost 2007-07-25 05:55:00 +00:00
parent 9c8ef16a8a
commit 3ff9148441
3 changed files with 25 additions and 14 deletions

View file

@ -1,3 +1,10 @@
2007-07-25 Stefan Kost <ensonic@users.sf.net>
* 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.
2007-07-24 Stefan Kost <ensonic@users.sf.net>
* ext/timidity/gstwildmidi.c: (wildmidi_open_config),
@ -2923,7 +2930,6 @@
* ext/faad/gstfaad.c:
Make our hacks dependent on the fadd lib in use.
2007-02-11 Stefan Kost <ensonic@users.sf.net>
* configure.ac:

View file

@ -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)) {

View file

@ -51,6 +51,8 @@ struct _GstTimidity
GstPad *sinkpad, *srcpad;
gboolean initialized;
/* input stream properties */
gint64 mididata_size, mididata_offset;
gchar *mididata;