mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Do not miss frames when an extended header is present (#1081)
This commit is contained in:
parent
e21640bf10
commit
97203503b0
@ -784,7 +784,6 @@ void ID3v2::Tag::parse(const ByteVector &origData)
|
||||
d->extendedHeader->setData(data);
|
||||
if(d->extendedHeader->size() <= data.size()) {
|
||||
frameDataPosition += d->extendedHeader->size();
|
||||
frameDataLength -= d->extendedHeader->size();
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
tests/data/extended-header.mp3
Normal file
BIN
tests/data/extended-header.mp3
Normal file
Binary file not shown.
@ -34,6 +34,7 @@
|
||||
#include <mpegproperties.h>
|
||||
#include <xingheader.h>
|
||||
#include <mpegheader.h>
|
||||
#include <id3v2extendedheader.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "utils.h"
|
||||
|
||||
@ -66,6 +67,7 @@ class TestMPEG : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testEmptyID3v1);
|
||||
CPPUNIT_TEST(testEmptyAPE);
|
||||
CPPUNIT_TEST(testIgnoreGarbage);
|
||||
CPPUNIT_TEST(testExtendedHeader);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -535,6 +537,28 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void testExtendedHeader()
|
||||
{
|
||||
const ScopedFileCopy copy("extended-header", ".mp3");
|
||||
{
|
||||
MPEG::File f(copy.fileName().c_str());
|
||||
CPPUNIT_ASSERT(f.isValid());
|
||||
CPPUNIT_ASSERT(f.hasID3v2Tag());
|
||||
ID3v2::Tag *tag = f.ID3v2Tag();
|
||||
ID3v2::ExtendedHeader *ext = tag->extendedHeader();
|
||||
CPPUNIT_ASSERT(ext);
|
||||
CPPUNIT_ASSERT_EQUAL(12U, ext->size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Druids"), tag->title());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Excelsis"), tag->artist());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Vo Chrieger U Drache"), tag->album());
|
||||
CPPUNIT_ASSERT_EQUAL(2013U, tag->year());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Folk/Power Metal"), tag->genre());
|
||||
CPPUNIT_ASSERT_EQUAL(3U, tag->track());
|
||||
CPPUNIT_ASSERT_EQUAL(String("2013"),
|
||||
f.properties().value("ORIGINALDATE").front());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestMPEG);
|
||||
|
Loading…
x
Reference in New Issue
Block a user