Bug 258016 - Zero length and bitrate for certain WavPack files
Summary: Zero length and bitrate for certain WavPack files
Status: RESOLVED FIXED
Alias: None
Product: taglib
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 1.6.3
Platform: Compiled Sources Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-26 21:09 UTC by Tim De Baets
Modified: 2010-11-28 16:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim De Baets 2010-11-26 21:09:22 UTC
Version:           1.6.3 (using Devel) 
OS:                MS Windows

A user of my WMP Tag Plus plug-in has reported that the track length for his WavPack files isn't shown. After some testing, this looks like a problem with TagLib: the supplied tagreader example doesn't show length and bitrate for such a file either. I also tested with the latest revision, 1191982, same result there.

Other than that, the file seems valid - it can be played back, and tags, sample rate, and channels are reported correctly.

Lukas, I will send you the download link to this file. Please let me know if you received it, and what your findings on it are.

Reproducible: Always
Comment 1 Lukáš Lalinský 2010-11-27 08:35:27 UTC
It turns out this is completely valid. The specification allows the total_samples header field to be "empty" (represented as 0xFFFFFF), which means unknown length. This file does have the header field set this way, so there is no way to determine the length without actually decoding the file.

http://www.wavpack.com/file_format.txt
Comment 2 Tim De Baets 2010-11-27 15:35:21 UTC
Too bad, guess I will have to tell the user to create the WavPack files with a different application then, or to report this to that application's developers (provided that he created the file himself, and didn't download it).

I noticed that dBpoweramp's Audio Properties tab in the file's properties does show the correct length, so I'm still wondering how it does that. Do you think that it decodes the file?
Comment 3 Lukáš Lalinský 2010-11-27 19:47:34 UTC
Actually, I'll try something else. The file format specification suggests that the WavPack decoder can seek to the end of the file to determine the length somehow. I'll check the code to see how it does that.
Comment 4 Lukáš Lalinský 2010-11-27 20:14:00 UTC
Ok, so I was wrong. What I can do is to find the last block and its block_index + block_samples should be the total samples in the file. I'm not sure what is the best way to find the last block, as I don't know its size, but I'll try to come up with something.
Comment 5 Lukáš Lalinský 2010-11-27 21:58:56 UTC
SVN commit 1201476 by lalinsky:

Fix reading of WavPack streams without a length information in the header

When the WavPack's total_samples header fiels contains -1, try to find
the final block and get the number of samples from there as
block_index + block_samples.

BUG:258016


 M  +2 -0      NEWS  
 M  +1 -2      taglib/wavpack/wavpackfile.cpp  
 M  +50 -1     taglib/wavpack/wavpackproperties.cpp  
 M  +10 -0     taglib/wavpack/wavpackproperties.h  
 M  +2 -0      tests/CMakeLists.txt  
 M  +4 -2      tests/Makefile.am  
 AM            tests/data/no_length.wv  
 A             tests/test_wavpack.cpp   [License: UNKNOWN]


WebSVN link: http://websvn.kde.org/?view=rev&revision=1201476
Comment 6 Tim De Baets 2010-11-28 16:19:38 UTC
Works great now, thanks :)