[FFmpeg-cvslog] avutil/frame: deprecate key_frame
James Almer
git at videolan.org
Fri May 5 02:50:58 EEST 2023
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Apr 12 20:07:01 2023 -0300| [3e06f6f04020bef32fa42bc9d7f96e76a46453aa] | committer: James Almer
avutil/frame: deprecate key_frame
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e06f6f04020bef32fa42bc9d7f96e76a46453aa
---
libavcodec/decode.c | 4 ++++
libavcodec/encode.c | 4 ++++
libavfilter/buffersrc.c | 4 ++++
libavfilter/vf_coreimage.m | 2 ++
libavfilter/vsrc_gradients.c | 5 +++++
libavfilter/vsrc_testsrc.c | 4 ++++
libavutil/frame.c | 5 ++++-
libavutil/frame.h | 5 +++++
libavutil/version.h | 1 +
9 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index a5a6209eae..4f2359f07e 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -572,7 +572,11 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
if (!ret) {
if (avctx->codec_type != AVMEDIA_TYPE_VIDEO)
frame->flags |= AV_FRAME_FLAG_KEY;
+#if FF_API_FRAME_KEY
+FF_DISABLE_DEPRECATION_WARNINGS
frame->key_frame = !!(frame->flags & AV_FRAME_FLAG_KEY);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
frame->interlaced_frame = !!(frame->flags & AV_FRAME_FLAG_INTERLACED);
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 04ee59879e..14e2876742 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -192,8 +192,12 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
av_frame_move_ref(frame, avci->buffer_frame);
+#if FF_API_FRAME_KEY
+FF_DISABLE_DEPRECATION_WARNINGS
if (frame->key_frame)
frame->flags |= AV_FRAME_FLAG_KEY;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
if (frame->interlaced_frame)
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 8d5a08995b..612541b803 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -256,8 +256,12 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+#if FF_API_FRAME_KEY
+FF_DISABLE_DEPRECATION_WARNINGS
if (copy->key_frame)
copy->flags |= AV_FRAME_FLAG_KEY;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
ret = ff_filter_frame(ctx->outputs[0], copy);
if (ret < 0)
diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index aa0c90f537..41750bfb7e 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -301,7 +301,9 @@ static int request_frame(AVFilterLink *link)
frame->pts = ctx->pts;
frame->duration = 1;
+#if FF_API_FRAME_KEY
frame->key_frame = 1;
+#endif
frame->flags |= AV_FRAME_FLAG_KEY
#if FF_API_INTERLACED_FRAME
frame->interlaced_frame = 0;
diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c
index bc2cfb024c..98c38f8551 100644
--- a/libavfilter/vsrc_gradients.c
+++ b/libavfilter/vsrc_gradients.c
@@ -397,7 +397,12 @@ static int activate(AVFilterContext *ctx)
if (!frame)
return AVERROR(ENOMEM);
+#if FF_API_FRAME_KEY
+FF_DISABLE_DEPRECATION_WARNINGS
frame->key_frame = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
frame->flags |= AV_FRAME_FLAG_KEY;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index d4037c6da8..f391ac02e0 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -184,7 +184,11 @@ static int activate(AVFilterContext *ctx)
return AVERROR(ENOMEM);
frame->pts = test->pts;
frame->duration = 1;
+#if FF_API_PKT_DURATION
+FF_DISABLE_DEPRECATION_WARNINGS
frame->key_frame = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
frame->flags |= AV_FRAME_FLAG_KEY;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/frame.c b/libavutil/frame.c
index e544b690fe..97d40208c8 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -55,7 +55,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->time_base = (AVRational){ 0, 1 };
- frame->key_frame = 1;
frame->sample_aspect_ratio = (AVRational){ 0, 1 };
frame->format = -1; /* unknown */
frame->extended_data = frame->data;
@@ -265,7 +264,11 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
{
int ret;
+#if FF_API_FRAME_KEY
+FF_DISABLE_DEPRECATION_WARNINGS
dst->key_frame = src->key_frame;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
dst->pict_type = src->pict_type;
dst->sample_aspect_ratio = src->sample_aspect_ratio;
dst->crop_top = src->crop_top;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 61a218268e..f2b56beebb 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -416,10 +416,15 @@ typedef struct AVFrame {
*/
int format;
+#if FF_API_FRAME_KEY
/**
* 1 -> keyframe, 0-> not
+ *
+ * @deprecated Use AV_FRAME_FLAG_KEY instead
*/
+ attribute_deprecated
int key_frame;
+#endif
/**
* Picture type of the frame.
diff --git a/libavutil/version.h b/libavutil/version.h
index 6a5e2c4881..3a4b9ca77c 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -116,6 +116,7 @@
#define FF_API_HDR_VIVID_THREE_SPLINE (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 59)
/**
* @}
More information about the ffmpeg-cvslog
mailing list