aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Lai <frank.franklai@gmail.com>2011-06-09 18:41:43 +0200
committerLukáš Lalinský <lalinsky@gmail.com>2011-06-09 18:41:43 +0200
commit8ed9b0da2cdb2ac870052d4734b622e755430f71 (patch)
tree2159482e8d50f7f4b38da2dc2ef71273954d8eb0
parent93564a2daa1d05739ee8f062575271f8567aaab3 (diff)
Support for reading ALAC audio properties
-rw-r--r--taglib/mp4/mp4properties.cpp8
-rw-r--r--tests/test_mp4.cpp2
2 files changed, 9 insertions, 1 deletions
diff --git a/taglib/mp4/mp4properties.cpp b/taglib/mp4/mp4properties.cpp
index 512b66b1..81beb19f 100644
--- a/taglib/mp4/mp4properties.cpp
+++ b/taglib/mp4/mp4properties.cpp
@@ -130,6 +130,14 @@ MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style)
}
}
}
+ else if (data.mid(20, 4) == "alac") {
+ if (atom->length == 88 && data.mid(56, 4) == "alac") {
+ d->bitsPerSample = data.at(69);
+ d->channels = data.at(73);
+ d->bitrate = data.mid(80, 4).toUInt() / 1000;
+ d->sampleRate = data.mid(84, 4).toUInt();
+ }
+ }
MP4::Atom *drms = atom->find("drms");
if(drms) {
diff --git a/tests/test_mp4.cpp b/tests/test_mp4.cpp
index bedf43ef..14a4df8e 100644
--- a/tests/test_mp4.cpp
+++ b/tests/test_mp4.cpp
@@ -43,7 +43,7 @@ public:
{
MP4::File f(TEST_FILE_PATH_C("empty_alac.m4a"));
CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->length());
- CPPUNIT_ASSERT_EQUAL(3, f.audioProperties()->bitrate());
+ CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->bitrate());
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
CPPUNIT_ASSERT_EQUAL(16, ((MP4::Properties *)f.audioProperties())->bitsPerSample());