# HG changeset patch # User reimar # Date 1314443093 0 # Node ID ec503686b02d77a26760f96b0c43a996a1afa1e9 # Parent 14a1ae73b01d7bac2f3d35834fc127f88fdcdd62 Only use non-deprecated code in lavc encoders. diff -r 14a1ae73b01d -r ec503686b02d libmpcodecs/ae_lavc.c --- a/libmpcodecs/ae_lavc.c Sat Aug 27 11:02:04 2011 +0000 +++ b/libmpcodecs/ae_lavc.c Sat Aug 27 11:04:53 2011 +0000 @@ -178,14 +178,13 @@ } } - lavc_actx = avcodec_alloc_context(); + lavc_actx = avcodec_alloc_context3(lavc_acodec); if(lavc_actx == NULL) { mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntAllocateLavcContext); return 0; } - lavc_actx->codec_type = AVMEDIA_TYPE_AUDIO; lavc_actx->codec_id = lavc_acodec->id; // put sample parameters lavc_actx->sample_fmt = AV_SAMPLE_FMT_S16; @@ -238,7 +237,7 @@ lavc_actx->flags2 |= CODEC_FLAG2_LOCAL_HEADER; } - if(avcodec_open(lavc_actx, lavc_acodec) < 0) + if(avcodec_open2(lavc_actx, lavc_acodec, NULL) < 0) { mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntOpenCodec, lavc_param_acodec, lavc_param_abitrate); return 0; diff -r 14a1ae73b01d -r ec503686b02d libmpcodecs/ve_lavc.c --- a/libmpcodecs/ve_lavc.c Sat Aug 27 11:02:04 2011 +0000 +++ b/libmpcodecs/ve_lavc.c Sat Aug 27 11:04:53 2011 +0000 @@ -686,7 +686,7 @@ lavc_venc_context->thread_count = lavc_param_threads; lavc_venc_context->thread_type = FF_THREAD_FRAME | FF_THREAD_SLICE; - if (avcodec_open(lavc_venc_context, vf->priv->codec) != 0) { + if (avcodec_open2(lavc_venc_context, vf->priv->codec, NULL) != 0) { mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec); return 0; } @@ -1037,8 +1037,7 @@ } vf->priv->pic = avcodec_alloc_frame(); - vf->priv->context = avcodec_alloc_context(); - vf->priv->context->codec_type = AVMEDIA_TYPE_VIDEO; + vf->priv->context = avcodec_alloc_context3(vf->priv->codec); vf->priv->context->codec_id = vf->priv->codec->id; return 1;