mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Fix TTA audio properties reading.
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@740388 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
parent
5506647153
commit
fed2c020fe
@ -273,9 +273,16 @@ void TrueAudio::File::read(bool readProperties, Properties::ReadStyle /* propert
|
||||
// Look for TrueAudio metadata
|
||||
|
||||
if(readProperties) {
|
||||
seek(d->ID3v2Location + d->ID3v2OriginalSize);
|
||||
d->properties = new Properties(readBlock(TrueAudio::HeaderSize),
|
||||
length() - d->ID3v2OriginalSize);
|
||||
if(d->ID3v2Location >= 0) {
|
||||
seek(d->ID3v2Location + d->ID3v2OriginalSize);
|
||||
d->properties = new Properties(readBlock(TrueAudio::HeaderSize),
|
||||
length() - d->ID3v2OriginalSize);
|
||||
}
|
||||
else {
|
||||
seek(0);
|
||||
d->properties = new Properties(readBlock(TrueAudio::HeaderSize),
|
||||
length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ int TrueAudio::Properties::ttaVersion() const
|
||||
|
||||
void TrueAudio::Properties::read()
|
||||
{
|
||||
if(!d->data.startsWith("TrueAudio"))
|
||||
if(!d->data.startsWith("TTA"))
|
||||
return;
|
||||
|
||||
int pos = 3;
|
||||
|
@ -7,6 +7,7 @@ INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2/frames
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/trueaudio
|
||||
)
|
||||
|
||||
SET(test_runner_SRCS
|
||||
@ -15,6 +16,7 @@ SET(test_runner_SRCS
|
||||
test_map.cpp
|
||||
test_mpeg.cpp
|
||||
test_synchdata.cpp
|
||||
test_trueaudio.cpp
|
||||
test_bytevector.cpp
|
||||
test_string.cpp
|
||||
test_fileref.cpp
|
||||
|
@ -1,6 +1,7 @@
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)/taglib\
|
||||
-I$(top_srcdir)/taglib/toolkit \
|
||||
-I$(top_srcdir)/taglib/trueaudio \
|
||||
-I$(top_srcdir)/taglib/mpeg \
|
||||
-I$(top_srcdir)/taglib/mpeg/id3v1 \
|
||||
-I$(top_srcdir)/taglib/mpeg/id3v2 \
|
||||
@ -12,6 +13,7 @@ test_runner_SOURCES = \
|
||||
test_map.cpp \
|
||||
test_mpeg.cpp \
|
||||
test_synchdata.cpp \
|
||||
test_trueaudio.cpp \
|
||||
test_bytevector.cpp \
|
||||
test_string.cpp \
|
||||
test_fileref.cpp \
|
||||
|
26
tests/test_trueaudio.cpp
Normal file
26
tests/test_trueaudio.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <trueaudiofile.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace TagLib;
|
||||
|
||||
class TestTrueAudio : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(TestTrueAudio);
|
||||
CPPUNIT_TEST(testReadPropertiesWithoutID3v2);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
|
||||
void testReadPropertiesWithoutID3v2()
|
||||
{
|
||||
TrueAudio::File f("data/empty.tta");
|
||||
CPPUNIT_ASSERT(f.audioProperties());
|
||||
CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestTrueAudio);
|
Loading…
Reference in New Issue
Block a user