summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_lavc.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-22 22:25:17 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-22 22:25:17 +0000
commit71fb48ebc5b528405377cb9c0aefd4a93e1cd32e (patch)
tree7bd052e2cf928bf8b3171211bc9aacc8277bcd0e /libmpcodecs/vf_lavc.c
parentd58b5163fca7298f0a720ecc6bd648779643206e (diff)
downloadmpv-71fb48ebc5b528405377cb9c0aefd4a93e1cd32e.tar.bz2
mpv-71fb48ebc5b528405377cb9c0aefd4a93e1cd32e.tar.xz
- 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
Diffstat (limited to 'libmpcodecs/vf_lavc.c')
-rw-r--r--libmpcodecs/vf_lavc.c9
1 files 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);