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
This commit is contained in:
J. Alexander Treuman 2007-06-25 13:22:51 +00:00
parent ff6a8e2ade
commit ac5a7c2d82

View File

@ -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);
}