From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 3/5] avfilter: use the new AVFrame key_frame flag in all filters
Date: Thu, 13 Apr 2023 13:29:38 -0300
Message-ID: <20230413162940.61095-3-jamrial@gmail.com> (raw)
In-Reply-To: <20230413162940.61095-1-jamrial@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavfilter/avfilter.c | 2 +-
libavfilter/buffersrc.c | 3 +++
libavfilter/f_select.c | 4 ++--
libavfilter/vf_blackframe.c | 2 +-
libavfilter/vf_coreimage.m | 1 +
libavfilter/vf_showinfo.c | 2 +-
libavfilter/vsrc_gradients.c | 1 +
libavfilter/vsrc_testsrc.c | 1 +
8 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 8d5702a0c8..1fe728a42c 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -59,7 +59,7 @@ static void tlog_ref(void *ctx, AVFrame *ref, int end)
ref->width, ref->height,
!ref->interlaced_frame ? 'P' : /* Progressive */
ref->top_field_first ? 'T' : 'B', /* Top / Bottom */
- ref->key_frame,
+ !!(ref->flags & AV_FRAME_FLAG_KEY),
av_get_picture_type_char(ref->pict_type));
}
if (ref->nb_samples) {
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index a1740da054..a81c331cd5 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -247,6 +247,9 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+ if (frame->key_frame)
+ frame->flags |= AV_FRAME_FLAG_KEY;
+
ret = ff_filter_frame(ctx->outputs[0], copy);
if (ret < 0)
return ret;
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index d76c248fc5..d544b5533c 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -346,7 +346,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
select->var_values[VAR_POS] = frame->pkt_pos == -1 ? NAN : frame->pkt_pos;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
- select->var_values[VAR_KEY] = frame->key_frame;
+ select->var_values[VAR_KEY] = !!(frame->flags & AV_FRAME_FLAG_KEY);
select->var_values[VAR_CONCATDEC_SELECT] = get_concatdec_select(frame, av_rescale_q(frame->pts, inlink->time_base, AV_TIME_BASE_Q));
switch (inlink->type) {
@@ -375,7 +375,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
select->var_values[VAR_N],
select->var_values[VAR_PTS],
select->var_values[VAR_T],
- frame->key_frame);
+ !!(frame->flags & AV_FRAME_FLAG_KEY));
switch (inlink->type) {
case AVMEDIA_TYPE_VIDEO:
diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c
index e5e185dbea..4bcec86688 100644
--- a/libavfilter/vf_blackframe.c
+++ b/libavfilter/vf_blackframe.c
@@ -72,7 +72,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
p += frame->linesize[0];
}
- if (frame->key_frame)
+ if (frame->flags & AV_FRAME_FLAG_KEY)
s->last_keyframe = s->frame;
pblack = s->nblack * 100 / (inlink->w * inlink->h);
diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index b1959861de..ea43aad275 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -302,6 +302,7 @@ static int request_frame(AVFilterLink *link)
frame->pts = ctx->pts;
frame->duration = 1;
frame->key_frame = 1;
+ frame->flags |= AV_FRAME_FLAG_KEY;
frame->interlaced_frame = 0;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->sample_aspect_ratio = ctx->sar;
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 9caa618b01..ca58d0519c 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -724,7 +724,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
frame->width, frame->height,
!frame->interlaced_frame ? 'P' : /* Progressive */
frame->top_field_first ? 'T' : 'B', /* Top / Bottom */
- frame->key_frame,
+ !!(frame->flags & AV_FRAME_FLAG_KEY),
av_get_picture_type_char(frame->pict_type));
if (s->calculate_checksums) {
diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c
index 3c524b9242..39e9e226ee 100644
--- a/libavfilter/vsrc_gradients.c
+++ b/libavfilter/vsrc_gradients.c
@@ -398,6 +398,7 @@ static int activate(AVFilterContext *ctx)
return AVERROR(ENOMEM);
frame->key_frame = 1;
+ frame->flags |= AV_FRAME_FLAG_KEY;
frame->interlaced_frame = 0;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->sample_aspect_ratio = (AVRational) {1, 1};
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 9760e5fc80..7fb1ef9718 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -185,6 +185,7 @@ static int activate(AVFilterContext *ctx)
frame->pts = test->pts;
frame->duration = 1;
frame->key_frame = 1;
+ frame->flags |= AV_FRAME_FLAG_KEY;
frame->interlaced_frame = 0;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->sample_aspect_ratio = test->sar;
--
2.40.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-04-14 14:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 16:29 [FFmpeg-devel] [PATCH 1/5] avutil/frame: add a keyframe flag to AVFrame James Almer
2023-04-13 16:29 ` [FFmpeg-devel] [PATCH 2/5] avcodec: use the new AVFrame key_frame flag in all decoders and encoders James Almer
2023-04-13 16:29 ` James Almer [this message]
2023-04-13 16:29 ` [FFmpeg-devel] [PATCH 4/5] fftools: use the new AVFrame keyframe flag James Almer
2023-04-13 16:29 ` [FFmpeg-devel] [PATCH 5/5] avutil/frame: deprecate key_frame James Almer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230413162940.61095-3-jamrial@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git