From 71fb48ebc5b528405377cb9c0aefd4a93e1cd32e Mon Sep 17 00:00:00 2001 From: arpi Date: Tue, 22 Oct 2002 22:25:17 +0000 Subject: [PATCH] - using avcodec_alloc_context() - fixed 10l bug (double free() ) causing random mem corruption... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7853 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_lavc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libmpcodecs/vf_lavc.c b/libmpcodecs/vf_lavc.c index 9415748261..085209cec5 100644 --- a/libmpcodecs/vf_lavc.c +++ b/libmpcodecs/vf_lavc.c @@ -26,12 +26,12 @@ extern int avcodec_inited; 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 @@ static int config(struct vf_instance_s* vf, 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 @@ static int open(vf_instance_t *vf, char* args){ 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);