changeset 1752:12a896fa993b libavformat

Set correct aspect ratio (it's sample aspect, not display aspect) Patch by Zuxy Meng (mail = `echo "Zuxy Meng" | tr "[A-Z] " "[a-z]." | sed "s/$/@gmail.com/"`)
author kostya
date Fri, 02 Feb 2007 14:33:25 +0000
parents b1fb0af4387a
children d0a97c73ee97
files asf.c
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/asf.c	Fri Feb 02 11:19:58 2007 +0000
+++ b/asf.c	Fri Feb 02 14:33:25 2007 +0000
@@ -482,11 +482,9 @@
         int stream_num= asf->asfid2avid[i];
         if(stream_num>=0 && dar[i].num>0 && dar[i].den>0){
             AVCodecContext *codec= s->streams[stream_num]->codec;
-            codec->sample_aspect_ratio=
-                av_div_q(
-                    dar[i],
-                    (AVRational){codec->width, codec->height}
-                );
+            av_reduce(&codec->sample_aspect_ratio.num,
+                    &codec->sample_aspect_ratio.den,
+                    dar[i].num, dar[i].den, INT_MAX);
 //av_log(NULL, AV_LOG_ERROR, "dar %d:%d sar=%d:%d\n", dar[i].num, dar[i].den, codec->sample_aspect_ratio.num, codec->sample_aspect_ratio.den);
         }
     }