diff options
author | Max Kellermann <max@duempel.org> | 2009-06-19 08:09:13 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-06-19 08:09:13 +0200 |
commit | 2536b0da83cfc9ff2eb1fc8d5d4950cb08370d94 (patch) | |
tree | 42e4479ad2987eea08cf52974dd3a0858a311d4f /src/decoder_thread.c | |
parent | d5ddecb15a72aeb2beea4963af914ee828ce032b (diff) | |
download | mpd-2536b0da83cfc9ff2eb1fc8d5d4950cb08370d94.tar.gz mpd-2536b0da83cfc9ff2eb1fc8d5d4950cb08370d94.tar.xz mpd-2536b0da83cfc9ff2eb1fc8d5d4950cb08370d94.zip |
decoder_thread: reopen the stream after file_decode() has failed
When decoding a local file, the decoder thread tries to run all
matching decoders, until one succeeds. Both file_decode() and
stream_decode() can decode a stream, but MPD closes the stream before
calling file_decode(). Problem is: when this decoder fails, and the
next's stream_decode() method is invoked, the input_stream is still
closed. This patch reopens it.
Diffstat (limited to 'src/decoder_thread.c')
-rw-r--r-- | src/decoder_thread.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c index c649f3a34..2b1a6299a 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -186,6 +186,17 @@ static void decoder_run_song(const struct song *song, const char *uri) if (ret) break; } else if (plugin->stream_decode != NULL) { + if (!close_instream) { + /* the input_stream object has + been closed before + decoder_file_decode() - + reopen it */ + if (input_stream_open(&input_stream, uri)) + close_instream = true; + else + continue; + } + ret = decoder_stream_decode(plugin, &decoder, &input_stream); if (ret) |