aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:04 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:04 +0200
commit154aa496e8c18bba3dc10c607987c187f4686ae4 (patch)
tree32a2a35f74e823c5eea21bbfbebef1297fe6e989 /src/decode.c
parent241cd043ca4f9dd560e6d947a9bf025f58de4ea9 (diff)
downloadmpd-154aa496e8c18bba3dc10c607987c187f4686ae4.tar.gz
mpd-154aa496e8c18bba3dc10c607987c187f4686ae4.tar.xz
mpd-154aa496e8c18bba3dc10c607987c187f4686ae4.zip
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.
Diffstat (limited to '')
-rw-r--r--src/decode.c18
1 files changed, 13 insertions, 5 deletions
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;
}
}