aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-14 21:26:43 +0100
committerMax Kellermann <max@duempel.org>2009-12-14 21:26:57 +0100
commitbf6258f58266ebdd9766e659ff4d6c80bd17c6d0 (patch)
tree3b65d4db40049910b01feb14f11ec4862b3b0de7
parent8587fcbb93753beadcfcec82679f58f04e63e7b8 (diff)
downloadmpd-bf6258f58266ebdd9766e659ff4d6c80bd17c6d0.tar.gz
mpd-bf6258f58266ebdd9766e659ff4d6c80bd17c6d0.tar.xz
mpd-bf6258f58266ebdd9766e659ff4d6c80bd17c6d0.zip
test/run_{decoder,filter}: implemented GLib log callback
Log to stderr, not to stdout (which broke PCM output).
Diffstat (limited to '')
-rw-r--r--test/run_decoder.c12
-rw-r--r--test/run_filter.c13
2 files changed, 25 insertions, 0 deletions
diff --git a/test/run_decoder.c b/test/run_decoder.c
index 72e0783f0..47cab2aac 100644
--- a/test/run_decoder.c
+++ b/test/run_decoder.c
@@ -30,6 +30,16 @@
#include <assert.h>
#include <unistd.h>
+static void
+my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
+ const gchar *message, G_GNUC_UNUSED gpointer user_data)
+{
+ if (log_domain != NULL)
+ g_printerr("%s: %s\n", log_domain, message);
+ else
+ g_printerr("%s\n", message);
+}
+
/**
* No-op dummy.
*/
@@ -139,6 +149,8 @@ int main(int argc, char **argv)
decoder_name = argv[1];
decoder.uri = argv[2];
+ g_log_set_default_handler(my_log_func, NULL);
+
input_stream_global_init();
decoder_plugin_init_all();
diff --git a/test/run_filter.c b/test/run_filter.c
index 62cafdbc1..c1fb50879 100644
--- a/test/run_filter.c
+++ b/test/run_filter.c
@@ -31,6 +31,16 @@
#include <errno.h>
#include <unistd.h>
+static void
+my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
+ const gchar *message, G_GNUC_UNUSED gpointer user_data)
+{
+ if (log_domain != NULL)
+ g_printerr("%s: %s\n", log_domain, message);
+ else
+ g_printerr("%s\n", message);
+}
+
static const struct config_param *
find_named_config_block(const char *block, const char *name)
{
@@ -87,7 +97,10 @@ int main(int argc, char **argv)
audio_format_init(&audio_format, 44100, SAMPLE_FORMAT_S16, 2);
+ /* initialize GLib */
+
g_thread_init(NULL);
+ g_log_set_default_handler(my_log_func, NULL);
/* read configuration file (mpd.conf) */