changeset 3800:3080ef830f93

aspect ratio patch by Rik Snel
author alex
date Thu, 27 Dec 2001 19:54:36 +0000
parents f41bbaebcea3
children 3cea69dda1b3
files libmpdemux/demux_y4m.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_y4m.c	Thu Dec 27 18:53:11 2001 +0000
+++ b/libmpdemux/demux_y4m.c	Thu Dec 27 19:54:36 2001 +0000
@@ -116,7 +116,7 @@
 
 void demux_open_y4m(demuxer_t* demuxer){
     y4m_priv_t* priv = demuxer->priv;
-    y4m_ratio_t framerate;
+    y4m_ratio_t ratio;
     sh_video_t* sh=new_sh_video(demuxer,0);
     int err;
 
@@ -186,13 +186,17 @@
 	    mp_msg(MSGT_DEMUXER, MSGL_FATAL, "error parsing YUV4MPEG header: %s\n", y4m_strerr(err));
 	
 	if(!sh->fps) {
-    	    framerate = y4m_si_get_framerate(priv->si);
-    	    if (framerate.d != 0)
-        	sh->fps=(float)framerate.n/(float)framerate.d;
+    	    ratio = y4m_si_get_framerate(priv->si);
+    	    if (ratio.d != 0)
+        	sh->fps=(float)ratio.n/(float)ratio.d;
     	    else
         	sh->fps=15.0f;
 	}
 	sh->frametime=1.0f/sh->fps;
+	
+	ratio = y4m_si_get_sampleaspect(priv->si);
+	if (ratio.d != 0 && ratio.n != 0)
+	    sh->aspect = (float)ratio.n/(float)ratio.d;
 
 	sh->disp_w = y4m_si_get_width(priv->si);
 	sh->disp_h = y4m_si_get_height(priv->si);
@@ -224,7 +228,7 @@
 
 void demux_close_y4m(demuxer_t *demuxer)
 {
-    y4m_priv_t* priv;
+    y4m_priv_t* priv = demuxer->priv;
     
     if (!priv->is_older)
 	y4m_fini_stream_info(((y4m_priv_t*)demuxer->priv)->si);