]> granicus.if.org Git - taglib/commitdiff
Support for reading ALAC audio properties
authorFrank Lai <frank.franklai@gmail.com>
Thu, 9 Jun 2011 16:41:43 +0000 (18:41 +0200)
committerLukáš Lalinský <lalinsky@gmail.com>
Thu, 9 Jun 2011 16:41:43 +0000 (18:41 +0200)
taglib/mp4/mp4properties.cpp
tests/test_mp4.cpp

index 512b66b1b92ceb4ffb3f68f4ab9781b9dd639ce1..81beb19fc993bc9e405696eea5e7e0dac8665dbd 100644 (file)
@@ -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) {
index bedf43ef0a733a8d0fb7ff4e75050af13098f586..14a4df8e81a8fd43e169c816725cc092ae089647 100644 (file)
@@ -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());