diff --git a/src/decoder/Bridge.cxx b/src/decoder/Bridge.cxx index 065da259d..36f991529 100644 --- a/src/decoder/Bridge.cxx +++ b/src/decoder/Bridge.cxx @@ -30,6 +30,8 @@ #include "tag/Tag.hxx" #include "Log.hxx" #include "input/InputStream.hxx" +#include "input/LocalOpen.hxx" +#include "fs/Path.hxx" #include "util/ConstBuffer.hxx" #include "util/StringBuffer.hxx" @@ -49,6 +51,12 @@ DecoderBridge::~DecoderBridge() noexcept assert(current_chunk == nullptr); } +InputStreamPtr +DecoderBridge::OpenLocal(Path path_fs) +{ + return OpenLocalInputStream(path_fs, dc.mutex); +} + bool DecoderBridge::CheckCancelRead() const noexcept { diff --git a/src/decoder/Bridge.hxx b/src/decoder/Bridge.hxx index 0efbb3f55..2f1833b6d 100644 --- a/src/decoder/Bridge.hxx +++ b/src/decoder/Bridge.hxx @@ -1,5 +1,5 @@ /* - * Copyright 2003-2018 The Music Player Daemon Project + * Copyright 2003-2019 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,7 @@ class PcmConvert; struct MusicChunk; class DecoderControl; +class Path; struct Tag; /** @@ -153,6 +154,11 @@ public: std::rethrow_exception(error); } + /** + * Open a local file. + */ + InputStreamPtr OpenLocal(Path path_fs); + /* virtual methods from DecoderClient */ void Ready(AudioFormat audio_format, bool seekable, SignedSongTime duration) override; diff --git a/src/decoder/Thread.cxx b/src/decoder/Thread.cxx index d042c7a5c..6bc1836ec 100644 --- a/src/decoder/Thread.cxx +++ b/src/decoder/Thread.cxx @@ -27,7 +27,6 @@ #include "fs/AllocatedPath.hxx" #include "DecoderAPI.hxx" #include "input/InputStream.hxx" -#include "input/LocalOpen.hxx" #include "input/Registry.hxx" #include "DecoderList.hxx" #include "system/Error.hxx" @@ -347,7 +346,7 @@ decoder_run_file(DecoderBridge &bridge, const char *uri_utf8, Path path_fs) InputStreamPtr input_stream; try { - input_stream = OpenLocalInputStream(path_fs, bridge.dc.mutex); + input_stream = bridge.OpenLocal(path_fs); } catch (const std::system_error &e) { if (IsPathNotFound(e) && /* ENOTDIR means this may be a path inside a