diff --git a/NEWS b/NEWS index 504d14ec7..f97932a09 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ ver 0.20 (not yet released) - pcm: support audio/L16 (RFC 2586) and audio/x-mpd-float - sidplay: faster scanning - wavpack: support DSD (WavPack 5) + - wavpack: archive support * playlist - cue: don't skip pregap - embcue: fix last track diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx index d1dcb42be..cdbda6e1e 100644 --- a/src/decoder/plugins/WavpackDecoderPlugin.cxx +++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx @@ -496,6 +496,24 @@ wavpack_scan_file(Path path_fs, return true; } +static bool +wavpack_scan_stream(InputStream &is, + const TagHandler &handler, void *handler_ctx) +{ + WavpackInput isp(nullptr, is); + auto *wpc = WavpackOpenInput(&mpd_is_reader, &isp, nullptr, + OPEN_DSD_FLAG, 0); + AtScopeExit(wpc) { + WavpackCloseFile(wpc); + }; + + const auto duration = GetDuration(wpc); + if (!duration.IsNegative()) + tag_handler_invoke_duration(handler, handler_ctx, SongTime(duration)); + + return true; +} + static char const *const wavpack_suffixes[] = { "wv", nullptr @@ -513,7 +531,7 @@ const struct DecoderPlugin wavpack_decoder_plugin = { wavpack_streamdecode, wavpack_filedecode, wavpack_scan_file, - nullptr, + wavpack_scan_stream, nullptr, wavpack_suffixes, wavpack_mime_types