mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
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 git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1201476 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
@ -18,6 +18,7 @@ INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/vorbis
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/flac
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/flac
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/wavpack
|
||||
)
|
||||
|
||||
SET(test_runner_SRCS
|
||||
@ -42,6 +43,7 @@ SET(test_runner_SRCS
|
||||
test_ape.cpp
|
||||
test_apetag.cpp
|
||||
test_wav.cpp
|
||||
test_wavpack.cpp
|
||||
)
|
||||
IF(WITH_MP4)
|
||||
SET(test_runner_SRCS ${test_runner_SRCS}
|
||||
|
@ -12,7 +12,8 @@ INCLUDES = \
|
||||
-I$(top_srcdir)/taglib/flac \
|
||||
-I$(top_srcdir)/taglib/riff \
|
||||
-I$(top_srcdir)/taglib/riff/aiff \
|
||||
-I$(top_srcdir)/taglib/mpeg/id3v2/frames
|
||||
-I$(top_srcdir)/taglib/mpeg/id3v2/frames \
|
||||
-I$(top_srcdir)/taglib/wavpack
|
||||
|
||||
test_runner_SOURCES = \
|
||||
main.cpp \
|
||||
@ -32,7 +33,8 @@ test_runner_SOURCES = \
|
||||
test_aiff.cpp \
|
||||
test_ogg.cpp \
|
||||
test_oggflac.cpp \
|
||||
test_flac.cpp
|
||||
test_flac.cpp \
|
||||
test_wavpack.cpp
|
||||
|
||||
if build_tests
|
||||
TESTS = test_runner
|
||||
|
BIN
tests/data/no_length.wv
Normal file
BIN
tests/data/no_length.wv
Normal file
Binary file not shown.
28
tests/test_wavpack.cpp
Normal file
28
tests/test_wavpack.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <wavpackfile.h>
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace TagLib;
|
||||
|
||||
class TestWavPack : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(TestWavPack);
|
||||
CPPUNIT_TEST(testLengthScan);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
|
||||
void testLengthScan()
|
||||
{
|
||||
WavPack::File f("data/no_length.wv");
|
||||
CPPUNIT_ASSERT_EQUAL(4, f.audioProperties()->length());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestWavPack);
|
Reference in New Issue
Block a user