[Mplayer-cvslog] CVS: main/libmpcodecs vf_lavc.c,1.6,1.7

Arpi of Ize arpi at mplayerhq.hu
Wed Oct 23 00:25:34 CEST 2002


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

Modified Files:
	vf_lavc.c 
Log Message:
- using avcodec_alloc_context()
- fixed 10l bug (double free() ) causing random mem corruption...


Index: vf_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_lavc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- vf_lavc.c	10 Sep 2002 22:18:32 -0000	1.6
+++ vf_lavc.c	22 Oct 2002 22:25:17 -0000	1.7
@@ -26,12 +26,12 @@
 struct vf_priv_s {
     unsigned char* outbuf;
     int outbuf_size;
-    AVCodecContext context;
-    AVCodec *codec;
+    AVCodecContext* context;
+    AVCodec* codec;
     vo_mpegpes_t pes;
 };
 
-#define lavc_venc_context (vf->priv->context)
+#define lavc_venc_context (*vf->priv->context)
 
 //===========================================================================//
 
@@ -62,7 +62,6 @@
     if(vf->priv->outbuf) free(vf->priv->outbuf);
 
     vf->priv->outbuf_size=10000+width*height;  // must be enough!
-    if(vf->priv->outbuf) free(vf->priv->outbuf);
     vf->priv->outbuf = malloc(vf->priv->outbuf_size);
 
     if (avcodec_open(&lavc_venc_context, vf->priv->codec) != 0) {
@@ -142,6 +141,8 @@
 	mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_MissingLAVCcodec, "mpeg1video");
 	return 0;
     }
+    
+    vf->priv->context=avcodec_alloc_context();
 
     // TODO: parse args ->
     if(args) sscanf(args, "%d:%f", &p_quality, &p_fps);




More information about the MPlayer-cvslog mailing list