[Mplayer-cvslog] CVS: main/libmpcodecs vd_ffmpeg.c,1.7,1.8

Alex Beregszaszi alex at mplayer.dev.hu
Mon Apr 1 19:12:12 CEST 2002


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

Modified Files:
	vd_ffmpeg.c 
Log Message:
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)

Index: vd_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- vd_ffmpeg.c	25 Mar 2002 09:52:15 -0000	1.7
+++ vd_ffmpeg.c	1 Apr 2002 17:12:10 -0000	1.8
@@ -32,7 +32,6 @@
 int avcodec_inited=0;
 
 typedef struct {
-    AVCodec *lavc_codec;
     AVCodecContext *avctx;
     int last_aspect;    
 } vd_ffmpeg_ctx;
@@ -50,6 +49,7 @@
 static int init(sh_video_t *sh){
     AVCodecContext *avctx;
     vd_ffmpeg_ctx *ctx;
+    AVCodec *lavc_codec;
 
     if(!avcodec_inited){
       avcodec_init();
@@ -62,8 +62,8 @@
 	return(0);
     memset(ctx, 0, sizeof(vd_ffmpeg_ctx));
     
-    ctx->lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll);
-    if(!ctx->lavc_codec){
+    lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll);
+    if(!lavc_codec){
 	mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll);
 	return 0;
     }
@@ -78,7 +78,7 @@
     if (sh->format == mmioFOURCC('R', 'V', '1', '3'))
 	avctx->sub_id = 3;
     /* open it */
-    if (avcodec_open(avctx, ctx->lavc_codec) < 0) {
+    if (avcodec_open(avctx, lavc_codec) < 0) {
         mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec);
         return 0;
     }
@@ -136,8 +136,12 @@
 		sh->aspect = 0.0;
 		break;
 	}
-        if (mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12))
-    	    return NULL;
+	/* config only if width && height isn't changed */
+	/* else it will config twice */
+	if ((sh->aspect > 0.01) && (avctx->width == sh->disp_w) &&
+	    (avctx->height == sh->disp_h))
+    	    if (mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12))
+    		return NULL;
     }
     
     if ((avctx->width != sh->disp_w) ||




More information about the MPlayer-cvslog mailing list