summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2018-03-21 12:59:11 -0700
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2018-10-12 12:27:43 -0700
commit84e8a87ca082f5a882e83fcb34a970f8b720cc25 (patch)
tree5a3073494cdaf4d2b909957e4cd4215f6161b36b
parentea55a11ced5ef73bc7173ae2d3e268e26b351350 (diff)
avformat/mxfenc: update body partition with footer offset
-rw-r--r--libavformat/mxfenc.c9
-rw-r--r--tests/ref/lavf/mxf6
-rw-r--r--tests/ref/lavf/mxf_d102
-rw-r--r--tests/ref/lavf/mxf_dv252
-rw-r--r--tests/ref/lavf/mxf_dvcpro502
-rw-r--r--tests/ref/lavf/mxf_opatom2
-rw-r--r--tests/ref/lavf/mxf_opatom_audio2
7 files changed, 15 insertions, 10 deletions
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:
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 05deaa3a69..9ad47e7594 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-eea31259441d909fedb9a0e0eb9bbdb2 *./tests/data/lavf/lavf.mxf
+649009e3d3d62eb3b6c56334d057cc4d *./tests/data/lavf/lavf.mxf
526393 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-7524e7319a64b639d6ef49446d46320e *./tests/data/lavf/lavf.mxf
+5025d7f79b638166b787b3cb8364e5d9 *./tests/data/lavf/lavf.mxf
561721 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x96ff1b48
-e547b44d71cd5871582522a31511ae9c *./tests/data/lavf/lavf.mxf
+02bf8f0cd8951a49e277306691cb1538 *./tests/data/lavf/lavf.mxf
526393 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10
index 0b9f49bb09..856fe9c3e9 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@
-9f299fd4da6a20ef93adad7fe6a9f481 *./tests/data/lavf/lavf.mxf_d10
+e597f73ef9c9819710d2f815813eb91f *./tests/data/lavf/lavf.mxf_d10
5332013 ./tests/data/lavf/lavf.mxf_d10
./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488
diff --git a/tests/ref/lavf/mxf_dv25 b/tests/ref/lavf/mxf_dv25
index 200511e164..e94b3ca1ca 100644
--- a/tests/ref/lavf/mxf_dv25
+++ b/tests/ref/lavf/mxf_dv25
@@ -1,3 +1,3 @@
-358791c5468c39673239e038fb64a734 *./tests/data/lavf/lavf.mxf_dv25
+0fc964fa22bc8b3a389b81b9a2efccb3 *./tests/data/lavf/lavf.mxf_dv25
3834413 ./tests/data/lavf/lavf.mxf_dv25
./tests/data/lavf/lavf.mxf_dv25 CRC=0xbdaf7f52
diff --git a/tests/ref/lavf/mxf_dvcpro50 b/tests/ref/lavf/mxf_dvcpro50
index f212c0321d..514a0475c9 100644
--- a/tests/ref/lavf/mxf_dvcpro50
+++ b/tests/ref/lavf/mxf_dvcpro50
@@ -1,3 +1,3 @@
-fac7c59ea81c752d769335ddaa818f90 *./tests/data/lavf/lavf.mxf_dvcpro50
+aa81ea83af44a69e73849e327cc4bd12 *./tests/data/lavf/lavf.mxf_dvcpro50
7431213 ./tests/data/lavf/lavf.mxf_dvcpro50
./tests/data/lavf/lavf.mxf_dvcpro50 CRC=0xe3bbe4b4
diff --git a/tests/ref/lavf/mxf_opatom b/tests/ref/lavf/mxf_opatom
index 5ea47f4df6..cc4eb519ea 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@
-49b0b3dfeb6a9ec024b047fc627b66fd *./tests/data/lavf/lavf.mxf_opatom
+06a1816aa91c733e1ef7e45d82e4f1d3 *./tests/data/lavf/lavf.mxf_opatom
4717625 ./tests/data/lavf/lavf.mxf_opatom
./tests/data/lavf/lavf.mxf_opatom CRC=0xf55aa22a
diff --git a/tests/ref/lavf/mxf_opatom_audio b/tests/ref/lavf/mxf_opatom_audio
index 540f430cda..485964529f 100644
--- a/tests/ref/lavf/mxf_opatom_audio
+++ b/tests/ref/lavf/mxf_opatom_audio
@@ -1,3 +1,3 @@
-862dc5c9f2c94bd2c545ca64f923d1a1 *./tests/data/lavf/lavf.mxf_opatom_audio
+c45bb140605339556a77e751fda2c449 *./tests/data/lavf/lavf.mxf_opatom_audio
102969 ./tests/data/lavf/lavf.mxf_opatom_audio
./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff