From 154aa496e8c18bba3dc10c607987c187f4686ae4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:04 +0200 Subject: added struct decoder The decoder struct should later be made opaque to the decoder plugin, because maintaining a stable struct ABI is quite difficult. The ABI should only consist of a small number of stable functions. --- src/decode.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/decode.c') diff --git a/src/decode.c b/src/decode.c index 628dca14f..4df410e50 100644 --- a/src/decode.c +++ b/src/decode.c @@ -17,6 +17,7 @@ */ #include "decode.h" +#include "decoder_internal.h" #include "player.h" #include "playerData.h" @@ -205,6 +206,7 @@ static void processDecodeInput(int *pause_r, unsigned int *bbp_r, static void decodeStart(void) { + struct decoder decoder; int ret; int close_instream = 1; InputStream inStream; @@ -250,7 +252,7 @@ static void decodeStart(void) if (plugin->tryDecodeFunc && !plugin->tryDecodeFunc(&inStream)) continue; - ret = plugin->streamDecodeFunc(&inStream); + ret = plugin->streamDecodeFunc(&decoder, &inStream); break; } @@ -267,7 +269,8 @@ static void decodeStart(void) if (plugin->tryDecodeFunc && !plugin->tryDecodeFunc(&inStream)) continue; - ret = plugin->streamDecodeFunc(&inStream); + decoder.plugin = plugin; + ret = plugin->streamDecodeFunc(&decoder, &inStream); break; } } @@ -278,7 +281,9 @@ static void decodeStart(void) /* we already know our mp3Plugin supports streams, no * need to check for stream{Types,DecodeFunc} */ if ((plugin = getInputPluginFromName("mp3"))) { - ret = plugin->streamDecodeFunc(&inStream); + decoder.plugin = plugin; + ret = plugin->streamDecodeFunc(&decoder, + &inStream); } } } else { @@ -295,10 +300,13 @@ static void decodeStart(void) if (plugin->fileDecodeFunc) { closeInputStream(&inStream); close_instream = 0; - ret = plugin->fileDecodeFunc(path_max_fs); + decoder.plugin = plugin; + ret = plugin->fileDecodeFunc(&decoder, + path_max_fs); break; } else if (plugin->streamDecodeFunc) { - ret = plugin->streamDecodeFunc(&inStream); + decoder.plugin = plugin; + ret = plugin->streamDecodeFunc(&decoder, &inStream); break; } } -- cgit v1.2.3