From e6ed2da856ec02f3982af4017f20ff873dde0485 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 18 Aug 2010 01:40:54 +0200 Subject: Dynamically select decoder using decoder_find(). --- commands.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'commands.c') diff --git a/commands.c b/commands.c index dd32a7c..38d760f 100644 --- a/commands.c +++ b/commands.c @@ -197,10 +197,17 @@ static void commands_get_mp3(GSocketConnection *connection, const gchar *cmd) { g_string_free(string, TRUE); - extern const struct decoder_plugin decoder_mpg123_decoder; + const struct decoder_plugin *decoder = decoder_find(path); extern const struct encoder_plugin encoder_lame_encoder; - transcode((GInputStream*)is, &decoder_mpg123_decoder, os, &encoder_lame_encoder); + if(decoder == NULL) { + g_warning("no suitable decoder found"); + goto commands_get_mp3_file_unref; + } else { + g_debug("using decoder %s", decoder->name); + } + + transcode((GInputStream*)is, decoder, os, &encoder_lame_encoder); commands_get_mp3_file_unref: -- cgit v1.2.3