From 84e8a87ca082f5a882e83fcb34a970f8b720cc25 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Wed, 21 Mar 2018 12:59:11 -0700 Subject: avformat/mxfenc: update body partition with footer offset --- libavformat/mxfenc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libavformat') diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index a62d2a3e94..b34ab8ba47 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1938,7 +1938,7 @@ static int mxf_write_partition(AVFormatContext *s, int bodysid, else avio_write(pb, body_partition_key, 16); - klv_encode_ber_length(pb, 88 + 16LL * DESCRIPTOR_COUNT(mxf->essence_container_count)); + klv_encode_ber4_length(pb, 88 + 16LL * DESCRIPTOR_COUNT(mxf->essence_container_count)); // write partition value avio_wb16(pb, 1); // majorVersion @@ -2905,7 +2905,7 @@ static int mxf_write_footer(AVFormatContext *s) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; - int err = 0; + int i, err = 0; if (!mxf->header_written || (s->oformat == &ff_mxf_opatom_muxer && !mxf->body_partition_offset)) { @@ -2949,6 +2949,11 @@ static int mxf_write_footer(AVFormatContext *s) if ((err = mxf_write_partition(s, 0, 0, header_closed_partition_key, 1)) < 0) goto end; } + // update footer partition offset + for (i = 0; i < mxf->body_partitions_count; i++) { + avio_seek(pb, mxf->body_partition_offset[i]+44, SEEK_SET); + avio_wb64(pb, mxf->footer_partition_offset); + } } end: -- cgit v1.2.1