]> granicus.if.org Git - taglib/commitdiff
Untested version of DRM checking in WMA files
authorLukáš Lalinský <lalinsky@gmail.com>
Tue, 29 Mar 2011 13:49:24 +0000 (15:49 +0200)
committerLukáš Lalinský <lalinsky@gmail.com>
Tue, 29 Mar 2011 13:49:24 +0000 (15:49 +0200)
taglib/asf/asffile.cpp
taglib/asf/asfproperties.cpp
taglib/asf/asfproperties.h

index e39f856ff5d7d7f99940ac71af020dbf1703fe49..ff7591c28f7ec7256c34c4352a9472d4e1998ac8 100644 (file)
@@ -69,6 +69,8 @@ static ByteVector extendedContentDescriptionGuid("\x40\xA4\xD0\xD2\x07\xE3\xD2\x
 static ByteVector headerExtensionGuid("\xb5\x03\xbf_.\xa9\xcf\x11\x8e\xe3\x00\xc0\x0c Se", 16);
 static ByteVector metadataGuid("\xEA\xCB\xF8\xC5\xAF[wH\204g\xAA\214D\xFAL\xCA", 16);
 static ByteVector metadataLibraryGuid("\224\034#D\230\224\321I\241A\x1d\x13NEpT", 16);
+static ByteVector contentEncryptionGuid("\x22\x11\xB3\xFB\xBD\x23\x11\xD2\xB4\xB7\x00\xA0\xC9\x55\xFC\x6E");
+static ByteVector extendedContentEncryptionGuid("\x29\x8A\xE6\x14\x26\x22\x4C\x17\xB9\x35\xDA\xE0\x7E\xE9\x28\x9C");
 
 class ASF::File::BaseObject
 {
@@ -337,6 +339,9 @@ void ASF::File::HeaderExtensionObject::parse(ASF::File *file, uint /*size*/)
       obj = new MetadataLibraryObject();
     }
     else {
+      if(guid == contentEncryptionGuid || guid == extendedContentEncryptionGuid) {
+        file->d->properties->setEncrypted(true);
+      }
       obj = new UnknownObject(guid);
     }
     obj->parse(file, size);
index 02d2d942afb9ee8de4be43c84e1c4ed616c97f49..6597de1323b9c24af02e2d1c18670a0287295299 100644 (file)
@@ -38,11 +38,12 @@ using namespace TagLib;
 class ASF::Properties::PropertiesPrivate
 {
 public:
-  PropertiesPrivate(): length(0), bitrate(0), sampleRate(0), channels(0) {}
+  PropertiesPrivate(): length(0), bitrate(0), sampleRate(0), channels(0), encrypted(false) {}
   int length;
   int bitrate;
   int sampleRate;
   int channels;
+  bool encrypted;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -80,6 +81,11 @@ int ASF::Properties::channels() const
   return d->channels;
 } 
 
+bool ASF::Properties::isEncrypted() const
+{
+  return d->encrypted;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // private members
 ////////////////////////////////////////////////////////////////////////////////
@@ -104,4 +110,9 @@ void ASF::Properties::setChannels(int length)
   d->channels = length;
 }
 
+void ASF::Properties::setEncrypted(bool encrypted)
+{
+  d->encrypted = encrypted;
+}
+
 #endif
index 290eac7727bf58718f161b7bae339724dcc119ee..ca7b581d03939916f2d5eb8edc57430ec39866c7 100644 (file)
@@ -54,12 +54,14 @@ namespace TagLib {
       virtual int bitrate() const;
       virtual int sampleRate() const;
       virtual int channels() const;
+      bool isEncrypted() const;
 
 #ifndef DO_NOT_DOCUMENT
       void setLength(int value);
       void setBitrate(int value);
       void setSampleRate(int value);
       void setChannels(int value);
+      void setEncrypted(bool value);
 #endif
 
     private: