diff options
author | Richard Buteau <rbuteau@rgbnetworks.com> | 2010-09-23 03:40:06 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2010-09-23 03:40:06 +0000 |
commit | 6ac6e3d1237475427ecc448d6cb2d67617687997 (patch) | |
tree | 2133001186c871df4cc594b7cd3acff1664fb0de /libavformat | |
parent | 9c193cc47c99422e5ac912c0c18e412ed84b4712 (diff) | |
download | ffmpeg-6ac6e3d1237475427ecc448d6cb2d67617687997.tar.gz |
Fix aspect ratio for files that have it stored in
ff_asf_extended_content_header.
Fixes issue 690.
Patch by Richard Buteau, rbuteau rgbnetworks com
Originally committed as revision 25158 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/asfdec.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index f219390a4d..e1f3331774 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -467,7 +467,15 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) value_len = get_le16(pb); if (!value_type && value_len%2) value_len += 1; - get_tag(s, name, value_type, value_len); + /** + * My sample has that stream set to 0 maybe that mean the container. + * Asf stream count start at 1. I am using 0 to the container value since it's unused + */ + if (!strcmp(name, "AspectRatioX")){ + dar[0].num= get_value(s->pb, value_type); + } else if(!strcmp(name, "AspectRatioY")){ + dar[0].den= get_value(s->pb, value_type); + } else get_tag(s, name, value_type, value_len); } } else if (!guidcmp(&g, &ff_asf_metadata_header)) { int n, stream_num, name_len, value_len, value_type, value_num; @@ -626,11 +634,16 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st = s->streams[stream_num]; if (!st->codec->bit_rate) st->codec->bit_rate = bitrate[i]; - if (dar[i].num > 0 && dar[i].den > 0) + if (dar[i].num > 0 && dar[i].den > 0){ av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, dar[i].num, dar[i].den, INT_MAX); -//av_log(s, AV_LOG_ERROR, "dar %d:%d sar=%d:%d\n", dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); + } else if ((dar[0].num > 0) && (dar[0].den > 0) && (st->codec->codec_type==CODEC_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set. + av_reduce(&st->sample_aspect_ratio.num, + &st->sample_aspect_ratio.den, + dar[0].num, dar[0].den, INT_MAX); + +//av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); // copy and convert language codes to the frontend if (asf->streams[i].stream_language_index < 128) { |