Mercurial > libavformat.hg
comparison asf.c @ 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 | ea10bb05b839 |
children | b090df664f0d |
comparison
equal
deleted
inserted
replaced
1751:b1fb0af4387a | 1752:12a896fa993b |
---|---|
480 | 480 |
481 for(i=0; i<128; i++){ | 481 for(i=0; i<128; i++){ |
482 int stream_num= asf->asfid2avid[i]; | 482 int stream_num= asf->asfid2avid[i]; |
483 if(stream_num>=0 && dar[i].num>0 && dar[i].den>0){ | 483 if(stream_num>=0 && dar[i].num>0 && dar[i].den>0){ |
484 AVCodecContext *codec= s->streams[stream_num]->codec; | 484 AVCodecContext *codec= s->streams[stream_num]->codec; |
485 codec->sample_aspect_ratio= | 485 av_reduce(&codec->sample_aspect_ratio.num, |
486 av_div_q( | 486 &codec->sample_aspect_ratio.den, |
487 dar[i], | 487 dar[i].num, dar[i].den, INT_MAX); |
488 (AVRational){codec->width, codec->height} | |
489 ); | |
490 //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); | 488 //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); |
491 } | 489 } |
492 } | 490 } |
493 | 491 |
494 return 0; | 492 return 0; |