Commit 8fef4af7 authored by Max Kellermann's avatar Max Kellermann

decoder/Bridge: add method OpenLocal()

parent cfb678d6
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "input/LocalOpen.hxx"
#include "fs/Path.hxx"
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
...@@ -49,6 +51,12 @@ DecoderBridge::~DecoderBridge() noexcept ...@@ -49,6 +51,12 @@ DecoderBridge::~DecoderBridge() noexcept
assert(current_chunk == nullptr); assert(current_chunk == nullptr);
} }
InputStreamPtr
DecoderBridge::OpenLocal(Path path_fs)
{
return OpenLocalInputStream(path_fs, dc.mutex);
}
bool bool
DecoderBridge::CheckCancelRead() const noexcept DecoderBridge::CheckCancelRead() const noexcept
{ {
......
/* /*
* Copyright 2003-2018 The Music Player Daemon Project * Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
class PcmConvert; class PcmConvert;
struct MusicChunk; struct MusicChunk;
class DecoderControl; class DecoderControl;
class Path;
struct Tag; struct Tag;
/** /**
...@@ -153,6 +154,11 @@ public: ...@@ -153,6 +154,11 @@ public:
std::rethrow_exception(error); std::rethrow_exception(error);
} }
/**
* Open a local file.
*/
InputStreamPtr OpenLocal(Path path_fs);
/* virtual methods from DecoderClient */ /* virtual methods from DecoderClient */
void Ready(AudioFormat audio_format, void Ready(AudioFormat audio_format,
bool seekable, SignedSongTime duration) override; bool seekable, SignedSongTime duration) override;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "DecoderAPI.hxx" #include "DecoderAPI.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "input/LocalOpen.hxx"
#include "input/Registry.hxx" #include "input/Registry.hxx"
#include "DecoderList.hxx" #include "DecoderList.hxx"
#include "system/Error.hxx" #include "system/Error.hxx"
...@@ -347,7 +346,7 @@ decoder_run_file(DecoderBridge &bridge, const char *uri_utf8, Path path_fs) ...@@ -347,7 +346,7 @@ decoder_run_file(DecoderBridge &bridge, const char *uri_utf8, Path path_fs)
InputStreamPtr input_stream; InputStreamPtr input_stream;
try { try {
input_stream = OpenLocalInputStream(path_fs, bridge.dc.mutex); input_stream = bridge.OpenLocal(path_fs);
} catch (const std::system_error &e) { } catch (const std::system_error &e) {
if (IsPathNotFound(e) && if (IsPathNotFound(e) &&
/* ENOTDIR means this may be a path inside a /* ENOTDIR means this may be a path inside a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment