aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-01-01 22:05:51 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-01-01 22:05:51 +0000
commitc86ec2f4c38b24fa4cf3bba0fd145366c7e3f53b (patch)
tree55b2a85d212083678ddf54114c19056d63e793d0
parent2576a9ecec5a367d6dd7e9c98bc433e9d29ee6a4 (diff)
downloadffmpeg-c86ec2f4c38b24fa4cf3bba0fd145366c7e3f53b.tar.gz
Extract aspect ratio from ODML/vprp.
Originally committed as revision 11365 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/avidec.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 92994ca713..4b9bcf2a43 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -523,6 +523,31 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
url_fseek(pb, i+size, SEEK_SET);
break;
+ case MKTAG('v', 'p', 'r', 'p'):
+ if(stream_index < (unsigned)s->nb_streams && size > 9*4){
+ AVRational active, active_aspect;
+
+ st = s->streams[stream_index];
+ get_le32(pb);
+ get_le32(pb);
+ get_le32(pb);
+ get_le32(pb);
+ get_le32(pb);
+
+ active_aspect.num= get_le16(pb);
+ active_aspect.den= get_le16(pb);
+ active.num = get_le32(pb);
+ active.den = get_le32(pb);
+ get_le32(pb); //nbFieldsPerFrame
+
+ if(active_aspect.num && active_aspect.den && active.num && active.den){
+ st->codec->sample_aspect_ratio= av_div_q(active_aspect, active);
+//av_log(s, AV_LOG_ERROR, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den);
+ }
+ size -= 9*4;
+ }
+ url_fseek(pb, size, SEEK_CUR);
+ break;
case MKTAG('I', 'N', 'A', 'M'):
avi_read_tag(pb, s->title, sizeof(s->title), size);
break;