]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dpx.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / dpx.c
index dee5921ef1d2ef67225d305242c444473d0a45f6..6ef2db2299a93b727f2059ea12895c1c7100de62 100644 (file)
@@ -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, 1 };
 
     switch (descriptor) {
         case 51: // RGBA
@@ -241,5 +247,6 @@ AVCodec ff_dpx_decoder = {
     .init           = decode_init,
     .close          = decode_end,
     .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("DPX image"),
 };