diff options
author | Tomas Härdin <tomas.hardin@codemill.se> | 2011-10-07 15:48:00 +0200 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-01-22 14:40:52 +0100 |
commit | 83ab10f6e9559be3420af1a26c36d6bec0496e89 (patch) | |
tree | 97d7649ebb7323d57f8aac3afc96628052adabd8 /libavformat/mxfdec.c | |
parent | 3359246d9a47c3f4418d994853efe17324a0159b (diff) | |
download | ffmpeg-83ab10f6e9559be3420af1a26c36d6bec0496e89.tar.gz |
mxfdec: Move FooterPartition to MXFContext and make sure it is never zero.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
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 44dca69b1f..b63c0c9b1e 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; |