Add support for AIFF-C files.

This commit is contained in:
Tsuda Kageyu
2014-12-30 23:53:40 +09:00
parent be33389884
commit 3b8c7d4e3a
6 changed files with 74 additions and 5 deletions

BIN
tests/data/alaw.aifc Normal file

Binary file not shown.

BIN
tests/data/segfault.aif Normal file

Binary file not shown.

View File

@ -13,6 +13,8 @@ class TestAIFF : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestAIFF);
CPPUNIT_TEST(testReading);
CPPUNIT_TEST(testAiffCProperties);
CPPUNIT_TEST(testReading);
CPPUNIT_TEST_SUITE_END();
public:
@ -27,6 +29,24 @@ public:
delete f;
}
void testAiffCProperties()
{
ScopedFileCopy copy("alaw", ".aifc");
string filename = copy.fileName();
RIFF::AIFF::File *f = new RIFF::AIFF::File(filename.c_str());
CPPUNIT_ASSERT(f->audioProperties()->isAiffC());
CPPUNIT_ASSERT_EQUAL(ByteVector("ALAW"), f->audioProperties()->compressionType());
CPPUNIT_ASSERT_EQUAL(String("SGI CCITT G.711 A-law"), f->audioProperties()->compressionName());
delete f;
}
void testFuzzedFiles()
{
RIFF::AIFF::File f(TEST_FILE_PATH_C("segfault.aif"));
CPPUNIT_ASSERT(!f.isValid());
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestAIFF);