changeset 3100:5f769b20cc76 libavformat

Store aspect ratio in avis.
author michael
date Sun, 02 Mar 2008 19:51:31 +0000
parents b74cbb146e2d
children 83537aac00f1
files avienc.c
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/avienc.c	Sat Mar 01 02:28:47 2008 +0000
+++ b/avienc.c	Sun Mar 02 19:51:31 2008 +0000
@@ -283,6 +283,38 @@
             end_tag(pb, avi->indexes[i].indx_start);
         }
 
+        if(   stream->codec_type == CODEC_TYPE_VIDEO
+           && stream->sample_aspect_ratio.num>0
+           && stream->sample_aspect_ratio.den>0){
+            int vprp= start_tag(pb, "vprp");
+            AVRational dar = av_mul_q(stream->sample_aspect_ratio,
+                                      (AVRational){stream->width, stream->height});
+            int num, den;
+            av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
+
+            put_le32(pb, 0); //video format  = unknown
+            put_le32(pb, 0); //video standard= unknown
+            put_le32(pb, lrintf(1.0/av_q2d(stream->time_base)));
+            put_le32(pb, stream->width );
+            put_le32(pb, stream->height);
+            put_le16(pb, num);
+            put_le16(pb, den);
+            put_le32(pb, stream->width );
+            put_le32(pb, stream->height);
+            put_le32(pb, 1); //progressive FIXME
+
+            put_le32(pb, stream->height);
+            put_le32(pb, stream->width );
+            put_le32(pb, stream->height);
+            put_le32(pb, stream->width );
+            put_le32(pb, 0);
+            put_le32(pb, 0);
+
+            put_le32(pb, 0);
+            put_le32(pb, 0);
+            end_tag(pb, vprp);
+        }
+
         end_tag(pb, list2);
     }