diff options
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0458844fc3..599c913b35 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4,20 +4,20 @@ * Copyright (c) 2004 Gildas Bazin <gbazin at videolan dot org> * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com> * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -91,6 +91,7 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) } if (equalChunks) { int sSize = track->cluster[0].size/track->cluster[0].entries; + sSize = FFMAX(1, sSize); // adpcm mono case could make sSize == 0 avio_wb32(pb, sSize); // sample size avio_wb32(pb, entries); // sample count } @@ -237,16 +238,9 @@ static int mov_write_enda_tag(AVIOContext *pb) return 10; } -static unsigned int descrLength(unsigned int len) -{ - int i; - for(i=1; len>>(7*i); i++); - return len + 1 + i; -} - static void putDescr(AVIOContext *pb, int tag, unsigned int size) { - int i= descrLength(size) - size - 2; + int i = 3; avio_w8(pb, tag); for(; i>0; i--) avio_w8(pb, (size>>(7*i)) | 0x80); @@ -256,15 +250,14 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size) static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic { int64_t pos = avio_tell(pb); - int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; + int decoderSpecificInfoLen = track->vosLen ? 5+track->vosLen : 0; avio_wb32(pb, 0); // size ffio_wfourcc(pb, "esds"); avio_wb32(pb, 0); // Version // ES descriptor - putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) + - descrLength(1)); + putDescr(pb, 0x03, 3 + 5+13 + decoderSpecificInfoLen + 5+1); avio_wb16(pb, track->trackID); avio_w8(pb, 0x00); // flags (= no flags) @@ -534,7 +527,7 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track) ffio_wfourcc(pb, "ACLR"); ffio_wfourcc(pb, "ACLR"); ffio_wfourcc(pb, "0001"); - avio_wb32(pb, 1); /* yuv 1 / rgb 2 ? */ + avio_wb32(pb, 2); /* yuv range: full 1 / normal 2 */ avio_wb32(pb, 0); /* unknown */ avio_wb32(pb, 24); /* size */ |