Detecting DRM protected files

Martijn van Rheenen rheenen at gmail.com
Tue Mar 29 14:28:20 CEST 2011


Thanks for the answers so far. We immediately removed the 'isProtected' from
ID3v2 usage since indeed this does not indicate DRM protection.

Further, I investigated a little bit how to detect DRM protection on
specific files, and indeed, it seems you need to research the file contents
itself, so patching tagLib is unavoidable. As far as I can see, it is only
needed for WMA and MP4 files.

MP3 DRM protection:
Indeed: Non-existant. Sorry about the confusion.

MP4 DRM protection:
Something with a 'drms' atom should be detected, if it's present, the file
is DRM protected. But I can not find proper documentation on the MP4
fileformats to know where to find this atom (I know it should be in the
'moov' atom, but then the info I found stops...)

WMA DRM protection:

In TagLib's asffile.cpp you could add to the list of ByteVector's at the
near-top of the file:
static ByteVector
asfContentEncryptionGuid("\x22\x11\xB3\xFB\xBD\x23\x11\xD2\xB4\xB7\x00\xA0\xC9\x55\xFC\x6E");
static
ByteVector asfExtendedContentEncryptionGuid("\x29\x8A\xE6\x14\x26\x22\x4C\x17\xB9\x35\xDA\xE0\x7E\xE9\x28\x9C");

Then in ASF::File::read():
Change:
else {
  obj = new UnknownObject(guid);
}
To:
else {
  if (guid == contentEncryptionGuid || guid ==
extendedContentEncryptionGuid) {
    d->tag->setDRMProtected(true);
  }
  obj = new UnknownObject(guid);
}

Then in asftag.cpp / asftag.h add these 2 functions:
void ASF::Tag::setDRMProtected(bool value)
{
  setAttribute("WM/DRMProtected", value);
}
bool ASF::Tag::isDRMProtected() const
{
  if(d->attributeListMap.contains("WM/DRMProtected"))
    return d->attributeListMap["WM/DRMProtected"][0].toBool();
  return false;
}

2011/3/29 Lukáš Lalinský <lalinsky at gmail.com>

> On Tue, Mar 29, 2011 at 11:15 AM, Martijn van Rheenen <rheenen at gmail.com>
> wrote:
> > Now, to the real question: I want to be able to detect whether a file is
> DRM
> > protected. So, not only MP3, but also WMA, MP4-based files etc. Is there
> a
> > proven method to find this in a most generic and fast way for a file? Or
> do
> > I have to resort back to file-type-specific code like I had to do for
> Album
> > Art? Note that I just want a 'bool isDRMProtected()' method for this,
> > nothing more.
>
> I think you will have to do some research on this, because TagLib
> doesn't currently expose this kind of information. I wasn't even aware
> that MP3 files can be DRM-protected. For WMA and MP4 it should be
> possible to implement the checks in TagLib, as it has to read the
> internal structures anyway, but I'm afraid that you can't do that
> without patching TagLib. I'm willing to write the necessary code this,
> but I'd need a pointer where to look for the bits and some examples of
> DRM-protected files (I don't have any).
>
> > I already noticed the ID3v2 has a 'isProtected()' method, but don't know
> > whether that means 'DRM protected' or not...
>
> No, it means CRC checksum protection.
>
> Lukas
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110329/3fb96d2b/attachment.htm 


More information about the taglib-devel mailing list