diff libmpcodecs/vd_ffmpeg.c @ 11194:c9a3a1e70263

sample_aspect_ratio
author michael
date Mon, 20 Oct 2003 21:21:42 +0000
parents cc5944174c46
children 3761aff4722e
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Mon Oct 20 16:58:15 2003 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Mon Oct 20 21:21:42 2003 +0000
@@ -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;