[FFmpeg-cvslog] lavc/utils: stop using deprecated avcodec_set_dimensions

Anton Khirnov git at videolan.org
Fri Nov 1 13:27:43 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Oct 27 10:02:26 2013 +0100| [0f6c1d6d64c9f6255ea579dace27d0dd695f0213] | committer: Anton Khirnov

lavc/utils: stop using deprecated avcodec_set_dimensions

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f6c1d6d64c9f6255ea579dace27d0dd695f0213
---

 libavcodec/utils.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1e0026d..262f081 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -934,15 +934,17 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
         goto free_and_end;
 
     if (avctx->coded_width && avctx->coded_height && !avctx->width && !avctx->height)
-        avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
+        ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
     else if (avctx->width && avctx->height)
-        avcodec_set_dimensions(avctx, avctx->width, avctx->height);
+        ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
+    if (ret < 0)
+        goto free_and_end;
 
     if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)
         && (  av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0
            || av_image_check_size(avctx->width,       avctx->height,       0, avctx) < 0)) {
         av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height values\n");
-        avcodec_set_dimensions(avctx, 0, 0);
+        ff_set_dimensions(avctx, 0, 0);
     }
 
     /* if the decoder init function was already called previously,
@@ -1334,7 +1336,7 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
 
 static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
 {
-    int size = 0;
+    int size = 0, ret;
     const uint8_t *data;
     uint32_t flags;
 
@@ -1377,8 +1379,10 @@ static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
             goto fail;
         avctx->width  = bytestream_get_le32(&data);
         avctx->height = bytestream_get_le32(&data);
-        avcodec_set_dimensions(avctx, avctx->width, avctx->height);
         size -= 8;
+        ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
+        if (ret < 0)
+            return ret;
     }
 
     return 0;



More information about the ffmpeg-cvslog mailing list