[FFmpeg-devel] [PATCH] Don't write an illegal stsz when sample size is larger than sample count.

Baptiste Coudurier baptiste.coudurier
Mon Feb 14 09:09:33 CET 2011


On 2/13/11 10:24 PM, Alex Converse wrote:
> Fixes MS ADPCM and IMA ADPCM WAV in mov.
> 
> Output plays correctly in QuickTime.
> 
> 
> 0001-Don-t-write-an-illegal-stsz-when-sample-size-is-larg.patch
> 
> 
> From f6c8d74c311da572cba98555f10c84736fef4959 Mon Sep 17 00:00:00 2001
> From: Alex Converse <alex.converse at gmail.com>
> Date: Sun, 13 Feb 2011 22:20:56 -0800
> Subject: [PATCH] Don't write an illegal stsz when sample size is larger than sample count.
> MIME-Version: 1.0
> Content-Type: multipart/mixed; boundary="------------1"
> 
> This is a multi-part message in MIME format.
> --------------1
> Content-Type: text/plain; charset=UTF-8; format=fixed
> Content-Transfer-Encoding: 8bit
> 
> 
> This fixes mono ADPCM MS and ADPCM IMA WAV in mov.
> ---
>  libavformat/movenc.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> 
> --------------1
> Content-Type: text/x-patch; name="0001-Don-t-write-an-illegal-stsz-when-sample-size-is-larg.patch"
> Content-Transfer-Encoding: 8bit
> Content-Disposition: attachment; filename="0001-Don-t-write-an-illegal-stsz-when-sample-size-is-larg.patch"
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 5e6e3a6..d9cd885 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -90,6 +90,7 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track)
>      }
>      if (equalChunks) {
>          int sSize = track->cluster[0].size/track->cluster[0].entries;
> +        sSize = FFMAX(sSize, 1);
>          put_be32(pb, sSize); // sample size
>          put_be32(pb, entries); // sample count
>      }

Patch is ok, although a comment explaining why this is happening would
be nice, this can only happen in the adpcm case.

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list