[FFmpeg-devel] [PATCH] mxfenc: fix essence container count value

Matthieu Bouron matthieu.bouron at gmail.com
Wed Oct 24 17:14:54 CEST 2012


Also writes missing multiple essence descriptor ul in essence container.
---
 libavformat/mxfenc.c |   11 +++++++----
 tests/ref/lavf/mxf   |    6 +++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 6a27d2a..c4f8339 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -533,14 +533,16 @@ static void mxf_write_essence_container_refs(AVFormatContext *s)
 {
     MXFContext *c = s->priv_data;
     AVIOContext *pb = s->pb;
-    int i;
+    int i, count = FFMAX(c->essence_container_count - 1, 1);
 
     mxf_write_refs_count(pb, c->essence_container_count);
     av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", c->essence_container_count);
-    for (i = 0; i < c->essence_container_count; i++) {
+    for (i = 0; i < count; i++) {
         MXFStreamContext *sc = s->streams[i]->priv_data;
         avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
     }
+    if (count > 1)
+        avio_write(pb, multiple_desc_ul, 16);
 }
 
 static void mxf_write_preface(AVFormatContext *s)
@@ -1761,9 +1763,10 @@ static int mxf_write_header(AVFormatContext *s)
         present[sc->index]++;
     }
 
-    if (s->oformat == &ff_mxf_d10_muxer) {
+    if (s->oformat == &ff_mxf_d10_muxer)
         mxf->essence_container_count = 1;
-    }
+    else if (mxf->essence_container_count > 1)
+        mxf->essence_container_count++;
 
     if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
         mxf_gen_umid(s);
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index d8aeb4a..3572bbe 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-3fb5387504760db6ebbed106fcda5789 *./tests/data/lavf/lavf.mxf
+c53c9f7ee2091405fbe50374f9055679 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x17ce1069
-830a8b9ee58781bf654c55905067cdae *./tests/data/lavf/lavf.mxf
+14d0ac1513840b670a785daf4331aca8 *./tests/data/lavf/lavf.mxf
 554553 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xa3c0dbc4
-10c6ae1bd97c851728c9abad9dddfa2e *./tests/data/lavf/lavf.mxf
+5636cee18b0f34a5acb33a8efb9f80c6 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x17ce1069
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list