* Fixed constructing String from ByteVector.
* Fixed compilation on MSVC with the /Zc:wchar_t- option.
* Fixed detecting of RIFF files with invalid chunk sizes.
+ * Added TagLib::MP4::PropertyMap::codec().
TagLib 1.9 (Oct 6, 2013)
========================
class MP4::Properties::PropertiesPrivate
{
public:
- PropertiesPrivate() : length(0), bitrate(0), sampleRate(0), channels(0), bitsPerSample(0), encrypted(false) {}
+ PropertiesPrivate() : length(0), bitrate(0), sampleRate(0), channels(0), bitsPerSample(0), encrypted(false), codec(MP4::Properties::Unknown) {}
int length;
int bitrate;
int channels;
int bitsPerSample;
bool encrypted;
+ Codec codec;
};
MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style)
file->seek(atom->offset);
data = file->readBlock(atom->length);
if(data.mid(20, 4) == "mp4a") {
+ d->codec = AAC;
d->channels = data.toShort(40U);
d->bitsPerSample = data.toShort(42U);
d->sampleRate = data.toUInt(46U);
}
else if (data.mid(20, 4) == "alac") {
if (atom->length == 88 && data.mid(56, 4) == "alac") {
+ d->codec = ALAC;
d->bitsPerSample = data.at(69);
- d->channels = data.at(73);
- d->bitrate = data.toUInt(80U) / 1000;
- d->sampleRate = data.toUInt(84U);
+ d->channels = data.at(73);
+ d->bitrate = data.toUInt(80U) / 1000;
+ d->sampleRate = data.toUInt(84U);
}
}
return d->encrypted;
}
+MP4::Properties::Codec MP4::Properties::codec() const
+{
+ return d->codec;
+}
+
class TAGLIB_EXPORT Properties : public AudioProperties
{
public:
+ enum Codec {
+ Unknown = 0,
+ AAC,
+ ALAC
+ };
+
Properties(File *file, Atoms *atoms, ReadStyle style = Average);
virtual ~Properties();
virtual int bitsPerSample() const;
bool isEncrypted() const;
+ //! Audio codec used in the MP4 file
+ Codec codec() const;
+
private:
class PropertiesPrivate;
PropertiesPrivate *d;
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
CPPUNIT_ASSERT_EQUAL(16, ((MP4::Properties *)f.audioProperties())->bitsPerSample());
+ CPPUNIT_ASSERT_EQUAL(MP4::Properties::AAC, ((MP4::Properties *)f.audioProperties())->codec());
}
void testPropertiesALAC()
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
CPPUNIT_ASSERT_EQUAL(16, ((MP4::Properties *)f.audioProperties())->bitsPerSample());
+ CPPUNIT_ASSERT_EQUAL(MP4::Properties::ALAC, ((MP4::Properties *)f.audioProperties())->codec());
}
void testCheckValid()