From ac5a7c2d828420445f03d23d15c899d6e4d126ec Mon Sep 17 00:00:00 2001 From: "J. Alexander Treuman" Date: Mon, 25 Jun 2007 13:22:51 +0000 Subject: 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 --- src/decode.c | 19 ++++++++++--------- 1 file 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); } -- cgit v1.2.3