[Mplayer-cvslog] CVS: main/libmpcodecs ve_lavc.c,1.78,1.79 vd_ffmpeg.c,1.105,1.106

Michael Niedermayer CVS michael at mplayerhq.hu
Mon Oct 20 23:22:43 CEST 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv21418

Modified Files:
	ve_lavc.c vd_ffmpeg.c 
Log Message:
sample_aspect_ratio


Index: ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- ve_lavc.c	7 Oct 2003 11:45:09 -0000	1.78
+++ ve_lavc.c	20 Oct 2003 21:21:42 -0000	1.79
@@ -445,7 +445,11 @@
 	}
 
 	if (e && ratio > 0.1 && ratio < 10.0) {
+#if LIBAVCODEC_BUILD >= 4687
+	    lavc_venc_context->sample_aspect_ratio= av_d2q(ratio * height / width, 30000);
+#else
 	    lavc_venc_context->aspect_ratio= ratio;
+#endif
 	    mp_dbg(MSGT_MENCODER, MSGL_DBG2, "aspect_ratio: %f\n", ratio);
 	} else {
 	    mp_dbg(MSGT_MENCODER, MSGL_ERR, "aspect ratio: cannot parse \"%s\"\n", lavc_param_aspect);
@@ -453,7 +457,11 @@
 	}
     }
     else if (lavc_param_autoaspect)
+#if LIBAVCODEC_BUILD >= 4687
+	lavc_venc_context->sample_aspect_ratio = av_d2q((float)d_width/d_height*height / width, 30000);
+#else
 	lavc_venc_context->aspect_ratio = (float)d_width/d_height;
+#endif
 
     /* keyframe interval */
     if (lavc_param_keyint >= 0) /* != -1 */

Index: vd_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- vd_ffmpeg.c	9 Oct 2003 21:21:46 -0000	1.105
+++ vd_ffmpeg.c	20 Oct 2003 21:21:42 -0000	1.106
@@ -383,14 +383,19 @@
 static int init_vo(sh_video_t *sh){
     vd_ffmpeg_ctx *ctx = sh->context;
     AVCodecContext *avctx = ctx->avctx;
+#if LIBAVCODEC_BUILD >= 4687
+    float aspect= av_q2d(avctx->sample_aspect_ratio) * avctx->width / avctx->height;
+#else
+    float aspect= avctx->aspect_ratio;
+#endif
 
-    if (avctx->aspect_ratio != ctx->last_aspect ||
+    if ( aspect != ctx->last_aspect ||
 	avctx->width != sh->disp_w ||
 	avctx->height != sh->disp_h ||
 	!ctx->vo_inited)
     {
-	mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", avctx->aspect_ratio);
-        ctx->last_aspect = avctx->aspect_ratio;
+	mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect);
+        ctx->last_aspect = aspect;
 //	if(ctx->last_aspect>=0.01 && ctx->last_aspect<100)
 	if(sh->aspect==0.0)
 	    sh->aspect = ctx->last_aspect;



More information about the MPlayer-cvslog mailing list