diff avidec.c @ 2877:f0665d1388ad libavformat

Extract aspect ratio from ODML/vprp.
author michael
date Tue, 01 Jan 2008 22:05:51 +0000
parents d52c718e83f9
children 0f8d91124c84
line wrap: on
line diff
--- a/avidec.c	Mon Dec 31 16:49:18 2007 +0000
+++ b/avidec.c	Tue Jan 01 22:05:51 2008 +0000
@@ -523,6 +523,31 @@
             }
             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;