changeset 34566:f3d53cd55376

Update deprecated avcodec_alloc_context()/avcodec_open() API calls
author siretart
date Mon, 06 Feb 2012 06:30:12 +0000
parents 25acb5f98cb4
children 2c9db9cb7310
files libaf/af_lavcac3enc.c libmpcodecs/vf_lavc.c libmpcodecs/vf_screenshot.c libmpcodecs/vf_spp.c libmpcodecs/vf_uspp.c libmpdemux/demux_rtp_codec.cpp libmpdemux/demuxer.c libvo/vo_png.c sub/av_sub.c
diffstat 9 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af_lavcac3enc.c	Sun Feb 05 21:20:51 2012 +0000
+++ b/libaf/af_lavcac3enc.c	Mon Feb 06 06:30:12 2012 +0000
@@ -99,7 +99,7 @@
             s->lavc_actx->sample_fmt  = AV_SAMPLE_FMT_S16;
             s->lavc_actx->bit_rate = bit_rate;
 
-            if(avcodec_open(s->lavc_actx, s->lavc_acodec) < 0) {
+            if(avcodec_open2(s->lavc_actx, s->lavc_acodec, NULL) < 0) {
                 mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntOpenCodec, "ac3", bit_rate);
                 return AF_ERROR;
             }
@@ -282,7 +282,7 @@
         return AF_ERROR;
     }
 
-    s->lavc_actx = avcodec_alloc_context();
+    s->lavc_actx = avcodec_alloc_context3(NULL);
     if (!s->lavc_actx) {
         mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntAllocateLavcContext);
         return AF_ERROR;
--- a/libmpcodecs/vf_lavc.c	Sun Feb 05 21:20:51 2012 +0000
+++ b/libmpcodecs/vf_lavc.c	Mon Feb 06 06:30:12 2012 +0000
@@ -74,7 +74,7 @@
     vf->priv->outbuf_size=10000+width*height;  // must be enough!
     vf->priv->outbuf = malloc(vf->priv->outbuf_size);
 
-    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;
     }
@@ -148,7 +148,7 @@
 	return 0;
     }
 
-    vf->priv->context=avcodec_alloc_context();
+    vf->priv->context=avcodec_alloc_context3(vf->priv->codec);
     vf->priv->pic = avcodec_alloc_frame();
 
     // TODO: parse args ->
--- a/libmpcodecs/vf_screenshot.c	Sun Feb 05 21:20:51 2012 +0000
+++ b/libmpcodecs/vf_screenshot.c	Mon Feb 06 06:30:12 2012 +0000
@@ -300,9 +300,9 @@
     vf->priv->buffer=0;
     vf->priv->outbuffer=0;
     vf->priv->ctx=0;
-    vf->priv->avctx = avcodec_alloc_context();
+    vf->priv->avctx = avcodec_alloc_context3(NULL);
     avcodec_register_all();
-    if (avcodec_open(vf->priv->avctx, avcodec_find_encoder(CODEC_ID_PNG))) {
+    if (avcodec_open2(vf->priv->avctx, avcodec_find_encoder(CODEC_ID_PNG), NULL)) {
         mp_msg(MSGT_VFILTER, MSGL_FATAL, "Could not open libavcodec PNG encoder\n");
         return 0;
     }
--- a/libmpcodecs/vf_spp.c	Sun Feb 05 21:20:51 2012 +0000
+++ b/libmpcodecs/vf_spp.c	Mon Feb 06 06:30:12 2012 +0000
@@ -578,7 +578,7 @@
 
     init_avcodec();
 
-    vf->priv->avctx= avcodec_alloc_context();
+    vf->priv->avctx= avcodec_alloc_context3(NULL);
     dsputil_init(&vf->priv->dsp, vf->priv->avctx);
 
     vf->priv->log2_count= 3;
--- a/libmpcodecs/vf_uspp.c	Sun Feb 05 21:20:51 2012 +0000
+++ b/libmpcodecs/vf_uspp.c	Mon Feb 06 06:30:12 2012 +0000
@@ -224,7 +224,7 @@
             AVCodecContext *avctx_enc;
 
             avctx_enc=
-            vf->priv->avctx_enc[i]= avcodec_alloc_context();
+            vf->priv->avctx_enc[i]= avcodec_alloc_context3(NULL);
             avctx_enc->width = width + BLOCK;
             avctx_enc->height = height + BLOCK;
             avctx_enc->time_base= (AVRational){1,25};  // meaningless
@@ -234,7 +234,7 @@
             avctx_enc->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_LOW_DELAY;
             avctx_enc->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
             avctx_enc->global_quality= 123;
-            avcodec_open(avctx_enc, enc);
+            avcodec_open2(avctx_enc, enc, NULL);
             assert(avctx_enc->codec);
         }
         vf->priv->frame= avcodec_alloc_frame();
--- a/libmpdemux/demux_rtp_codec.cpp	Sun Feb 05 21:20:51 2012 +0000
+++ b/libmpdemux/demux_rtp_codec.cpp	Mon Feb 06 06:30:12 2012 +0000
@@ -141,7 +141,7 @@
     const uint8_t* fooData;
     avcodec_register_all();
     h264parserctx = av_parser_init(CODEC_ID_H264);
-    avcctx = avcodec_alloc_context();
+    avcctx = avcodec_alloc_context3(NULL);
     // Pass the config to the parser
     h264parserctx->parser->parser_parse(h264parserctx, avcctx,
                   &fooData, &fooLen, configData, configLen);
--- a/libmpdemux/demuxer.c	Sun Feb 05 21:20:51 2012 +0000
+++ b/libmpdemux/demuxer.c	Mon Feb 06 06:30:12 2012 +0000
@@ -529,7 +529,7 @@
         break;
     }
     if (codec_id != CODEC_ID_NONE) {
-        *avctx = avcodec_alloc_context();
+        *avctx = avcodec_alloc_context3(NULL);
         if (!*avctx)
             return;
         *parser = av_parser_init(codec_id);
--- a/libvo/vo_png.c	Sun Feb 05 21:20:51 2012 +0000
+++ b/libvo/vo_png.c	Mon Feb 06 06:30:12 2012 +0000
@@ -232,8 +232,8 @@
         return -1;
     }
     avcodec_register_all();
-    avctx = avcodec_alloc_context();
-    if (avcodec_open(avctx, avcodec_find_encoder(CODEC_ID_PNG)) < 0) {
+    avctx = avcodec_alloc_context3(NULL);
+    if (avcodec_open2(avctx, avcodec_find_encoder(CODEC_ID_PNG), NULL) < 0) {
         uninit();
         return -1;
     }
--- a/sub/av_sub.c	Sun Feb 05 21:20:51 2012 +0000
+++ b/sub/av_sub.c	Mon Feb 06 06:30:12 2012 +0000
@@ -65,9 +65,9 @@
     if (!ctx) {
         AVCodec *sub_codec;
         init_avcodec();
-        ctx = avcodec_alloc_context();
+        ctx = avcodec_alloc_context3(NULL);
         sub_codec = avcodec_find_decoder(cid);
-        if (!ctx || !sub_codec || avcodec_open(ctx, sub_codec) < 0) {
+        if (!ctx || !sub_codec || avcodec_open2(ctx, sub_codec, NULL) < 0) {
             mp_msg(MSGT_SUBREADER, MSGL_FATAL,
                    "Could not open subtitle decoder\n");
             av_freep(&ctx);