Skip unknown MP4 boxes (#1231)

This commit is contained in:
Stephen Booth
2024-05-17 23:45:10 -05:00
committed by GitHub
parent 3d4428726e
commit f3fb4d83a4
3 changed files with 20 additions and 7 deletions

Binary file not shown.

View File

@ -101,6 +101,7 @@ class TestMP4 : public CppUnit::TestFixture
CPPUNIT_TEST(testRemoveMetadata);
CPPUNIT_TEST(testNonFullMetaAtom);
CPPUNIT_TEST(testItemFactory);
CPPUNIT_TEST(testNonPrintableAtom);
CPPUNIT_TEST_SUITE_END();
public:
@ -847,6 +848,25 @@ public:
CPPUNIT_ASSERT_EQUAL(StringList("456"), properties.value("TESTINTEGER"));
}
}
void testNonPrintableAtom()
{
ScopedFileCopy copy("nonprintable-atom-type", ".m4a");
{
MP4::File f(copy.fileName().c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->channels());
CPPUNIT_ASSERT_EQUAL(32000, f.audioProperties()->sampleRate());
f.tag()->setTitle("TITLE");
f.save();
}
{
MP4::File f(copy.fileName().c_str());
CPPUNIT_ASSERT(f.isValid());
CPPUNIT_ASSERT(f.hasMP4Tag());
CPPUNIT_ASSERT_EQUAL(String("TITLE"), f.tag()->title());
}
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestMP4);