[FFmpeg-devel] [PATCH] Detect Windows Media DRM protected files and display warning

Michael Niedermayer michaelni
Sat Oct 10 01:20:09 CEST 2009


On Fri, Oct 09, 2009 at 02:23:50PM +0200, Daniel G. Taylor wrote:
> On Fri, 2009-10-09 at 14:03 +0200, Benjamin Larsson wrote:
> > In this case decryption is possible if the key is provided. I think it 
> > would be preferable if this message is only printed it there is no key 
> > specified.
> 
> Good point, I wasn't aware FFmpeg could do that. Updated patch attached
> which only displays the messages when AVFormatContext has no decryption
> key set. If a key is set then it's assumed the user knows the content is
> encrypted.
> 
> Take care,
> -- 
> Daniel G. Taylor
> http://programmer-art.org/

>  asf.c    |   12 ++++++++++++
>  asf.h    |    3 +++
>  asfdec.c |   18 ++++++++++++++++++
>  3 files changed, 33 insertions(+)
> 50a00975357f4f584a53e03f8eb42190fdbda237  detect_wmdrm.diff
> Index: libavformat/asfdec.c
> ===================================================================
> --- libavformat/asfdec.c	(revision 20192)
> +++ libavformat/asfdec.c	(working copy)
> @@ -531,6 +531,24 @@
>  #endif
>          } else if (url_feof(pb)) {
>              return -1;
> +        } else if (!guidcmp(&g, &ff_asf_content_encryption)) {
> +            if (!s->keylen) {
> +                av_log(s, AV_LOG_WARNING, "DRM protected stream detected, "
> +                       "decoding will likely fail!\n");

please dont split the string except at \n in the string


> +            }
> +            url_fseek(pb, gsize - 24, SEEK_CUR);
> +        } else if (!guidcmp(&g, &ff_asf_ext_content_encryption)) {
> +            if (!s->keylen) {
> +                av_log(s, AV_LOG_WARNING, "Ext DRM protected stream detected, "
> +                       "decoding will likely fail!\n");
> +            }
> +            url_fseek(pb, gsize - 24, SEEK_CUR);
> +        } else if (!guidcmp(&g, &ff_asf_digital_signature)) {
> +            if (!s->keylen) {
> +                av_log(s, AV_LOG_WARNING, "Digital signature detected, "
> +                       "decoding will likely fail!\n");
> +            }
> +            url_fseek(pb, gsize - 24, SEEK_CUR);
>          } else {
>              url_fseek(pb, gsize - 24, SEEK_CUR);
>          }

theres quite a bit of factorizeable code in there

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091010/fbc5da6a/attachment.pgp>



More information about the ffmpeg-devel mailing list