[FFmpeg-soc] [soc]: r272 - matroska/matroskaenc.c

conrad subversion at mplayerhq.hu
Mon Jun 25 02:15:59 CEST 2007


Author: conrad
Date: Mon Jun 25 02:15:59 2007
New Revision: 272

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

Modified:
   matroska/matroskaenc.c

Modified: matroska/matroskaenc.c
==============================================================================
--- matroska/matroskaenc.c	(original)
+++ matroska/matroskaenc.c	Mon Jun 25 02:15:59 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-soc mailing list