diff options
author | Max Kellermann <max@duempel.org> | 2014-07-11 22:09:35 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-07-11 22:09:35 +0200 |
commit | c4bea3dfe45622fcb4de21cd52fc28deb85335f0 (patch) | |
tree | 3ed978e6180f793f7cf0cc39be0e4f79fc8e065b /src | |
parent | eaa9a1e33bd729560cec42abbdf3ef3902a7cb6f (diff) | |
download | mpd-c4bea3dfe45622fcb4de21cd52fc28deb85335f0.tar.gz mpd-c4bea3dfe45622fcb4de21cd52fc28deb85335f0.tar.xz mpd-c4bea3dfe45622fcb4de21cd52fc28deb85335f0.zip |
decoder/sndfile: implement scan_stream() instead of scan_file()
Diffstat (limited to '')
-rw-r--r-- | src/decoder/plugins/SndfileDecoderPlugin.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/decoder/plugins/SndfileDecoderPlugin.cxx b/src/decoder/plugins/SndfileDecoderPlugin.cxx index 90a52b7f0..c656302f9 100644 --- a/src/decoder/plugins/SndfileDecoderPlugin.cxx +++ b/src/decoder/plugins/SndfileDecoderPlugin.cxx @@ -234,21 +234,22 @@ static constexpr struct { }; static bool -sndfile_scan_file(Path path_fs, - const struct tag_handler *handler, void *handler_ctx) +sndfile_scan_stream(InputStream &is, + const struct tag_handler *handler, void *handler_ctx) { SF_INFO info; info.format = 0; - SNDFILE *const sf = sf_open(path_fs.c_str(), SFM_READ, &info); + SndfileInputStream sis{nullptr, is}; + SNDFILE *const sf = sf_open_virtual(&vio, SFM_READ, &info, &sis); if (sf == nullptr) return false; if (!audio_valid_sample_rate(info.samplerate)) { sf_close(sf); FormatWarning(sndfile_domain, - "Invalid sample rate in %s", path_fs.c_str()); + "Invalid sample rate in %s", is.GetURI()); return false; } @@ -299,8 +300,8 @@ const struct DecoderPlugin sndfile_decoder_plugin = { nullptr, sndfile_stream_decode, nullptr, - sndfile_scan_file, nullptr, + sndfile_scan_stream, nullptr, sndfile_suffixes, sndfile_mime_types, |