[FFmpeg-cvslog] r20209 - in trunk/libavformat: asf.c asf.h asfdec.c

cehoyos subversion
Mon Oct 12 01:09:33 CEST 2009


Author: cehoyos
Date: Mon Oct 12 01:09:33 2009
New Revision: 20209

Log:
Detect Windows Media DRM protected files and display warning if no key
was provided.

Patch by Daniel G. Taylor, dan programmer-art org

Modified:
   trunk/libavformat/asf.c
   trunk/libavformat/asf.h
   trunk/libavformat/asfdec.c

Modified: trunk/libavformat/asf.c
==============================================================================
--- trunk/libavformat/asf.c	Sun Oct 11 18:16:08 2009	(r20208)
+++ trunk/libavformat/asf.c	Mon Oct 12 01:09:33 2009	(r20209)
@@ -116,6 +116,18 @@ const ff_asf_guid ff_asf_language_guid =
     0xa9, 0x46, 0x43, 0x7c, 0xe0, 0xef, 0xfc, 0x4b, 0xb2, 0x29, 0x39, 0x3e, 0xde, 0x41, 0x5c, 0x85
 };
 
+const ff_asf_guid ff_asf_content_encryption = {
+    0xfb, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e
+};
+
+const ff_asf_guid ff_asf_ext_content_encryption = {
+    0x14, 0xe6, 0x8a, 0x29, 0x22, 0x26, 0x17, 0x4c, 0xb9, 0x35, 0xda, 0xe0, 0x7e, 0xe9, 0x28, 0x9c
+};
+
+const ff_asf_guid ff_asf_digital_signature = {
+    0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e
+};
+
 const AVMetadataConv ff_asf_metadata_conv[] = {
     { "AlbumArtist", "artist"    },
     { "AlbumTitle" , "album"     },

Modified: trunk/libavformat/asf.h
==============================================================================
--- trunk/libavformat/asf.h	Sun Oct 11 18:16:08 2009	(r20208)
+++ trunk/libavformat/asf.h	Mon Oct 12 01:09:33 2009	(r20209)
@@ -160,6 +160,9 @@ extern const ff_asf_guid ff_asf_ext_stre
 extern const ff_asf_guid ff_asf_metadata_header;
 extern const ff_asf_guid ff_asf_my_guid;
 extern const ff_asf_guid ff_asf_language_guid;
+extern const ff_asf_guid ff_asf_content_encryption;
+extern const ff_asf_guid ff_asf_ext_content_encryption;
+extern const ff_asf_guid ff_asf_digital_signature;
 
 extern const AVMetadataConv ff_asf_metadata_conv[];
 

Modified: trunk/libavformat/asfdec.c
==============================================================================
--- trunk/libavformat/asfdec.c	Sun Oct 11 18:16:08 2009	(r20208)
+++ trunk/libavformat/asfdec.c	Mon Oct 12 01:09:33 2009	(r20209)
@@ -532,6 +532,15 @@ static int asf_read_header(AVFormatConte
         } else if (url_feof(pb)) {
             return -1;
         } else {
+            if (!s->keylen) {
+                if (!guidcmp(&g, &ff_asf_content_encryption)) {
+                    av_log(s, AV_LOG_WARNING, "DRM protected stream detected, decoding will likely fail!\n");
+                } else if (!guidcmp(&g, &ff_asf_ext_content_encryption)) {
+                    av_log(s, AV_LOG_WARNING, "Ext DRM protected stream detected, decoding will likely fail!\n");
+                } else if (!guidcmp(&g, &ff_asf_digital_signature)) {
+                    av_log(s, AV_LOG_WARNING, "Digital signature detected, decoding will likely fail!\n");
+                }
+            }
             url_fseek(pb, gsize - 24, SEEK_CUR);
         }
     }



More information about the ffmpeg-cvslog mailing list