diff options
author | Tomas Härdin <tomas.hardin@codemill.se> | 2011-10-07 15:48:00 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-10 17:40:34 +0200 |
commit | d377deaaa3943547191fc63ed4abe28e67f0c425 (patch) | |
tree | d784a45ff068bf6b9ab5cd2d9c41541454771a36 /libavformat/mxfdec.c | |
parent | 4b4a6ebd68ca1d901b291f9bb4f5225daf876b8b (diff) | |
download | ffmpeg-d377deaaa3943547191fc63ed4abe28e67f0c425.tar.gz |
mxfdec: Move FooterPartition to MXFContext and make sure it's never set to zero
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mxfdec.c')
-rw-r--r-- | libavformat/mxfdec.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 92d93f3b37..8ec4a7032d 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -75,7 +75,6 @@ typedef struct { int complete; MXFPartitionType type; uint64_t previous_partition; - uint64_t footer_partition; int index_sid; int body_sid; } MXFPartition; @@ -166,6 +165,7 @@ typedef struct { struct AVAES *aesc; uint8_t *local_tags; int local_tags_count; + uint64_t footer_partition; } MXFContext; enum MXFWrappingScheme { @@ -402,6 +402,7 @@ static int mxf_read_partition_pack(void *arg, ByteIOContext *pb, int tag, int si MXFContext *mxf = arg; MXFPartition *partition; UID op; + uint64_t footer_partition; if (mxf->partitions_count+1 >= UINT_MAX / sizeof(*mxf->partitions)) return AVERROR(ENOMEM); @@ -432,16 +433,26 @@ static int mxf_read_partition_pack(void *arg, ByteIOContext *pb, int tag, int si 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; |