mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Check for the presence of the drms atom in MP4 files
This commit is contained in:
parent
8f42d5b594
commit
97cd58bc65
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -48,6 +48,7 @@ namespace TagLib {
|
||||
virtual int sampleRate() const;
|
||||
virtual int channels() const;
|
||||
virtual int bitsPerSample() const;
|
||||
bool isEncrypted() const;
|
||||
|
||||
private:
|
||||
class PropertiesPrivate;
|
||||
|
Loading…
Reference in New Issue
Block a user