aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dpx.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-06-18 11:39:26 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-07-04 18:59:39 +0200
commit8b421fad24acbba69935caf2a2775bd04f8a707a (patch)
tree5704378657cdbf522c79dea03afad52414d363a5 /libavcodec/dpx.c
parent2fc354f90d61f5f1bb75dbdd808a502dec69cf99 (diff)
downloadandroid_external_ffmpeg-8b421fad24acbba69935caf2a2775bd04f8a707a.tar.gz
android_external_ffmpeg-8b421fad24acbba69935caf2a2775bd04f8a707a.tar.bz2
android_external_ffmpeg-8b421fad24acbba69935caf2a2775bd04f8a707a.zip
dpx: sanitize aspect ratio.
Fixes some samples where the ratio is declared as -1/-1.
Diffstat (limited to 'libavcodec/dpx.c')
-rw-r--r--libavcodec/dpx.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index dee5921ef1..76a12aa9b3 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