Commit 92c89f0c authored by Max Kellermann's avatar Max Kellermann

playlist/flac: allow reading from FLAC streams

parent 34246eb7
...@@ -14,6 +14,8 @@ ver 0.22 (not yet released) ...@@ -14,6 +14,8 @@ ver 0.22 (not yet released)
- mad: remove option "gapless", always do gapless - mad: remove option "gapless", always do gapless
- sidplay: add option "default_genre" - sidplay: add option "default_genre"
- sidplay: map SID name field to "Album" tag - sidplay: map SID name field to "Album" tag
* playlist
- flac: support reading CUE sheets from remote FLAC files
* filter * filter
- ffmpeg: new plugin based on FFmpeg's libavfilter library - ffmpeg: new plugin based on FFmpeg's libavfilter library
- hdcd: new plugin based on FFmpeg's "af_hdcd" for HDCD playback - hdcd: new plugin based on FFmpeg's "af_hdcd" for HDCD playback
......
...@@ -29,9 +29,7 @@ ...@@ -29,9 +29,7 @@
#include "lib/xiph/FlacMetadataChain.hxx" #include "lib/xiph/FlacMetadataChain.hxx"
#include "lib/xiph/FlacMetadataIterator.hxx" #include "lib/xiph/FlacMetadataIterator.hxx"
#include "song/DetachedSong.hxx" #include "song/DetachedSong.hxx"
#include "fs/Traits.hxx" #include "input/InputStream.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/NarrowPath.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
...@@ -66,22 +64,15 @@ ToSongEnumerator(const char *uri, ...@@ -66,22 +64,15 @@ ToSongEnumerator(const char *uri,
} }
static std::unique_ptr<SongEnumerator> static std::unique_ptr<SongEnumerator>
flac_playlist_open_uri(const char *uri, flac_playlist_open_stream(InputStreamPtr &&is)
gcc_unused Mutex &mutex)
{ {
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; FlacMetadataChain chain;
if (!chain.Read(narrow_path_fs)) if (!chain.Read(*is))
throw FormatRuntimeError("Failed to read FLAC metadata: %s", throw FormatRuntimeError("Failed to read FLAC metadata: %s",
chain.GetStatusString()); chain.GetStatusString());
const char *const uri = is->GetURI();
FlacMetadataIterator iterator((FLAC__Metadata_Chain *)chain); FlacMetadataIterator iterator((FLAC__Metadata_Chain *)chain);
unsigned sample_rate = 0; unsigned sample_rate = 0;
...@@ -120,8 +111,8 @@ const struct playlist_plugin flac_playlist_plugin = { ...@@ -120,8 +111,8 @@ const struct playlist_plugin flac_playlist_plugin = {
nullptr, nullptr,
nullptr, nullptr,
flac_playlist_open_uri,
nullptr, nullptr,
flac_playlist_open_stream,
nullptr, nullptr,
flac_playlist_suffixes, flac_playlist_suffixes,
......
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