decoder_thread: fix CUE track playback

The patch "input/file: don't fall back to parent directory" introduced
a regression: when trying to play a CUE track, decoder_run_song()
tries to open the file as a stream first, but this fails, because the
path is virtual.

This patch fixes decoder_run_song() (instead of reverting the previous
patch) to accept input_stream_open() failures if the song is a local
file.  It passes the responsibility to handle non-existing files to
the decoder's file_decode() method.
This commit is contained in:
Max Kellermann 2010-01-16 19:20:11 +01:00
parent 777bd7c1e1
commit 90d16af66a
2 changed files with 11 additions and 5 deletions

1
NEWS
View File

@ -4,6 +4,7 @@ ver 0.15.8 (2009/??/??)
* decoders: * decoders:
- ffmpeg, flac, vorbis: added more flac/vorbis MIME types - ffmpeg, flac, vorbis: added more flac/vorbis MIME types
* dbUtils: return empty tag value only if no value was found * dbUtils: return empty tag value only if no value was found
* decoder_thread: fix CUE track playback
ver 0.15.7 (2009/12/27) ver 0.15.7 (2009/12/27)

View File

@ -89,7 +89,8 @@ static void decoder_run_song(const struct song *song, const char *uri)
struct input_stream input_stream; struct input_stream input_stream;
const struct decoder_plugin *plugin; const struct decoder_plugin *plugin;
if (!input_stream_open(&input_stream, uri)) { close_instream = input_stream_open(&input_stream, uri);
if (!close_instream && !song_is_file(song)) {
dc.state = DECODE_STATE_ERROR; dc.state = DECODE_STATE_ERROR;
return; return;
} }
@ -108,7 +109,7 @@ static void decoder_run_song(const struct song *song, const char *uri)
/* wait for the input stream to become ready; its metadata /* wait for the input stream to become ready; its metadata
will be available then */ will be available then */
while (!input_stream.ready) { while (close_instream && !input_stream.ready) {
if (dc.command == DECODE_COMMAND_STOP) { if (dc.command == DECODE_COMMAND_STOP) {
input_stream_close(&input_stream); input_stream_close(&input_stream);
dc.state = DECODE_STATE_STOP; dc.state = DECODE_STATE_STOP;
@ -124,7 +125,8 @@ static void decoder_run_song(const struct song *song, const char *uri)
} }
if (dc.command == DECODE_COMMAND_STOP) { if (dc.command == DECODE_COMMAND_STOP) {
input_stream_close(&input_stream); if (close_instream)
input_stream_close(&input_stream);
dc.state = DECODE_STATE_STOP; dc.state = DECODE_STATE_STOP;
return; return;
} }
@ -179,8 +181,11 @@ static void decoder_run_song(const struct song *song, const char *uri)
const char *s = uri_get_suffix(uri); const char *s = uri_get_suffix(uri);
while ((plugin = decoder_plugin_from_suffix(s, next++))) { while ((plugin = decoder_plugin_from_suffix(s, next++))) {
if (plugin->file_decode != NULL) { if (plugin->file_decode != NULL) {
input_stream_close(&input_stream); if (close_instream) {
close_instream = false; input_stream_close(&input_stream);
close_instream = false;
}
ret = decoder_file_decode(plugin, ret = decoder_file_decode(plugin,
&decoder, uri); &decoder, uri);
if (ret) if (ret)