diff options
Diffstat (limited to 'test/run_decoder.c')
-rw-r--r-- | test/run_decoder.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/test/run_decoder.c b/test/run_decoder.c index 861720cdb..dd1ecdb67 100644 --- a/test/run_decoder.c +++ b/test/run_decoder.c @@ -17,17 +17,38 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" #include "decoder_list.h" #include "decoder_api.h" +#include "input_init.h" #include "input_stream.h" #include "audio_format.h" #include "pcm_volume.h" +#include "idle.h" #include <glib.h> #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. + */ +void +idle_add(G_GNUC_UNUSED unsigned flags) +{ +} + /** * No-op dummy. */ @@ -53,11 +74,13 @@ decoder_initialized(struct decoder *decoder, G_GNUC_UNUSED bool seekable, G_GNUC_UNUSED float total_time) { + struct audio_format_string af_string; + assert(!decoder->initialized); assert(audio_format_valid(audio_format)); - g_printerr("audio_format=%u:%u:%u\n", audio_format->sample_rate, - audio_format->bits, audio_format->channels); + g_printerr("audio_format=%s\n", + audio_format_to_string(audio_format, &af_string)); decoder->initialized = true; } @@ -115,6 +138,7 @@ decoder_tag(G_GNUC_UNUSED struct decoder *decoder, int main(int argc, char **argv) { + GError *error = NULL; bool ret; const char *decoder_name; struct decoder decoder; @@ -127,7 +151,14 @@ int main(int argc, char **argv) decoder_name = argv[1]; decoder.uri = argv[2]; - input_stream_global_init(); + g_log_set_default_handler(my_log_func, NULL); + + if (!input_stream_global_init(&error)) { + g_warning("%s", error->message); + g_error_free(error); + return 2; + } + decoder_plugin_init_all(); decoder.plugin = decoder_plugin_from_name(decoder_name); |