[FFmpeg-devel] [PATCH] remove the deprecated avpicture_get_size() function

Eddie Hao eddiehao1 at gmail.com
Sun Jan 17 06:41:54 CET 2016


---
 libavcodec/libutvideodec.cpp | 3 ++-
 libavcodec/libutvideoenc.cpp | 3 ++-
 libavdevice/decklink_dec.cpp | 2 +-
 libavdevice/lavfi.c          | 3 ++-
 libavformat/frmdec.c         | 3 ++-
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libutvideodec.cpp b/libavcodec/libutvideodec.cpp
index 47261a6..7c60f4f 100644
--- a/libavcodec/libutvideodec.cpp
+++ b/libavcodec/libutvideodec.cpp
@@ -27,6 +27,7 @@
 
 extern "C" {
 #include "avcodec.h"
+#include "libavutil/imgutils.h"
 }
 
 #include "libutvideo.h"
@@ -93,7 +94,7 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx)
     }
 
     /* Only allocate the buffer once */
-    utv->buf_size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+    utv->buf_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1);
 #ifdef UTVF_UQY2
     if (format == UTVF_v210)
         utv->buf_size += avctx->height * ((avctx->width + 47) / 48) * 128; // the linesize used by the decoder, this does not seem to be exported
diff --git a/libavcodec/libutvideoenc.cpp b/libavcodec/libutvideoenc.cpp
index 8746247..96d8fe1 100644
--- a/libavcodec/libutvideoenc.cpp
+++ b/libavcodec/libutvideoenc.cpp
@@ -27,6 +27,7 @@
 
 extern "C" {
 #include "libavutil/avassert.h"
+#include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "internal.h"
 }
@@ -94,7 +95,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
      * We use this buffer to hold the data that Ut Video returns,
      * since we cannot decode planes separately with it.
      */
-    ret = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+    ret = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1);
     if (ret < 0) {
         av_free(info);
         return ret;
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 89f93de..6c5bc5d 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -473,7 +473,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
 
     st->codec->time_base.den      = ctx->bmd_tb_den;
     st->codec->time_base.num      = ctx->bmd_tb_num;
-    st->codec->bit_rate    = avpicture_get_size(st->codec->pix_fmt, ctx->bmd_width, ctx->bmd_height) * 1/av_q2d(st->codec->time_base) * 8;
+    st->codec->bit_rate    = av_image_get_buffer_size(st->codec->pix_fmt, ctx->bmd_width, ctx->bmd_height, 1) * 1/av_q2d(st->codec->time_base) * 8;
 
     if (cctx->v210) {
         st->codec->codec_id    = AV_CODEC_ID_V210;
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 3453b4d..077879e 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -30,6 +30,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/file.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/log.h"
 #include "libavutil/mem.h"
@@ -430,7 +431,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
     stream_idx = lavfi->sink_stream_map[min_pts_sink_idx];
 
     if (frame->width /* FIXME best way of testing a video */) {
-        size = avpicture_get_size(frame->format, frame->width, frame->height);
+        size = av_image_get_buffer_size(frame->format, frame->width, frame->height, 1);
         if ((ret = av_new_packet(pkt, size)) < 0)
             return ret;
 
diff --git a/libavformat/frmdec.c b/libavformat/frmdec.c
index a6f19af..260afbc 100644
--- a/libavformat/frmdec.c
+++ b/libavformat/frmdec.c
@@ -25,6 +25,7 @@
  */
 
 #include "libavcodec/raw.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 
@@ -80,7 +81,7 @@ static int frm_read_packet(AVFormatContext *avctx, AVPacket *pkt)
     if (s->count)
         return AVERROR_EOF;
 
-    packet_size = avpicture_get_size(stc->pix_fmt, stc->width, stc->height);
+    packet_size = av_image_get_buffer_size(stc->pix_fmt, stc->width, stc->height, 1);
     if (packet_size < 0)
         return AVERROR_INVALIDDATA;
 
-- 
2.5.0



More information about the ffmpeg-devel mailing list