changeset 2492:cdd7d0f4d93c libavformat

Calculate and store DAR rather than SAR
author conrad
date Wed, 05 Sep 2007 00:25:07 +0000
parents 51d707a515f2
children 61bc7a789851
files matroskaenc.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/matroskaenc.c	Wed Sep 05 00:25:04 2007 +0000
+++ b/matroskaenc.c	Wed Sep 05 00:25:07 2007 +0000
@@ -552,8 +552,9 @@
                 put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width);
                 put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, codec->height);
                 if (codec->sample_aspect_ratio.num) {
-                    put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , codec->sample_aspect_ratio.num);
-                    put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, codec->sample_aspect_ratio.den);
+                    AVRational dar = av_mul_q(codec->sample_aspect_ratio, (AVRational){codec->width, codec->height});
+                    put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , dar.num);
+                    put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, dar.den);
                 }
                 end_ebml_master(pb, subinfo);
                 break;