[FFmpeg-devel] [PATCH 03/30] avcodec: remove deprecated FF_API_DROPCHANGED

James Almer jamrial at gmail.com
Mon Feb 24 00:06:03 EET 2025


Deprecated since 2023-07-15.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/avcodec.c       |  4 ---
 libavcodec/avcodec.h       |  9 -------
 libavcodec/decode.c        | 52 --------------------------------------
 libavcodec/internal.h      |  9 -------
 libavcodec/options_table.h |  3 ---
 libavcodec/version_major.h |  1 -
 6 files changed, 78 deletions(-)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index e7e2c09222..3f97f5d161 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -462,10 +462,6 @@ av_cold void ff_codec_close(AVCodecContext *avctx)
 
         av_bsf_free(&avci->bsf);
 
-#if FF_API_DROPCHANGED
-        av_channel_layout_uninit(&avci->initial_ch_layout);
-#endif
-
 #if CONFIG_LCMS2
         ff_icc_context_uninit(&avci->icc);
 #endif
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f6de3c6b42..c35e65868e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -234,15 +234,6 @@ typedef struct RcOverride{
  * Use qpel MC.
  */
 #define AV_CODEC_FLAG_QPEL            (1 <<  4)
-#if FF_API_DROPCHANGED
-/**
- * Don't output frames whose parameters differ from first
- * decoded frame in stream.
- *
- * @deprecated callers should implement this functionality in their own code
- */
-#define AV_CODEC_FLAG_DROPCHANGED     (1 <<  5)
-#endif
 /**
  * Request the encoder to output reconstructed frames, i.e.\ frames that would
  * be produced by decoding the encoded bistream. These frames may be retrieved
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index cac7e620d2..a28279bd36 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -840,53 +840,6 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
 
     avctx->frame_num++;
 
-#if FF_API_DROPCHANGED
-    if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) {
-
-        if (avctx->frame_num == 1) {
-            avci->initial_format = frame->format;
-            switch(avctx->codec_type) {
-            case AVMEDIA_TYPE_VIDEO:
-                avci->initial_width  = frame->width;
-                avci->initial_height = frame->height;
-                break;
-            case AVMEDIA_TYPE_AUDIO:
-                avci->initial_sample_rate = frame->sample_rate ? frame->sample_rate :
-                                                                 avctx->sample_rate;
-                ret = av_channel_layout_copy(&avci->initial_ch_layout, &frame->ch_layout);
-                if (ret < 0)
-                    goto fail;
-                break;
-            }
-        }
-
-        if (avctx->frame_num > 1) {
-            int changed = avci->initial_format != frame->format;
-
-            switch(avctx->codec_type) {
-            case AVMEDIA_TYPE_VIDEO:
-                changed |= avci->initial_width  != frame->width ||
-                           avci->initial_height != frame->height;
-                break;
-            case AVMEDIA_TYPE_AUDIO:
-                changed |= avci->initial_sample_rate    != frame->sample_rate ||
-                           avci->initial_sample_rate    != avctx->sample_rate ||
-                           av_channel_layout_compare(&avci->initial_ch_layout, &frame->ch_layout);
-                break;
-            }
-
-            if (changed) {
-                avci->changed_frames_dropped++;
-                av_log(avctx, AV_LOG_INFO, "dropped changed frame #%"PRId64" pts %"PRId64
-                                            " drop count: %d \n",
-                                            avctx->frame_num, frame->pts,
-                                            avci->changed_frames_dropped);
-                ret = AVERROR_INPUT_CHANGED;
-                goto fail;
-            }
-        }
-    }
-#endif
     return 0;
 fail:
     av_frame_unref(frame);
@@ -2065,11 +2018,6 @@ int ff_decode_preinit(AVCodecContext *avctx)
             return ret;
     }
 
-#if FF_API_DROPCHANGED
-    if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED)
-        av_log(avctx, AV_LOG_WARNING, "The dropchanged flag is deprecated.\n");
-#endif
-
     return 0;
 }
 
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 62a37f473f..137fd52745 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -145,15 +145,6 @@ typedef struct AVCodecInternal {
     AVFrame *buffer_frame;
     int draining_done;
 
-#if FF_API_DROPCHANGED
-    /* used when avctx flag AV_CODEC_FLAG_DROPCHANGED is set */
-    int changed_frames_dropped;
-    int initial_format;
-    int initial_width, initial_height;
-    int initial_sample_rate;
-    AVChannelLayout initial_ch_layout;
-#endif
-
 #if CONFIG_LCMS2
     FFIccContext icc; /* used to read and write embedded ICC profiles */
 #endif
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index c115d8c18c..1711e56cd3 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -74,9 +74,6 @@ static const AVOption avcodec_options[] = {
 {"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, .unit = "flags"},
 {"cgop", "closed GOP", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, .unit = "flags"},
 {"output_corrupt", "Output even potentially corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_OUTPUT_CORRUPT }, INT_MIN, INT_MAX, V|D, .unit = "flags"},
-#if FF_API_DROPCHANGED
-{"drop_changed", "Drop frames whose parameters differ from first decoded frame", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_DROPCHANGED }, INT_MIN, INT_MAX, A|V|D | AV_OPT_FLAG_DEPRECATED, .unit = "flags"},
-#endif
 {"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D|S, .unit = "flags2"},
 {"fast", "allow non-spec-compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, .unit = "flags2"},
 {"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, .unit = "flags2"},
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 3cde4cdd8b..ee3277cb76 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -38,7 +38,6 @@
  */
 
 #define FF_API_INIT_PACKET         (LIBAVCODEC_VERSION_MAJOR < 62)
-#define FF_API_DROPCHANGED         (LIBAVCODEC_VERSION_MAJOR < 62)
 
 #define FF_API_AVFFT               (LIBAVCODEC_VERSION_MAJOR < 62)
 #define FF_API_FF_PROFILE_LEVEL    (LIBAVCODEC_VERSION_MAJOR < 62)
-- 
2.48.1



More information about the ffmpeg-devel mailing list