[Ffmpeg-devel] [PATCH] dumping support for encrypted MXFs

Reimar Döffinger Reimar.Doeffinger
Tue Jan 9 19:47:23 CET 2007


Hello,
attached patch would at least allow dumping of encrypted streams with
MPlayer's -dumpvideo/-dumpaudio.
This is not too useful and a bit hackish (since there is no indication
whether we have an encrypted stream or not), but on the other hand it
still seems like an improvement over the current treatment (mxf_read_header
parses the file until EOF).

Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libavformat/mxf.c
===================================================================
--- libavformat/mxf.c	(revision 7422)
+++ libavformat/mxf.c	(working copy)
@@ -173,6 +173,7 @@
 /* partial keys to match */
 static const uint8_t mxf_header_partition_pack_key[]       = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
 static const uint8_t mxf_essence_element_key[]             = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
+static const uint8_t mxf_enc_essence_element_key[]         = { 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01 };
 
 #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
 
@@ -261,7 +262,8 @@
 #ifdef DEBUG
         PRINT_KEY("read packet", klv.key);
 #endif
-        if (IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
+        if (IS_KLV_KEY(klv.key, mxf_essence_element_key) ||
+            IS_KLV_KEY(klv.key, mxf_enc_essence_element_key)) {
             int index = mxf_get_stream_index(s, &klv);
             if (index < 0) {
                 av_log(s, AV_LOG_ERROR, "error getting stream index\n");
@@ -982,7 +984,8 @@
 #ifdef DEBUG
         PRINT_KEY("read header", klv.key);
 #endif
-        if (IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
+        if (IS_KLV_KEY(klv.key, mxf_essence_element_key) ||
+            IS_KLV_KEY(klv.key, mxf_enc_essence_element_key)) {
             /* FIXME avoid seek */
             url_fseek(&s->pb, klv.offset, SEEK_SET);
             break;
@@ -1062,7 +1065,8 @@
     seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
     url_fseek(&s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
     if (!mxf_read_sync(&s->pb, mxf_essence_element_key, 12))
-        return -1;
+        if (!mxf_read_sync(&s->pb, mxf_enc_essence_element_key, 12))
+            return -1;
 
     /* found KLV key */
     url_fseek(&s->pb, -12, SEEK_CUR);



More information about the ffmpeg-devel mailing list