summaryrefslogtreecommitdiff
path: root/src/playlist
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-08-15 11:13:39 +0200
committerMax Kellermann <max@musicpd.org>2019-08-15 11:13:39 +0200
commit92c89f0c86b27d2e48f753a68d63ef3c1aad6105 (patch)
tree66e353aa0ec56a99d3998c704b532fd44b1e81d0 /src/playlist
parent34246eb7fd3794306bab5e3e769cf8978c45d451 (diff)
playlist/flac: allow reading from FLAC streams
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/plugins/FlacPlaylistPlugin.cxx21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/playlist/plugins/FlacPlaylistPlugin.cxx b/src/playlist/plugins/FlacPlaylistPlugin.cxx
index a0892aaaf..30793aeac 100644
--- a/src/playlist/plugins/FlacPlaylistPlugin.cxx
+++ b/src/playlist/plugins/FlacPlaylistPlugin.cxx
@@ -29,9 +29,7 @@
#include "lib/xiph/FlacMetadataChain.hxx"
#include "lib/xiph/FlacMetadataIterator.hxx"
#include "song/DetachedSong.hxx"
-#include "fs/Traits.hxx"
-#include "fs/AllocatedPath.hxx"
-#include "fs/NarrowPath.hxx"
+#include "input/InputStream.hxx"
#include "util/RuntimeError.hxx"
#include "util/ScopeExit.hxx"
@@ -66,22 +64,15 @@ ToSongEnumerator(const char *uri,
}
static std::unique_ptr<SongEnumerator>
-flac_playlist_open_uri(const char *uri,
- gcc_unused Mutex &mutex)
+flac_playlist_open_stream(InputStreamPtr &&is)
{
- if (!PathTraitsUTF8::IsAbsolute(uri))
- /* only local files supported */
- return nullptr;
-
- const auto path_fs = AllocatedPath::FromUTF8Throw(uri);
-
- const NarrowPath narrow_path_fs(path_fs);
-
FlacMetadataChain chain;
- if (!chain.Read(narrow_path_fs))
+ if (!chain.Read(*is))
throw FormatRuntimeError("Failed to read FLAC metadata: %s",
chain.GetStatusString());
+ const char *const uri = is->GetURI();
+
FlacMetadataIterator iterator((FLAC__Metadata_Chain *)chain);
unsigned sample_rate = 0;
@@ -120,8 +111,8 @@ const struct playlist_plugin flac_playlist_plugin = {
nullptr,
nullptr,
- flac_playlist_open_uri,
nullptr,
+ flac_playlist_open_stream,
nullptr,
flac_playlist_suffixes,