[FFmpeg-soc] [soc]: r3449 - mxf/mxfenc.c

spyfeng subversion at mplayerhq.hu
Mon Aug 18 18:06:11 CEST 2008


Author: spyfeng
Date: Mon Aug 18 18:06:10 2008
New Revision: 3449

Log:
fix bug for writing essence container refs.
we should get the count of the reference before writing the refs at the fisrt time, because we should make the BER encoded length.


Modified:
   mxf/mxfenc.c

Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c	(original)
+++ mxf/mxfenc.c	Mon Aug 18 18:06:10 2008
@@ -273,16 +273,18 @@ static int mxf_write_essence_container_r
     // set the count of essence container for caculating the size of the references in other metadata sets
     if (!mxf->essence_container_count)
         mxf->essence_container_count = count;
-
-    mxf_write_refs_count(pb, count);
-    for (i = 0; i < count; i++) {
-        put_buffer(pb, ff_mxf_essence_container_uls[essence_container_ul_sign[i]].uid, 16);
-    }
+    else {
+        mxf_write_refs_count(pb, count);
+        for (i = 0; i < count; i++) {
+            put_buffer(pb, ff_mxf_essence_container_uls[essence_container_ul_sign[i]].uid, 16);
+        }
 #ifdef DEBUG
-    av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", count);
-    for (i = 0; i < count; i++)
-        PRINT_KEY(s, "essence container ul:\n", ff_mxf_essence_container_uls[essence_container_ul_sign[i]].uid);
+        av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", count);
+        for (i = 0; i < count; i++)
+            PRINT_KEY(s, "essence container ul:\n", ff_mxf_essence_container_uls[essence_container_ul_sign[i]].uid);
 #endif
+    }
+
     return 0;
 }
 
@@ -805,6 +807,8 @@ static void mxf_write_partition(AVFormat
     ByteIOContext *pb = s->pb;
     // write klv
     put_buffer(pb, key, 16);
+    if (!mxf->essence_container_count)
+        mxf_write_essence_container_refs(s);
     klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count);
 
     // write partition value



More information about the FFmpeg-soc mailing list