mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
fluiddec: Move logging init into plugin_init
This is a nicer place to keep it. We also initialize it before touching the drivers. https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/1026
This commit is contained in:
parent
9aa12399a8
commit
e2cefdd6ff
1 changed files with 48 additions and 46 deletions
|
@ -117,33 +117,6 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
#define parent_class gst_fluid_dec_parent_class
|
#define parent_class gst_fluid_dec_parent_class
|
||||||
G_DEFINE_TYPE (GstFluidDec, gst_fluid_dec, GST_TYPE_ELEMENT);
|
G_DEFINE_TYPE (GstFluidDec, gst_fluid_dec, GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
/* fluid_synth log handler */
|
|
||||||
static void
|
|
||||||
gst_fluid_synth_error_log_function (int level, const char *message, void *data)
|
|
||||||
{
|
|
||||||
GST_ERROR ("%s", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fluid_synth_warning_log_function (int level, const char *message,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
GST_WARNING ("%s", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fluid_synth_info_log_function (int level, const char *message, void *data)
|
|
||||||
{
|
|
||||||
GST_INFO ("%s", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_fluid_synth_debug_log_function (int level, const char *message, void *data)
|
|
||||||
{
|
|
||||||
GST_DEBUG ("%s", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* initialize the plugin's class */
|
/* initialize the plugin's class */
|
||||||
static void
|
static void
|
||||||
gst_fluid_dec_class_init (GstFluidDecClass * klass)
|
gst_fluid_dec_class_init (GstFluidDecClass * klass)
|
||||||
|
@ -191,25 +164,6 @@ gst_fluid_dec_class_init (GstFluidDecClass * klass)
|
||||||
"Midi Synthesizer Element", "Wim Taymans <wim.taymans@gmail.com>");
|
"Midi Synthesizer Element", "Wim Taymans <wim.taymans@gmail.com>");
|
||||||
|
|
||||||
gstelement_class->change_state = gst_fluid_dec_change_state;
|
gstelement_class->change_state = gst_fluid_dec_change_state;
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
|
||||||
fluid_set_log_function (FLUID_PANIC,
|
|
||||||
(fluid_log_function_t) gst_fluid_synth_error_log_function, NULL);
|
|
||||||
fluid_set_log_function (FLUID_ERR,
|
|
||||||
(fluid_log_function_t) gst_fluid_synth_warning_log_function, NULL);
|
|
||||||
fluid_set_log_function (FLUID_WARN,
|
|
||||||
(fluid_log_function_t) gst_fluid_synth_warning_log_function, NULL);
|
|
||||||
fluid_set_log_function (FLUID_INFO,
|
|
||||||
(fluid_log_function_t) gst_fluid_synth_info_log_function, NULL);
|
|
||||||
fluid_set_log_function (FLUID_DBG,
|
|
||||||
(fluid_log_function_t) gst_fluid_synth_debug_log_function, NULL);
|
|
||||||
#else
|
|
||||||
fluid_set_log_function (FLUID_PANIC, NULL, NULL);
|
|
||||||
fluid_set_log_function (FLUID_ERR, NULL, NULL);
|
|
||||||
fluid_set_log_function (FLUID_WARN, NULL, NULL);
|
|
||||||
fluid_set_log_function (FLUID_INFO, NULL, NULL);
|
|
||||||
fluid_set_log_function (FLUID_DBG, NULL, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the new element
|
/* initialize the new element
|
||||||
|
@ -726,12 +680,60 @@ gst_fluid_dec_get_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fluid_synth log handler */
|
||||||
|
static void
|
||||||
|
gst_fluid_synth_error_log_function (int level, const char *message, void *data)
|
||||||
|
{
|
||||||
|
GST_ERROR ("%s", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_fluid_synth_warning_log_function (int level, const char *message,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
GST_WARNING ("%s", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_fluid_synth_info_log_function (int level, const char *message, void *data)
|
||||||
|
{
|
||||||
|
GST_INFO ("%s", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_fluid_synth_debug_log_function (int level, const char *message, void *data)
|
||||||
|
{
|
||||||
|
GST_DEBUG ("%s", message);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_fluid_dec_debug, "fluiddec",
|
GST_DEBUG_CATEGORY_INIT (gst_fluid_dec_debug, "fluiddec",
|
||||||
0, "Fluidsynth MIDI decoder plugin");
|
0, "Fluidsynth MIDI decoder plugin");
|
||||||
|
|
||||||
|
/* We modify FluidSynth's global state here; let's hope nobody tries to use
|
||||||
|
* it natively alongside this plugin. */
|
||||||
|
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
fluid_set_log_function (FLUID_PANIC,
|
||||||
|
(fluid_log_function_t) gst_fluid_synth_error_log_function, NULL);
|
||||||
|
fluid_set_log_function (FLUID_ERR,
|
||||||
|
(fluid_log_function_t) gst_fluid_synth_warning_log_function, NULL);
|
||||||
|
fluid_set_log_function (FLUID_WARN,
|
||||||
|
(fluid_log_function_t) gst_fluid_synth_warning_log_function, NULL);
|
||||||
|
fluid_set_log_function (FLUID_INFO,
|
||||||
|
(fluid_log_function_t) gst_fluid_synth_info_log_function, NULL);
|
||||||
|
fluid_set_log_function (FLUID_DBG,
|
||||||
|
(fluid_log_function_t) gst_fluid_synth_debug_log_function, NULL);
|
||||||
|
#else
|
||||||
|
fluid_set_log_function (FLUID_PANIC, NULL, NULL);
|
||||||
|
fluid_set_log_function (FLUID_ERR, NULL, NULL);
|
||||||
|
fluid_set_log_function (FLUID_WARN, NULL, NULL);
|
||||||
|
fluid_set_log_function (FLUID_INFO, NULL, NULL);
|
||||||
|
fluid_set_log_function (FLUID_DBG, NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if GST_HAVE_FLUIDSYNTH_VERSION(1, 1, 9)
|
#if GST_HAVE_FLUIDSYNTH_VERSION(1, 1, 9)
|
||||||
{
|
{
|
||||||
/* Disable all audio drivers so new_fluid_settings() does not probe them.
|
/* Disable all audio drivers so new_fluid_settings() does not probe them.
|
||||||
|
|
Loading…
Reference in a new issue