[FFmpeg-cvslog] r10309 - trunk/libavformat/matroskaenc.c

conrad subversion
Wed Sep 5 02:23:06 CEST 2007


Author: conrad
Date: Wed Sep  5 02:23:06 2007
New Revision: 10309

Log:
Write unknown size if the size given is too large for EBML (greater than 2^56-1)


Modified:
   trunk/libavformat/matroskaenc.c

Modified: trunk/libavformat/matroskaenc.c
==============================================================================
--- trunk/libavformat/matroskaenc.c	(original)
+++ trunk/libavformat/matroskaenc.c	Wed Sep  5 02:23:06 2007
@@ -46,11 +46,12 @@ static void put_ebml_id(ByteIOContext *p
 static void put_ebml_size(ByteIOContext *pb, uint64_t size, int minbytes)
 {
     int bytes = minbytes;
-    while (size >> (bytes*7 + 7)) bytes++;
 
     // sizes larger than this are currently undefined in EBML
-    // XXX: error condition?
-    if (size > (1ULL<<56)-1) return;
+    // so write "unknown" size
+    size = FFMIN(size, (1ULL<<56)-1);
+
+    while (size >> (bytes*7 + 7)) bytes++;
 
     put_byte(pb, (0x80 >> bytes) | (size >> bytes*8));
     for (bytes -= 1; bytes >= 0; bytes--)




More information about the ffmpeg-cvslog mailing list