diff options
author | Max Kellermann <max@duempel.org> | 2014-10-02 21:48:52 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-10-02 21:48:52 +0200 |
commit | 20346b0da454a114a9eb3dc99fcdf5f984d45240 (patch) | |
tree | d8edb3254a720f2d84e82ef97031edb208f717cd /src | |
parent | e0e65cbdf9a82b6fe8b99aa310ccc50946826cb8 (diff) | |
download | mpd-20346b0da454a114a9eb3dc99fcdf5f984d45240.tar.gz mpd-20346b0da454a114a9eb3dc99fcdf5f984d45240.tar.xz mpd-20346b0da454a114a9eb3dc99fcdf5f984d45240.zip |
DecoderThread: use OpenLocalInputStream() for local files
Diffstat (limited to '')
-rw-r--r-- | src/decoder/DecoderThread.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/decoder/DecoderThread.cxx b/src/decoder/DecoderThread.cxx index b2b41b661..257a0d4ae 100644 --- a/src/decoder/DecoderThread.cxx +++ b/src/decoder/DecoderThread.cxx @@ -30,6 +30,7 @@ #include "fs/AllocatedPath.hxx" #include "DecoderAPI.hxx" #include "input/InputStream.hxx" +#include "input/LocalOpen.hxx" #include "DecoderList.hxx" #include "util/UriUtil.hxx" #include "util/Error.hxx" @@ -107,6 +108,24 @@ decoder_input_stream_open(DecoderControl &dc, const char *uri) return is; } +static InputStream * +decoder_input_stream_open(DecoderControl &dc, Path path) +{ + Error error; + + InputStream *is = OpenLocalInputStream(path, dc.mutex, dc.cond, error); + if (is == nullptr) { + if (error.IsDefined()) + LogError(error); + + return nullptr; + } + + assert(is->IsReady()); + + return is; +} + static bool decoder_stream_decode(const DecoderPlugin &plugin, Decoder &decoder, @@ -308,7 +327,7 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix, dc.Unlock(); } else if (plugin.stream_decode != nullptr) { InputStream *input_stream = - decoder_input_stream_open(dc, path_fs.c_str()); + decoder_input_stream_open(dc, path_fs); if (input_stream == nullptr) return false; |