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:
parent
ff6a8e2ade
commit
ac5a7c2d82
19
src/decode.c
19
src/decode.c
@ -371,26 +371,27 @@ static void decodeStart(PlayerControl * pc, OutputBuffer * cb,
|
|||||||
while (ret && (plugin = getInputPluginFromSuffix(s, next++))) {
|
while (ret && (plugin = getInputPluginFromSuffix(s, next++))) {
|
||||||
if (!plugin->streamTypes & INPUT_PLUGIN_STREAM_FILE)
|
if (!plugin->streamTypes & INPUT_PLUGIN_STREAM_FILE)
|
||||||
continue;
|
continue;
|
||||||
if (plugin->tryDecodeFunc
|
|
||||||
&& !plugin->tryDecodeFunc(&inStream))
|
if (plugin->tryDecodeFunc &&
|
||||||
|
!plugin->tryDecodeFunc(&inStream))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (plugin->streamDecodeFunc) {
|
if (plugin->fileDecodeFunc) {
|
||||||
ret =
|
|
||||||
plugin->streamDecodeFunc(cb, dc, &inStream);
|
|
||||||
break;
|
|
||||||
} else if (plugin->fileDecodeFunc) {
|
|
||||||
closeInputStream(&inStream);
|
closeInputStream(&inStream);
|
||||||
ret = plugin->fileDecodeFunc(cb, dc, path);
|
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) {
|
if (ret < 0 || ret == DECODE_ERROR_UNKTYPE) {
|
||||||
pathcpy_trunc(pc->erroredUrl, dc->utf8url);
|
pathcpy_trunc(pc->erroredUrl, dc->utf8url);
|
||||||
if (ret != DECODE_ERROR_UNKTYPE)
|
if (ret != DECODE_ERROR_UNKTYPE) {
|
||||||
dc->error = DECODE_ERROR_FILE;
|
dc->error = DECODE_ERROR_FILE;
|
||||||
else {
|
} else {
|
||||||
dc->error = DECODE_ERROR_UNKTYPE;
|
dc->error = DECODE_ERROR_UNKTYPE;
|
||||||
closeInputStream(&inStream);
|
closeInputStream(&inStream);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user