From 544bcbe903062c421861b216decc177d41dd9815 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 9 Dec 2016 22:09:32 +0100 Subject: [PATCH] decoder/wavpack: use WavpackGetNumSamples64() if available --- src/decoder/plugins/WavpackDecoderPlugin.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx index 80c75e2d4..1a8775765 100644 --- a/src/decoder/plugins/WavpackDecoderPlugin.cxx +++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx @@ -53,10 +53,18 @@ gcc_pure static SignedSongTime GetDuration(WavpackContext *wpc) { +#ifdef OPEN_DSD_AS_PCM + /* libWavPack 5 */ + const auto n_samples = WavpackGetNumSamples64(wpc); + if (n_samples == -1) + /* unknown */ + return SignedSongTime::Negative(); +#else const uint32_t n_samples = WavpackGetNumSamples(wpc); if (n_samples == uint32_t(-1)) /* unknown */ return SignedSongTime::Negative(); +#endif return SongTime::FromScale(n_samples, WavpackGetSampleRate(wpc));