[FFmpeg-devel] [PATCH 3/3] avutil/frame: deprecate palette_has_changed

James Almer jamrial at gmail.com
Tue Apr 11 23:38:51 EEST 2023


This field doesn't provide information about the frame itself but rather about
the frame as part of a decoding context, as as such has no place here.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 doc/APIchanges      | 3 +++
 libavcodec/decode.c | 4 ++++
 libavutil/frame.c   | 4 ++++
 libavutil/frame.h   | 4 ++++
 libavutil/version.h | 3 ++-
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 85060768b3..77a7022f28 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2023-04-11 - xxxxxxxxxx - lavu 58.6.101 - avframe.h
+  Deprecate AVFrame.palette_has_changed
+
 2023-04-11 - xxxxxxxxxx - lavc 60.10.100 - avcodec.h
   Add event_flags to AVCodecContext.
   Add AVCTX_EVENT_FLAG_PALETTE_HAS_CHANGED.
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index e3d803da3b..b4bd15687c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -570,7 +570,11 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
     }
 
     if (!ret) {
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
         frame->palette_has_changed = !!(avctx->event_flags & AVCTX_EVENT_FLAG_PALETTE_HAS_CHANGED);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
         frame->best_effort_timestamp = guess_correct_pts(avctx,
                                                          frame->pts,
                                                          frame->pkt_dts);
diff --git a/libavutil/frame.c b/libavutil/frame.c
index c905e8d611..cd714d0b58 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -277,7 +277,11 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
     dst->repeat_pict            = src->repeat_pict;
     dst->interlaced_frame       = src->interlaced_frame;
     dst->top_field_first        = src->top_field_first;
+#if FF_API_PALETTE_HAS_CHANGED
+FF_DISABLE_DEPRECATION_WARNINGS
     dst->palette_has_changed    = src->palette_has_changed;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     dst->sample_rate            = src->sample_rate;
     dst->opaque                 = src->opaque;
     dst->pkt_dts                = src->pkt_dts;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 5b58c14ac3..981db9e247 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -501,10 +501,14 @@ typedef struct AVFrame {
      */
     int top_field_first;
 
+#if FF_API_PALETTE_HAS_CHANGED
     /**
      * Tell user application that palette has changed from previous frame.
+     * @deprecated Check for AVCTX_EVENT_FLAG_PALETTE_HAS_CHANGED instead.
      */
+    attribute_deprecated
     int palette_has_changed;
+#endif
 
 #if FF_API_REORDERED_OPAQUE
     /**
diff --git a/libavutil/version.h b/libavutil/version.h
index 40f92af055..96b6259f7d 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -80,7 +80,7 @@
 
 #define LIBAVUTIL_VERSION_MAJOR  58
 #define LIBAVUTIL_VERSION_MINOR   6
-#define LIBAVUTIL_VERSION_MICRO 100
+#define LIBAVUTIL_VERSION_MICRO 101
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \
@@ -115,6 +115,7 @@
 #define FF_API_FRAME_PICTURE_NUMBER     (LIBAVUTIL_VERSION_MAJOR < 59)
 #define FF_API_HDR_VIVID_THREE_SPLINE   (LIBAVUTIL_VERSION_MAJOR < 59)
 #define FF_API_FRAME_PKT                (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_PALETTE_HAS_CHANGED      (LIBAVUTIL_VERSION_MAJOR < 59)
 
 /**
  * @}
-- 
2.40.0



More information about the ffmpeg-devel mailing list