@@ -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
frame->best_effort_timestamp = guess_correct_pts(avctx,
frame->pts,
frame->pkt_dts);
@@ -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
return 0;
}
@@ -247,8 +247,12 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+#if FF_API_FRAME_KEY
+FF_DISABLE_DEPRECATION_WARNINGS
if (frame->key_frame)
frame->flags |= AV_FRAME_FLAG_KEY;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
ret = ff_filter_frame(ctx->outputs[0], copy);
if (ret < 0)
@@ -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;
frame->interlaced_frame = 0;
frame->pict_type = AV_PICTURE_TYPE_I;
@@ -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;
frame->interlaced_frame = 0;
frame->pict_type = AV_PICTURE_TYPE_I;
@@ -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;
frame->interlaced_frame = 0;
frame->pict_type = AV_PICTURE_TYPE_I;
@@ -55,7 +55,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
frame->time_base = (AVRational){ 0, 1 };
- frame->key_frame = 1;
+#if FF_API_FRAME_KEY
+FF_DISABLE_DEPRECATION_WARNINGS
+ frame->key_frame = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
frame->sample_aspect_ratio = (AVRational){ 0, 1 };
frame->format = -1; /* unknown */
frame->extended_data = frame->data;
@@ -265,7 +269,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;
@@ -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.
@@ -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_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 59)
/**
* @}
Signed-off-by: James Almer <jamrial@gmail.com> --- 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 | 10 +++++++++- libavutil/frame.h | 5 +++++ libavutil/version.h | 1 + 9 files changed, 38 insertions(+), 1 deletion(-)