[FFmpeg-cvslog] mxfdec: Move FooterPartition to MXFContext and make sure it is never zero.

Tomas Härdin git at videolan.org
Mon Jan 23 01:18:10 CET 2012


ffmpeg | branch: master | Tomas Härdin <tomas.hardin at codemill.se> | Fri Oct  7 15:48:00 2011 +0200| [83ab10f6e9559be3420af1a26c36d6bec0496e89] | committer: Janne Grunau

mxfdec: Move FooterPartition to MXFContext and make sure it is never zero.

Signed-off-by: Janne Grunau <janne-libav at jannau.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=83ab10f6e9559be3420af1a26c36d6bec0496e89
---

 libavformat/mxfdec.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 44dca69..b63c0c9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -76,7 +76,6 @@ typedef struct {
     int complete;
     MXFPartitionType type;
     uint64_t previous_partition;
-    uint64_t footer_partition;
     int index_sid;
     int body_sid;
 } MXFPartition;
@@ -167,6 +166,7 @@ typedef struct {
     struct AVAES *aesc;
     uint8_t *local_tags;
     int local_tags_count;
+    uint64_t footer_partition;
 } MXFContext;
 
 enum MXFWrappingScheme {
@@ -413,6 +413,7 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
     MXFContext *mxf = arg;
     MXFPartition *partition;
     UID op;
+    uint64_t footer_partition;
 
     if (mxf->partitions_count+1 >= UINT_MAX / sizeof(*mxf->partitions))
         return AVERROR(ENOMEM);
@@ -443,16 +444,26 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
     partition->complete = uid[14] > 2;
     avio_skip(pb, 16);
     partition->previous_partition = avio_rb64(pb);
-    partition->footer_partition = avio_rb64(pb);
+    footer_partition = avio_rb64(pb);
     avio_skip(pb, 16);
     partition->index_sid = avio_rb32(pb);
     avio_skip(pb, 8);
     partition->body_sid = avio_rb32(pb);
     avio_read(pb, op, sizeof(UID));
 
+    /* some files don'thave FooterPartition set in every partition */
+    if (footer_partition) {
+        if (mxf->footer_partition && mxf->footer_partition != footer_partition) {
+            av_log(mxf->fc, AV_LOG_ERROR, "inconsistent FooterPartition value: %li != %li\n",
+                   mxf->footer_partition, footer_partition);
+        } else {
+            mxf->footer_partition = footer_partition;
+        }
+    }
+
     av_dlog(mxf->fc, "PartitionPack: PreviousPartition = 0x%lx, "
             "FooterPartition = 0x%lx, IndexSID = %i, BodySID = %i\n",
-            partition->previous_partition, partition->footer_partition,
+            partition->previous_partition, footer_partition,
             partition->index_sid, partition->body_sid);
 
     if      (op[12] == 1 && op[13] == 1) mxf->op = OP1a;



More information about the ffmpeg-cvslog mailing list