diff --git a/taglib/mp4/mp4atom.cpp b/taglib/mp4/mp4atom.cpp index 26d6d25a..de42d3c4 100644 --- a/taglib/mp4/mp4atom.cpp +++ b/taglib/mp4/mp4atom.cpp @@ -35,9 +35,10 @@ using namespace TagLib; -const char *MP4::Atom::containers[10] = { +const char *MP4::Atom::containers[11] = { "moov", "udta", "mdia", "meta", "ilst", "stbl", "minf", "moof", "traf", "trak", + "stsd" }; MP4::Atom::Atom(File *file) @@ -82,6 +83,9 @@ MP4::Atom::Atom(File *file) if(name == "meta") { file->seek(4, File::Current); } + else if(name == "stsd") { + file->seek(8, File::Current); + } while(file->tell() < offset + length) { MP4::Atom *child = new MP4::Atom(file); children.append(child); diff --git a/taglib/mp4/mp4atom.h b/taglib/mp4/mp4atom.h index 7d9dac28..2c0de3d2 100644 --- a/taglib/mp4/mp4atom.h +++ b/taglib/mp4/mp4atom.h @@ -53,8 +53,8 @@ namespace TagLib { TagLib::ByteVector name; AtomList children; private: - static const int numContainers = 10; - static const char *containers[10]; + static const int numContainers = 11; + static const char *containers[11]; }; //! Root-level atoms diff --git a/taglib/mp4/mp4properties.cpp b/taglib/mp4/mp4properties.cpp index a62bda99..512b66b1 100644 --- a/taglib/mp4/mp4properties.cpp +++ b/taglib/mp4/mp4properties.cpp @@ -40,13 +40,14 @@ using namespace TagLib; class MP4::Properties::PropertiesPrivate { public: - PropertiesPrivate() : length(0), bitrate(0), sampleRate(0), channels(0), bitsPerSample(0) {} + PropertiesPrivate() : length(0), bitrate(0), sampleRate(0), channels(0), bitsPerSample(0), encrypted(false) {} int length; int bitrate; int sampleRate; int channels; int bitsPerSample; + bool encrypted; }; MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style) @@ -129,6 +130,11 @@ MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style) } } } + + MP4::Atom *drms = atom->find("drms"); + if(drms) { + d->encrypted = true; + } } MP4::Properties::~Properties() @@ -166,4 +172,10 @@ MP4::Properties::bitsPerSample() const return d->bitsPerSample; } +bool +MP4::Properties::isEncrypted() const +{ + return d->encrypted; +} + #endif diff --git a/taglib/mp4/mp4properties.h b/taglib/mp4/mp4properties.h index ef813850..7906824d 100644 --- a/taglib/mp4/mp4properties.h +++ b/taglib/mp4/mp4properties.h @@ -48,6 +48,7 @@ namespace TagLib { virtual int sampleRate() const; virtual int channels() const; virtual int bitsPerSample() const; + bool isEncrypted() const; private: class PropertiesPrivate;