[FFmpeg-devel] [PATCH] dpx: sanitize aspect ratio.

Nicolas George nicolas.george at normalesup.org
Thu Jun 28 10:10:54 CEST 2012


Le primidi 1er messidor, an CCXX, Nicolas George a écrit :
> Fixes some samples where the ratio is declared as -1/-1.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavcodec/dpx.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
> index dee5921..76a12aa 100644
> --- a/libavcodec/dpx.c
> +++ b/libavcodec/dpx.c
> @@ -109,6 +109,12 @@ static int decode_frame(AVCodecContext *avctx,
>      buf += 825;
>      avctx->sample_aspect_ratio.num = read32(&buf, endian);
>      avctx->sample_aspect_ratio.den = read32(&buf, endian);
> +    if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0)
> +        av_reduce(&avctx->sample_aspect_ratio.num, &avctx->sample_aspect_ratio.den,
> +                   avctx->sample_aspect_ratio.num,  avctx->sample_aspect_ratio.den,
> +                  0x10000);
> +    else
> +        avctx->sample_aspect_ratio = (AVRational){ 0, 0 };
>  
>      switch (descriptor) {
>          case 51: // RGBA

Ping? I'll apply in a few hours if nobody objects.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120628/97df0bbf/attachment.asc>


More information about the ffmpeg-devel mailing list