diff libmpcodecs/ae_lavc.c @ 33935:ec503686b02d

Only use non-deprecated code in lavc encoders.
author reimar
date Sat, 27 Aug 2011 11:04:53 +0000
parents 30f5e5cd3676
children 505b49b171f4
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;