# HG changeset patch # User arpi # Date 1035325517 0 # Node ID e4f87bbf682c6db6d0e1a08dba23ad5160c6f481 # Parent 626c13032310339c40253d8f8ebf1fec094ca2a7 - using avcodec_alloc_context() - fixed 10l bug (double free() ) causing random mem corruption... diff -r 626c13032310 -r e4f87bbf682c libmpcodecs/vf_lavc.c --- a/libmpcodecs/vf_lavc.c Tue Oct 22 20:47:38 2002 +0000 +++ b/libmpcodecs/vf_lavc.c Tue Oct 22 22:25:17 2002 +0000 @@ -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);