summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorDavid Conrad <lessen42@gmail.com>2007-09-05 00:23:06 +0000
committerDavid Conrad <lessen42@gmail.com>2007-09-05 00:23:06 +0000
commitffb880c278a4e28abd785824fe7b10b558f9942f (patch)
tree3293fde0a4b9ff7956f2dce5500719d67d380b06 /libavformat
parent815eb6a2feac389d4e144066bee1c3f3f6be0338 (diff)
Write unknown size if the size given is too large for EBML (greater than 2^56-1)
Originally committed as revision 10309 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroskaenc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 44df0b6744..41b9d6b06a 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -46,11 +46,12 @@ static void put_ebml_id(ByteIOContext *pb, unsigned int id)
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--)