If we are parsing forward the Previous partition is immediately known, if we are parsing backwards set it to the partition header.
Reported-By: Jean Baptiste Kempf <[email protected]> --- libavformat/mxfdec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 8c780ac..0566939 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -478,6 +478,23 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size avio_read(pb, op, sizeof(UID)); nb_essence_containers = avio_rb32(pb); + if (partition->this_partition && + partition->previous_partition == partition->this_partition) { + av_log(mxf->fc, AV_LOG_ERROR, + "PreviousPartition equal to ThisPartition %"PRIx64"\n", + partition->previous_partition); + if (!mxf->parsing_backward && mxf->last_forward_partition) { + MXFPartition *prev = + mxf->partitions + mxf->last_forward_partition - 2; + partition->previous_partition = prev->this_partition; + } + if (partition->previous_partition == partition->this_partition); + partition->previous_partition = 0; + av_log(mxf->fc, AV_LOG_ERROR, + "Overriding PreviousPartition with %"PRIx64"\n", + partition->previous_partition); + } + /* some files don'thave FooterPartition set in every partition */ if (footer_partition) { if (mxf->footer_partition && mxf->footer_partition != footer_partition) { -- 1.8.5.1 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
