changeset 33935:ec503686b02d

Only use non-deprecated code in lavc encoders.
author reimar
date Sat, 27 Aug 2011 11:04:53 +0000
parents 14a1ae73b01d
children f27fe61c62f7
files libmpcodecs/ae_lavc.c libmpcodecs/ve_lavc.c
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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;