diff options
author | Nicolas George <george@nsup.org> | 2016-08-30 15:28:41 +0200 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2016-11-13 10:41:16 +0100 |
commit | 183ce55b0de0a597b838d08bbac67f54c27ed42f (patch) | |
tree | ffd40aaf4f522d18b6b87b35e1b49f276cff913d /libavfilter/vf_fieldhint.c | |
parent | 22aa649c13b452f11353958a51f073f5fbc3bcaa (diff) |
lavfi: split frame_count between input and output.
AVFilterLink.frame_count is supposed to count the number of frames
that were passed on the link, but with min_samples, that number is
not always the same for the source and destination filters.
With the addition of a FIFO on the link, the difference will become
more significant.
Split the variable in two: frame_count_in counts the number of
frames that entered the link, frame_count_out counts the number
of frames that were sent to the destination filter.
Diffstat (limited to 'libavfilter/vf_fieldhint.c')
-rw-r--r-- | libavfilter/vf_fieldhint.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libavfilter/vf_fieldhint.c b/libavfilter/vf_fieldhint.c index 2b845e7330..26551ce7a8 100644 --- a/libavfilter/vf_fieldhint.c +++ b/libavfilter/vf_fieldhint.c @@ -147,22 +147,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } switch (s->mode) { case 0: - if (tf > outlink->frame_count + 1 || tf < FFMAX(0, outlink->frame_count - 1) || - bf > outlink->frame_count + 1 || bf < FFMAX(0, outlink->frame_count - 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); + 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); return AVERROR_INVALIDDATA; } break; case 1: 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); + 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); return AVERROR_INVALIDDATA; } }; break; } else { - av_log(ctx, AV_LOG_ERROR, "Missing entry for %"PRId64". input frame.\n", inlink->frame_count); + av_log(ctx, AV_LOG_ERROR, "Missing entry for %"PRId64". input frame.\n", inlink->frame_count_out); return AVERROR_INVALIDDATA; } } @@ -174,8 +174,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) switch (s->mode) { case 0: - top = s->frame[tf - outlink->frame_count + 1]; - bottom = s->frame[bf - outlink->frame_count + 1]; + top = s->frame[tf - outlink->frame_count_in + 1]; + bottom = s->frame[bf - outlink->frame_count_in + 1]; break; case 1: top = s->frame[1 + tf]; |