aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2007-06-25 13:22:51 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2007-06-25 13:22:51 +0000
commitac5a7c2d828420445f03d23d15c899d6e4d126ec (patch)
tree0836853b71c760184f495d42ba3980a5303961d3 /src/decode.c
parentff6a8e2ade2a2f23fde798fd2673ff8efaa863c9 (diff)
downloadmpd-ac5a7c2d828420445f03d23d15c899d6e4d126ec.tar.gz
mpd-ac5a7c2d828420445f03d23d15c899d6e4d126ec.tar.xz
mpd-ac5a7c2d828420445f03d23d15c899d6e4d126ec.zip
decode: prefer fileDecodeFunc over streamDecodeFunc for files
Only wavpack implements both fileDecodeFunc and streamDecodeFunc, and it's fileDecodeFunc provides more functionality. So try using that first. This commit also fixes a bug where the plugin test loop wouldn't break once a suitable plugin was found if it used fileDecodeFunc. git-svn-id: https://svn.musicpd.org/mpd/trunk@6655 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/decode.c')
-rw-r--r--src/decode.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/decode.c b/src/decode.c
index d0e3f8a3d..e64be35b4 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -371,26 +371,27 @@ static void decodeStart(PlayerControl * pc, OutputBuffer * cb,
while (ret && (plugin = getInputPluginFromSuffix(s, next++))) {
if (!plugin->streamTypes & INPUT_PLUGIN_STREAM_FILE)
continue;
- if (plugin->tryDecodeFunc
- && !plugin->tryDecodeFunc(&inStream))
+
+ if (plugin->tryDecodeFunc &&
+ !plugin->tryDecodeFunc(&inStream))
continue;
- if (plugin->streamDecodeFunc) {
- ret =
- plugin->streamDecodeFunc(cb, dc, &inStream);
- break;
- } else if (plugin->fileDecodeFunc) {
+ if (plugin->fileDecodeFunc) {
closeInputStream(&inStream);
ret = plugin->fileDecodeFunc(cb, dc, path);
+ break;
+ } else if (plugin->streamDecodeFunc) {
+ ret = plugin->streamDecodeFunc(cb, dc, &inStream);
+ break;
}
}
}
if (ret < 0 || ret == DECODE_ERROR_UNKTYPE) {
pathcpy_trunc(pc->erroredUrl, dc->utf8url);
- if (ret != DECODE_ERROR_UNKTYPE)
+ if (ret != DECODE_ERROR_UNKTYPE) {
dc->error = DECODE_ERROR_FILE;
- else {
+ } else {
dc->error = DECODE_ERROR_UNKTYPE;
closeInputStream(&inStream);
}