playlist/flac: allow reading from FLAC streams
This commit is contained in:
parent
34246eb7fd
commit
92c89f0c86
2
NEWS
2
NEWS
|
@ -14,6 +14,8 @@ ver 0.22 (not yet released)
|
|||
- mad: remove option "gapless", always do gapless
|
||||
- sidplay: add option "default_genre"
|
||||
- sidplay: map SID name field to "Album" tag
|
||||
* playlist
|
||||
- flac: support reading CUE sheets from remote FLAC files
|
||||
* filter
|
||||
- ffmpeg: new plugin based on FFmpeg's libavfilter library
|
||||
- hdcd: new plugin based on FFmpeg's "af_hdcd" for HDCD playback
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue