[FFmpeg-devel] [PATCH 25/87] avcodec: Remove deprecated AVPicture API

James Almer jamrial at gmail.com
Mon Apr 19 17:09:22 EEST 2021


From: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

Deprecated in a17a7661906ba295d67afd80ac0770422e1b02b3.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/Makefile              |   2 -
 libavcodec/avcodec.h             |  99 --------------------
 libavcodec/avpicture.c           |  82 ----------------
 libavcodec/dvbsubdec.c           |  12 ---
 libavcodec/dvdsubdec.c           |  18 ----
 libavcodec/dvdsubenc.c           |  14 ---
 libavcodec/imgconvert.c          | 156 +------------------------------
 libavcodec/libzvbi-teletextdec.c |   9 --
 libavcodec/pgssubdec.c           |  14 ---
 libavcodec/tests/.gitignore      |   1 -
 libavcodec/tests/imgconvert.c    |  46 ---------
 libavcodec/version.h             |   3 -
 libavcodec/xsubdec.c             |  14 ---
 libavcodec/xsubenc.c             |  13 ---
 14 files changed, 1 insertion(+), 482 deletions(-)
 delete mode 100644 libavcodec/avpicture.c
 delete mode 100644 libavcodec/tests/imgconvert.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index c11645616d..31b220025b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -32,7 +32,6 @@ OBJS = ac3_parser.o                                                     \
        avcodec.o                                                        \
        avdct.o                                                          \
        avpacket.o                                                       \
-       avpicture.o                                                      \
        bitstream.o                                                      \
        bitstream_filters.o                                              \
        bsf.o                                                            \
@@ -1213,7 +1212,6 @@ TESTPROGS = avpacket                                                    \
             celp_math                                                   \
             codec_desc                                                  \
             htmlsubtitles                                               \
-            imgconvert                                                  \
             jpeg2000dwt                                                 \
             mathops                                                    \
             utils                                                       \
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ea60e1fe46..315246e68e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2418,33 +2418,6 @@ typedef struct AVHWAccel {
  * @}
  */
 
-#if FF_API_AVPICTURE
-/**
- * @defgroup lavc_picture AVPicture
- *
- * Functions for working with AVPicture
- * @{
- */
-
-/**
- * Picture data structure.
- *
- * Up to four components can be stored into it, the last component is
- * alpha.
- * @deprecated use AVFrame or imgutils functions instead
- */
-typedef struct AVPicture {
-    attribute_deprecated
-    uint8_t *data[AV_NUM_DATA_POINTERS];    ///< pointers to the image data planes
-    attribute_deprecated
-    int linesize[AV_NUM_DATA_POINTERS];     ///< number of bytes per line
-} AVPicture;
-
-/**
- * @}
- */
-#endif
-
 enum AVSubtitleType {
     SUBTITLE_NONE,
 
@@ -2472,13 +2445,6 @@ typedef struct AVSubtitleRect {
     int h;         ///< height           of pict, undefined when pict is not set
     int nb_colors; ///< number of colors in pict, undefined when pict is not set
 
-#if FF_API_AVPICTURE
-    /**
-     * @deprecated unused
-     */
-    attribute_deprecated
-    AVPicture pict;
-#endif
     /**
      * data+linesize for the bitmap of this subtitle.
      * Can be set for text/ass as well once they are rendered.
@@ -3445,71 +3411,6 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  * @}
  */
 
-#if FF_API_AVPICTURE
-/**
- * @addtogroup lavc_picture
- * @{
- */
-
-/**
- * @deprecated unused
- */
-attribute_deprecated
-int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
-
-/**
- * @deprecated unused
- */
-attribute_deprecated
-void avpicture_free(AVPicture *picture);
-
-/**
- * @deprecated use av_image_fill_arrays() instead.
- */
-attribute_deprecated
-int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
-                   enum AVPixelFormat pix_fmt, int width, int height);
-
-/**
- * @deprecated use av_image_copy_to_buffer() instead.
- */
-attribute_deprecated
-int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt,
-                     int width, int height,
-                     unsigned char *dest, int dest_size);
-
-/**
- * @deprecated use av_image_get_buffer_size() instead.
- */
-attribute_deprecated
-int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
-
-/**
- * @deprecated av_image_copy() instead.
- */
-attribute_deprecated
-void av_picture_copy(AVPicture *dst, const AVPicture *src,
-                     enum AVPixelFormat pix_fmt, int width, int height);
-
-/**
- * @deprecated unused
- */
-attribute_deprecated
-int av_picture_crop(AVPicture *dst, const AVPicture *src,
-                    enum AVPixelFormat pix_fmt, int top_band, int left_band);
-
-/**
- * @deprecated unused
- */
-attribute_deprecated
-int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
-            int padtop, int padbottom, int padleft, int padright, int *color);
-
-/**
- * @}
- */
-#endif
-
 /**
  * @defgroup lavc_misc Utility functions
  * @ingroup libavc
diff --git a/libavcodec/avpicture.c b/libavcodec/avpicture.c
deleted file mode 100644
index 56435f4fc9..0000000000
--- a/libavcodec/avpicture.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * AVPicture management routines
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AVPicture management routines
- */
-
-#include "avcodec.h"
-#include "internal.h"
-#include "libavutil/common.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/imgutils.h"
-#include "libavutil/internal.h"
-#include "libavutil/colorspace.h"
-
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-int avpicture_fill(AVPicture *picture, const uint8_t *ptr,
-                   enum AVPixelFormat pix_fmt, int width, int height)
-{
-    return av_image_fill_arrays(picture->data, picture->linesize,
-                                ptr, pix_fmt, width, height, 1);
-}
-
-int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, int width, int height,
-                     unsigned char *dest, int dest_size)
-{
-    return av_image_copy_to_buffer(dest, dest_size,
-                                   (const uint8_t * const*)src->data, src->linesize,
-                                   pix_fmt, width, height, 1);
-}
-
-int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)
-{
-    return av_image_get_buffer_size(pix_fmt, width, height, 1);
-}
-
-int avpicture_alloc(AVPicture *picture,
-                    enum AVPixelFormat pix_fmt, int width, int height)
-{
-    int ret = av_image_alloc(picture->data, picture->linesize,
-                             width, height, pix_fmt, 1);
-    if (ret < 0) {
-        memset(picture, 0, sizeof(AVPicture));
-        return ret;
-    }
-
-    return 0;
-}
-
-void avpicture_free(AVPicture *picture)
-{
-    av_freep(&picture->data[0]);
-}
-
-void av_picture_copy(AVPicture *dst, const AVPicture *src,
-                     enum AVPixelFormat pix_fmt, int width, int height)
-{
-    av_image_copy(dst->data, dst->linesize, (const uint8_t **)src->data,
-                  src->linesize, pix_fmt, width, height);
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_AVPICTURE */
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index ec2304bfb9..7db1fef216 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -832,18 +832,6 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
                 memcpy(rect->data[1], region->computed_clut, sizeof(region->computed_clut));
             }
 
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-{
-            int j;
-            for (j = 0; j < 4; j++) {
-                rect->pict.data[j] = rect->data[j];
-                rect->pict.linesize[j] = rect->linesize[j];
-            }
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
             i++;
         }
     }
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index bf49788e1b..91906b9df4 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -409,15 +409,6 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
                 sub_header->rects[0]->type = SUBTITLE_BITMAP;
                 sub_header->rects[0]->linesize[0] = w;
                 sub_header->rects[0]->flags = is_menu ? AV_SUBTITLE_FLAG_FORCED : 0;
-
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-                for (i = 0; i < 4; i++) {
-                    sub_header->rects[0]->pict.data[i] = sub_header->rects[0]->data[i];
-                    sub_header->rects[0]->pict.linesize[i] = sub_header->rects[0]->linesize[i];
-                }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
             }
         }
         if (next_cmd_pos < cmd_pos) {
@@ -504,15 +495,6 @@ static int find_smallest_bounding_rectangle(DVDSubContext *ctx, AVSubtitle *s)
     s->rects[0]->x += x1;
     s->rects[0]->y += y1;
 
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-    for (i = 0; i < 4; i++) {
-        s->rects[0]->pict.data[i] = s->rects[0]->data[i];
-        s->rects[0]->pict.linesize[i] = s->rects[0]->linesize[i];
-    }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     return 1;
 }
 
diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index 9fa9d5b6d7..e55e2eab4f 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -279,20 +279,6 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
             break;
         }
 
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-    for (i = 0; i < rects; i++)
-        if (!h->rects[i]->data[0]) {
-            AVSubtitleRect *rect = h->rects[i];
-            int j;
-            for (j = 0; j < 4; j++) {
-                rect->data[j] = rect->pict.data[j];
-                rect->linesize[j] = rect->pict.linesize[j];
-            }
-        }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     vrect = *h->rects[0];
 
     if (rects > 1) {
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index a3443d1c72..40300f836d 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -25,13 +25,8 @@
  */
 
 #include "avcodec.h"
-#include "internal.h"
-#include "mathops.h"
-#include "libavutil/colorspace.h"
-#include "libavutil/common.h"
 #include "libavutil/pixdesc.h"
-#include "libavutil/internal.h"
-#include "libavutil/imgutils.h"
+#include "libavutil/pixfmt.h"
 
 #if FF_API_AVCODEC_PIX_FMT
 int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
@@ -72,152 +67,3 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p
     return best;
 }
 
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-/* return true if yuv planar */
-static inline int is_yuv_planar(const AVPixFmtDescriptor *desc)
-{
-    int i;
-    int planes[4] = { 0 };
-
-    if (     desc->flags & AV_PIX_FMT_FLAG_RGB
-        || !(desc->flags & AV_PIX_FMT_FLAG_PLANAR))
-        return 0;
-
-    /* set the used planes */
-    for (i = 0; i < desc->nb_components; i++)
-        planes[desc->comp[i].plane] = 1;
-
-    /* if there is an unused plane, the format is not planar */
-    for (i = 0; i < desc->nb_components; i++)
-        if (!planes[i])
-            return 0;
-    return 1;
-}
-
-int av_picture_crop(AVPicture *dst, const AVPicture *src,
-                    enum AVPixelFormat pix_fmt, int top_band, int left_band)
-{
-    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
-    int y_shift;
-    int x_shift;
-    int max_step[4];
-
-    if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
-        return -1;
-
-    y_shift = desc->log2_chroma_h;
-    x_shift = desc->log2_chroma_w;
-    av_image_fill_max_pixsteps(max_step, NULL, desc);
-
-    if (is_yuv_planar(desc)) {
-    dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;
-    dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift);
-    dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift);
-    } else{
-        if(top_band % (1<<y_shift) || left_band % (1<<x_shift))
-            return -1;
-        dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + (left_band * max_step[0]);
-    }
-
-    dst->linesize[0] = src->linesize[0];
-    dst->linesize[1] = src->linesize[1];
-    dst->linesize[2] = src->linesize[2];
-    return 0;
-}
-
-int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
-                   enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright,
-            int *color)
-{
-    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
-    uint8_t *optr;
-    int y_shift;
-    int x_shift;
-    int yheight;
-    int i, y;
-    int max_step[4];
-
-    if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
-        return -1;
-
-    if (!is_yuv_planar(desc)) {
-        if (src)
-            return -1; //TODO: Not yet implemented
-
-        av_image_fill_max_pixsteps(max_step, NULL, desc);
-
-        if (padtop || padleft) {
-            memset(dst->data[0], color[0],
-                    dst->linesize[0] * padtop + (padleft * max_step[0]));
-        }
-
-        if (padleft || padright) {
-            optr = dst->data[0] + dst->linesize[0] * padtop +
-                    (dst->linesize[0] - (padright * max_step[0]));
-            yheight = height - 1 - (padtop + padbottom);
-            for (y = 0; y < yheight; y++) {
-                memset(optr, color[0], (padleft + padright) * max_step[0]);
-                optr += dst->linesize[0];
-            }
-        }
-
-        if (padbottom || padright) {
-            optr = dst->data[0] + dst->linesize[0] * (height - padbottom) -
-                    (padright * max_step[0]);
-            memset(optr, color[0], dst->linesize[0] * padbottom +
-                    (padright * max_step[0]));
-        }
-
-        return 0;
-    }
-
-    for (i = 0; i < 3; i++) {
-        x_shift = i ? desc->log2_chroma_w : 0;
-        y_shift = i ? desc->log2_chroma_h : 0;
-
-        if (padtop || padleft) {
-            memset(dst->data[i], color[i],
-                dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
-        }
-
-        if (padleft || padright) {
-            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
-                (dst->linesize[i] - (padright >> x_shift));
-            yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
-            for (y = 0; y < yheight; y++) {
-                memset(optr, color[i], (padleft + padright) >> x_shift);
-                optr += dst->linesize[i];
-            }
-        }
-
-        if (src) { /* first line */
-            uint8_t *iptr = src->data[i];
-            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
-                    (padleft >> x_shift);
-            memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
-            iptr += src->linesize[i];
-            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
-                (dst->linesize[i] - (padright >> x_shift));
-            yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
-            for (y = 0; y < yheight; y++) {
-                memset(optr, color[i], (padleft + padright) >> x_shift);
-                memcpy(optr + ((padleft + padright) >> x_shift), iptr,
-                       (width - padleft - padright) >> x_shift);
-                iptr += src->linesize[i];
-                optr += dst->linesize[i];
-            }
-        }
-
-        if (padbottom || padright) {
-            optr = dst->data[i] + dst->linesize[i] *
-                ((height - padbottom) >> y_shift) - (padright >> x_shift);
-            memset(optr, color[i],dst->linesize[i] *
-                (padbottom >> y_shift) + (padright >> x_shift));
-        }
-    }
-
-    return 0;
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_AVPICTURE */
diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
index 0cc389a28e..e056ea5ef0 100644
--- a/libavcodec/libzvbi-teletextdec.c
+++ b/libavcodec/libzvbi-teletextdec.c
@@ -641,7 +641,6 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *got_sub
     TeletextContext *ctx = avctx->priv_data;
     AVSubtitle      *sub = data;
     int             ret = 0;
-    int j;
 
     if (!ctx->vbi) {
         if (!(ctx->vbi = vbi_decoder_new()))
@@ -701,14 +700,6 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *got_sub
             if (sub->rects) {
                 sub->num_rects = 1;
                 sub->rects[0] = ctx->pages->sub_rect;
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-                for (j = 0; j < 4; j++) {
-                    sub->rects[0]->pict.data[j] = sub->rects[0]->data[j];
-                    sub->rects[0]->pict.linesize[j] = sub->rects[0]->linesize[j];
-                }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
             } else {
                 ret = AVERROR(ENOMEM);
             }
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 9c59a2297f..eaf069017a 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -596,20 +596,6 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
 
         if (!ctx->forced_subs_only || ctx->presentation.objects[i].composition_flag & 0x40)
         memcpy(sub->rects[i]->data[1], palette->clut, sub->rects[i]->nb_colors * sizeof(uint32_t));
-
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-{
-        AVSubtitleRect *rect;
-        int j;
-        rect = sub->rects[i];
-        for (j = 0; j < 4; j++) {
-            rect->pict.data[j] = rect->data[j];
-            rect->pict.linesize[j] = rect->linesize[j];
-        }
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
     }
     return 1;
 }
diff --git a/libavcodec/tests/.gitignore b/libavcodec/tests/.gitignore
index 92aab1b73c..69bf891f44 100644
--- a/libavcodec/tests/.gitignore
+++ b/libavcodec/tests/.gitignore
@@ -11,7 +11,6 @@
 /h265_levels
 /htmlsubtitles
 /iirfilter
-/imgconvert
 /jpeg2000dwt
 /mathops
 /mjpegenc_huffman
diff --git a/libavcodec/tests/imgconvert.c b/libavcodec/tests/imgconvert.c
deleted file mode 100644
index aefc324bf5..0000000000
--- a/libavcodec/tests/imgconvert.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Misc image conversion routines
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/imgconvert.c"
-
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-int main(void){
-    int i;
-    int err=0;
-    int skip = 0;
-
-    for (i=0; i<AV_PIX_FMT_NB*2; i++) {
-        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
-        if(!desc || !desc->name) {
-            skip ++;
-            continue;
-        }
-        if (skip) {
-            av_log(NULL, AV_LOG_INFO, "%3d unused pixel format values\n", skip);
-            skip = 0;
-        }
-        av_log(NULL, AV_LOG_INFO, "pix fmt %s yuv_plan:%d avg_bpp:%d\n", desc->name, is_yuv_planar(desc), av_get_padded_bits_per_pixel(desc));
-    }
-    return err;
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif /* FF_API_AVPICTURE */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index a785e18c9e..c502dd4fa9 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -54,9 +54,6 @@
 #ifndef FF_API_CODED_FRAME
 #define FF_API_CODED_FRAME       (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
-#ifndef FF_API_AVPICTURE
-#define FF_API_AVPICTURE         (LIBAVCODEC_VERSION_MAJOR < 59)
-#endif
 #ifndef FF_API_VBV_DELAY
 #define FF_API_VBV_DELAY         (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index 87ac910577..caab330ed3 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -134,20 +134,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
             ((uint32_t *)sub->rects[0]->data[1])[i] |= (unsigned)*buf++ << 24;
     }
 
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-{
-    AVSubtitleRect *rect;
-    int j;
-    rect = sub->rects[0];
-    for (j = 0; j < 4; j++) {
-        rect->pict.data[j] = rect->data[j];
-        rect->pict.linesize[j] = rect->linesize[j];
-    }
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     // process RLE-compressed data
     if ((ret = init_get_bits8(&gb, buf, buf_end - buf)) < 0)
         return ret;
diff --git a/libavcodec/xsubenc.c b/libavcodec/xsubenc.c
index 9139159c98..53fcb76656 100644
--- a/libavcodec/xsubenc.c
+++ b/libavcodec/xsubenc.c
@@ -132,19 +132,6 @@ static int xsub_encode(AVCodecContext *avctx, unsigned char *buf,
     if (h->num_rects != 1)
         av_log(avctx, AV_LOG_WARNING, "Only single rects supported (%d in subtitle.)\n", h->num_rects);
 
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (!h->rects[0]->data[0]) {
-        AVSubtitleRect *rect = h->rects[0];
-        int j;
-        for (j = 0; j < 4; j++) {
-            rect->data[j] = rect->pict.data[j];
-            rect->linesize[j] = rect->pict.linesize[j];
-        }
-    }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     // TODO: render text-based subtitles into bitmaps
     if (!h->rects[0]->data[0] || !h->rects[0]->data[1]) {
         av_log(avctx, AV_LOG_WARNING, "No subtitle bitmap available.\n");
-- 
2.31.1



More information about the ffmpeg-devel mailing list