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

spyfeng subversion at mplayerhq.hu
Tue Jul 22 18:29:03 CEST 2008


Author: spyfeng
Date: Tue Jul 22 18:29:03 2008
New Revision: 2836

Log:
fix bug in klv_encode_ber_length()
write len as Big Endian


Modified:
   mxf/mxfenc.c

Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c	(original)
+++ mxf/mxfenc.c	Tue Jul 22 18:29:03 2008
@@ -229,6 +229,7 @@ static int klv_encode_ber_length(ByteIOC
 {
     // Determine the best BER size
     int size = 0, i;
+    uint8_t *tmp_buf;
     uint64_t tmp = len;
     if (len < 128) {
         //short form
@@ -245,12 +246,17 @@ static int klv_encode_ber_length(ByteIOC
     // long form
     put_byte(pb, 0x80 + size);
     i = size;
+    tmp_buf = av_mallocz(size);
+    if (!tmp_buf)
+        return -1;
     while(i) {
-        put_byte(pb, len & 0xff);
+        tmp_buf[i - 1] = len & 0xff;
         len >>= 8;
         i--;
     }
-    return size;
+    put_buffer(pb, tmp_buf, size);
+    av_freep(&tmp_buf);
+    return 0;
 }
 
 static int mxf_write_primer_pack(AVFormatContext *s)



More information about the FFmpeg-soc mailing list