diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-08-06 08:50:21 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-08-15 19:34:27 +0200 |
commit | 42cbf66fffed5a8bba2f14b5247ce60d788b9e01 (patch) | |
tree | 4b744e56f719ffc0455331703e844bf1299b8db9 /libavfilter/vf_fieldhint.c | |
parent | a23d565ea7d41e61f160578f9714a23e695f3bfd (diff) | |
download | ffmpeg-42cbf66fffed5a8bba2f14b5247ce60d788b9e01.tar.gz |
lavfi: move AVFilterLink.{frame,sample}_count_{in,out} to FilterLink
Diffstat (limited to 'libavfilter/vf_fieldhint.c')
-rw-r--r-- | libavfilter/vf_fieldhint.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libavfilter/vf_fieldhint.c b/libavfilter/vf_fieldhint.c index 8d0e715749..0320484d5c 100644 --- a/libavfilter/vf_fieldhint.c +++ b/libavfilter/vf_fieldhint.c @@ -25,6 +25,7 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" +#include "filters.h" #include "formats.h" #include "internal.h" #include "video.h" @@ -113,8 +114,10 @@ static int config_input(AVFilterLink *inlink) static int filter_frame(AVFilterLink *inlink, AVFrame *in) { + FilterLink *inl = ff_filter_link(inlink); AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; + FilterLink *outl = ff_filter_link(outlink); FieldHintContext *s = ctx->priv; AVFrame *out, *top, *bottom; char buf[1024] = { 0 }; @@ -152,9 +155,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } switch (s->mode) { case ABSOLUTE_HINT: - if (tf > outlink->frame_count_in + 1 || tf < FFMAX(0, outlink->frame_count_in - 1) || - bf > outlink->frame_count_in + 1 || bf < FFMAX(0, outlink->frame_count_in - 1)) { - av_log(ctx, AV_LOG_ERROR, "Out of range frames %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inlink->frame_count_out); + if (tf > outl->frame_count_in + 1 || tf < FFMAX(0, outl->frame_count_in - 1) || + bf > outl->frame_count_in + 1 || bf < FFMAX(0, outl->frame_count_in - 1)) { + av_log(ctx, AV_LOG_ERROR, "Out of range frames %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inl->frame_count_out); return AVERROR_INVALIDDATA; } break; @@ -162,7 +165,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) case RELATIVE_HINT: if (tf > 1 || tf < -1 || bf > 1 || bf < -1) { - av_log(ctx, AV_LOG_ERROR, "Out of range %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inlink->frame_count_out); + av_log(ctx, AV_LOG_ERROR, "Out of range %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inl->frame_count_out); return AVERROR_INVALIDDATA; } break; @@ -175,7 +178,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) fseek(s->hint, 0, SEEK_SET); continue; } - av_log(ctx, AV_LOG_ERROR, "Missing entry for %"PRId64". input frame.\n", inlink->frame_count_out); + av_log(ctx, AV_LOG_ERROR, "Missing entry for %"PRId64". input frame.\n", inl->frame_count_out); return AVERROR_INVALIDDATA; } } @@ -187,8 +190,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) switch (s->mode) { case ABSOLUTE_HINT: - top = s->frame[tf - outlink->frame_count_in + 1]; - bottom = s->frame[bf - outlink->frame_count_in + 1]; + top = s->frame[tf - outl->frame_count_in + 1]; + bottom = s->frame[bf - outl->frame_count_in + 1]; break; case PATTERN_HINT: case RELATIVE_HINT: |