[FFmpeg-devel] [PATCH 2/4] lavfi: split frame_count between input and output.
Nicolas George
george at nsup.org
Sun Oct 23 13:27:40 EEST 2016
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.
Signed-off-by: Nicolas George <george at nsup.org>
---
libavfilter/af_ashowinfo.c | 2 +-
libavfilter/af_volume.c | 2 +-
libavfilter/asrc_sine.c | 2 +-
libavfilter/avf_showfreqs.c | 4 ++--
libavfilter/avfilter.c | 5 +++--
libavfilter/avfilter.h | 2 +-
libavfilter/f_loop.c | 2 +-
libavfilter/f_metadata.c | 4 ++--
libavfilter/f_select.c | 2 +-
libavfilter/f_streamselect.c | 2 +-
libavfilter/vf_bbox.c | 2 +-
libavfilter/vf_blackdetect.c | 2 +-
libavfilter/vf_blend.c | 2 +-
libavfilter/vf_crop.c | 2 +-
libavfilter/vf_decimate.c | 2 +-
libavfilter/vf_detelecine.c | 2 +-
libavfilter/vf_drawtext.c | 4 ++--
libavfilter/vf_eq.c | 2 +-
libavfilter/vf_fade.c | 8 ++++----
libavfilter/vf_fieldhint.c | 14 +++++++-------
libavfilter/vf_fieldmatch.c | 6 +++---
libavfilter/vf_framestep.c | 2 +-
libavfilter/vf_geq.c | 2 +-
libavfilter/vf_hue.c | 2 +-
libavfilter/vf_overlay.c | 2 +-
libavfilter/vf_paletteuse.c | 2 +-
libavfilter/vf_perspective.c | 4 ++--
libavfilter/vf_rotate.c | 2 +-
libavfilter/vf_showinfo.c | 2 +-
libavfilter/vf_swaprect.c | 2 +-
libavfilter/vf_telecine.c | 2 +-
libavfilter/vf_tinterlace.c | 4 ++--
libavfilter/vf_vignette.c | 2 +-
libavfilter/vf_zoompan.c | 6 +++---
libavfilter/vsrc_mptestsrc.c | 2 +-
35 files changed, 55 insertions(+), 54 deletions(-)
diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
index ca33add..ba600cb 100644
--- a/libavfilter/af_ashowinfo.c
+++ b/libavfilter/af_ashowinfo.c
@@ -206,7 +206,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
"n:%"PRId64" pts:%s pts_time:%s pos:%"PRId64" "
"fmt:%s channels:%d chlayout:%s rate:%d nb_samples:%d "
"checksum:%08"PRIX32" ",
- inlink->frame_count,
+ inlink->frame_count_out,
av_ts2str(buf->pts), av_ts2timestr(buf->pts, &inlink->time_base),
av_frame_get_pkt_pos(buf),
av_get_sample_fmt_name(buf->format), av_frame_get_channels(buf), chlayout_str,
diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 4d6b916..6813403 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -393,7 +393,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
}
vol->var_values[VAR_PTS] = TS2D(buf->pts);
vol->var_values[VAR_T ] = TS2T(buf->pts, inlink->time_base);
- vol->var_values[VAR_N ] = inlink->frame_count;
+ vol->var_values[VAR_N ] = inlink->frame_count_out;
pos = av_frame_get_pkt_pos(buf);
vol->var_values[VAR_POS] = pos == -1 ? NAN : pos;
diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c
index 2a2f3c3..ff77526 100644
--- a/libavfilter/asrc_sine.c
+++ b/libavfilter/asrc_sine.c
@@ -219,7 +219,7 @@ static int request_frame(AVFilterLink *outlink)
SineContext *sine = outlink->src->priv;
AVFrame *frame;
double values[VAR_VARS_NB] = {
- [VAR_N] = outlink->frame_count,
+ [VAR_N] = outlink->frame_count_in,
[VAR_PTS] = sine->pts,
[VAR_T] = sine->pts * av_q2d(outlink->time_base),
[VAR_TB] = av_q2d(outlink->time_base),
diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c
index e2a923b..21735ed 100644
--- a/libavfilter/avf_showfreqs.c
+++ b/libavfilter/avf_showfreqs.c
@@ -326,12 +326,12 @@ static inline void plot_freq(ShowFreqsContext *s, int ch,
switch (s->avg) {
case 0:
- y = s->avg_data[ch][f] = !outlink->frame_count ? y : FFMIN(avg, y);
+ y = s->avg_data[ch][f] = !outlink->frame_count_in ? y : FFMIN(avg, y);
break;
case 1:
break;
default:
- s->avg_data[ch][f] = avg + y * (y - avg) / (FFMIN(outlink->frame_count + 1, s->avg) * y);
+ s->avg_data[ch][f] = avg + y * (y - avg) / (FFMIN(outlink->frame_count_in + 1, s->avg) * y);
y = s->avg_data[ch][f];
break;
}
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 1d469c3..662f933 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1120,7 +1120,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
pts = out->pts;
if (dstctx->enable_str) {
int64_t pos = av_frame_get_pkt_pos(out);
- dstctx->var_values[VAR_N] = link->frame_count;
+ dstctx->var_values[VAR_N] = link->frame_count_out;
dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
dstctx->var_values[VAR_W] = link->w;
dstctx->var_values[VAR_H] = link->h;
@@ -1132,7 +1132,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
filter_frame = default_filter_frame;
}
ret = filter_frame(link, out);
- link->frame_count++;
+ link->frame_count_out++;
ff_update_link_current_pts(link, pts);
return ret;
@@ -1221,6 +1221,7 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
}
link->frame_wanted_out = 0;
+ link->frame_count_in++;
/* Go directly to actual filtering if possible */
if (link->type == AVMEDIA_TYPE_AUDIO &&
link->min_samples &&
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 15d00f7..d21b144 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -533,7 +533,7 @@ struct AVFilterLink {
/**
* Number of past frames sent through the link.
*/
- int64_t frame_count;
+ int64_t frame_count_in, frame_count_out;
/**
* A pointer to a FFVideoFramePool struct.
diff --git a/libavfilter/f_loop.c b/libavfilter/f_loop.c
index 00e0215..69bfb10 100644
--- a/libavfilter/f_loop.c
+++ b/libavfilter/f_loop.c
@@ -298,7 +298,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
LoopContext *s = ctx->priv;
int ret = 0;
- if (inlink->frame_count >= s->start && s->size > 0 && s->loop != 0) {
+ if (inlink->frame_count_out >= s->start && s->size > 0 && s->loop != 0) {
if (s->nb_frames < s->size) {
if (!s->nb_frames)
s->start_pts = frame->pts;
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index f2c71d9..24deccf 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -315,14 +315,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
case METADATA_PRINT:
if (!s->key && e) {
s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%-7s\n",
- inlink->frame_count, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
+ inlink->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
s->print(ctx, "%s=%s\n", e->key, e->value);
while ((e = av_dict_get(*metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) {
s->print(ctx, "%s=%s\n", e->key, e->value);
}
} else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value)))) {
s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%-7s\n",
- inlink->frame_count, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
+ inlink->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
s->print(ctx, "%s=%s\n", s->key, e->value);
}
return ff_filter_frame(outlink, frame);
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 52f474e..03c1c0f 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -318,7 +318,7 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame)
if (isnan(select->var_values[VAR_START_T]))
select->var_values[VAR_START_T] = TS2D(frame->pts) * av_q2d(inlink->time_base);
- select->var_values[VAR_N ] = inlink->frame_count;
+ select->var_values[VAR_N ] = inlink->frame_count_out;
select->var_values[VAR_PTS] = TS2D(frame->pts);
select->var_values[VAR_T ] = TS2D(frame->pts) * av_q2d(inlink->time_base);
select->var_values[VAR_POS] = av_frame_get_pkt_pos(frame) == -1 ? NAN : av_frame_get_pkt_pos(frame);
diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c
index 03cedba..1a517bf 100644
--- a/libavfilter/f_streamselect.c
+++ b/libavfilter/f_streamselect.c
@@ -72,7 +72,7 @@ static int process_frame(FFFrameSync *fs)
AVFrame *out;
if (s->is_audio && s->last_pts[j] == in[j]->pts &&
- ctx->outputs[i]->frame_count > 0)
+ ctx->outputs[i]->frame_count_in > 0)
continue;
out = av_frame_clone(in[j]);
if (!out)
diff --git a/libavfilter/vf_bbox.c b/libavfilter/vf_bbox.c
index e92c3b4..86054b2 100644
--- a/libavfilter/vf_bbox.c
+++ b/libavfilter/vf_bbox.c
@@ -80,7 +80,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
h = box.y2 - box.y1 + 1;
av_log(ctx, AV_LOG_INFO,
- "n:%"PRId64" pts:%s pts_time:%s", inlink->frame_count,
+ "n:%"PRId64" pts:%s pts_time:%s", inlink->frame_count_out,
av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
if (has_bbox) {
diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c
index fbe3d10..0f6adf4 100644
--- a/libavfilter/vf_blackdetect.c
+++ b/libavfilter/vf_blackdetect.c
@@ -155,7 +155,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
av_log(ctx, AV_LOG_DEBUG,
"frame:%"PRId64" picture_black_ratio:%f pts:%s t:%s type:%c\n",
- inlink->frame_count, picture_black_ratio,
+ inlink->frame_count_out, picture_black_ratio,
av_ts2str(picref->pts), av_ts2timestr(picref->pts, &inlink->time_base),
av_get_picture_type_char(picref->pict_type));
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 2731ec8..a3235e6 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -352,7 +352,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
uint8_t *dst = td->dst->data[td->plane];
double values[VAR_VARS_NB];
- values[VAR_N] = td->inlink->frame_count;
+ values[VAR_N] = td->inlink->frame_count_out;
values[VAR_T] = td->dst->pts == AV_NOPTS_VALUE ? NAN : td->dst->pts * av_q2d(td->inlink->time_base);
values[VAR_W] = td->w;
values[VAR_H] = td->h;
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index bcdbb8c..85ea892 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -255,7 +255,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
frame->width = s->w;
frame->height = s->h;
- s->var_values[VAR_N] = link->frame_count;
+ s->var_values[VAR_N] = link->frame_count_out;
s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
NAN : frame->pts * av_q2d(link->time_base);
s->var_values[VAR_POS] = av_frame_get_pkt_pos(frame) == -1 ?
diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c
index 39c3331..1fb242a 100644
--- a/libavfilter/vf_decimate.c
+++ b/libavfilter/vf_decimate.c
@@ -223,7 +223,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
av_frame_free(&frame);
frame = dm->clean_src[i];
}
- frame->pts = av_rescale_q(outlink->frame_count, dm->ts_unit, (AVRational){1,1}) +
+ frame->pts = av_rescale_q(outlink->frame_count_in, dm->ts_unit, (AVRational){1,1}) +
(dm->start_pts == AV_NOPTS_VALUE ? 0 : dm->start_pts);
ret = ff_filter_frame(outlink, frame);
if (ret < 0)
diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
index 9a7b462..0d5f88d 100644
--- a/libavfilter/vf_detelecine.c
+++ b/libavfilter/vf_detelecine.c
@@ -335,7 +335,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
av_frame_copy_props(frame, inpicref);
frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
- av_rescale(outlink->frame_count, s->ts_unit.num,
+ av_rescale(outlink->frame_count_in, s->ts_unit.num,
s->ts_unit.den);
ret = ff_filter_frame(outlink, frame);
}
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 65d3baa..bf94915 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1184,7 +1184,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame,
if (s->tc_opt_string) {
char tcbuf[AV_TIMECODE_STR_SIZE];
- av_timecode_make_string(&s->tc, tcbuf, inlink->frame_count);
+ av_timecode_make_string(&s->tc, tcbuf, inlink->frame_count_out);
av_bprint_clear(bp);
av_bprintf(bp, "%s%s", s->text, tcbuf);
}
@@ -1345,7 +1345,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
#endif
}
- s->var_values[VAR_N] = inlink->frame_count+s->start_number;
+ s->var_values[VAR_N] = inlink->frame_count_out + s->start_number;
s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
NAN : frame->pts * av_q2d(inlink->time_base);
diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
index 5ecdb31..c450d5e 100644
--- a/libavfilter/vf_eq.c
+++ b/libavfilter/vf_eq.c
@@ -265,7 +265,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
av_frame_copy_props(out, in);
desc = av_pix_fmt_desc_get(inlink->format);
- eq->var_values[VAR_N] = inlink->frame_count;
+ eq->var_values[VAR_N] = inlink->frame_count_out;
eq->var_values[VAR_POS] = pos == -1 ? NAN : pos;
eq->var_values[VAR_T] = TS2T(in->pts, inlink->time_base);
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index 0496645..c30c41d 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -300,7 +300,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
if (s->fade_state == VF_FADE_WAITING) {
s->factor=0;
if (frame_timestamp >= s->start_time/(double)AV_TIME_BASE
- && inlink->frame_count >= s->start_frame) {
+ && inlink->frame_count_out >= s->start_frame) {
// Time to start fading
s->fade_state = VF_FADE_FADING;
@@ -311,15 +311,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
// Save start frame in case we are starting based on time and fading based on frames
if (s->start_time != 0 && s->start_frame == 0) {
- s->start_frame = inlink->frame_count;
+ s->start_frame = inlink->frame_count_out;
}
}
}
if (s->fade_state == VF_FADE_FADING) {
if (s->duration == 0) {
// Fading based on frame count
- s->factor = (inlink->frame_count - s->start_frame) * s->fade_per_frame;
- if (inlink->frame_count > s->start_frame + s->nb_frames) {
+ s->factor = (inlink->frame_count_out - s->start_frame) * s->fade_per_frame;
+ if (inlink->frame_count_out > s->start_frame + s->nb_frames) {
s->fade_state = VF_FADE_DONE;
}
diff --git a/libavfilter/vf_fieldhint.c b/libavfilter/vf_fieldhint.c
index 2b845e7..26551ce 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];
diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c
index e155712..54a2c7a 100644
--- a/libavfilter/vf_fieldmatch.c
+++ b/libavfilter/vf_fieldmatch.c
@@ -740,7 +740,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
/* scene change check */
if (fm->combmatch == COMBMATCH_SC) {
- if (fm->lastn == outlink->frame_count - 1) {
+ if (fm->lastn == outlink->frame_count_in - 1) {
if (fm->lastscdiff > fm->scthresh)
sc = 1;
} else if (luma_abs_diff(fm->prv, fm->src) > fm->scthresh) {
@@ -748,7 +748,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
}
if (!sc) {
- fm->lastn = outlink->frame_count;
+ fm->lastn = outlink->frame_count_in;
fm->lastscdiff = luma_abs_diff(fm->src, fm->nxt);
sc = fm->lastscdiff > fm->scthresh;
}
@@ -807,7 +807,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
dst->interlaced_frame = combs[match] >= fm->combpel;
if (dst->interlaced_frame) {
av_log(ctx, AV_LOG_WARNING, "Frame #%"PRId64" at %s is still interlaced\n",
- outlink->frame_count, av_ts2timestr(in->pts, &inlink->time_base));
+ outlink->frame_count_in, av_ts2timestr(in->pts, &inlink->time_base));
dst->top_field_first = field;
}
diff --git a/libavfilter/vf_framestep.c b/libavfilter/vf_framestep.c
index 6f198b8..8102e7c 100644
--- a/libavfilter/vf_framestep.c
+++ b/libavfilter/vf_framestep.c
@@ -63,7 +63,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
{
FrameStepContext *framestep = inlink->dst->priv;
- if (!(inlink->frame_count % framestep->frame_step)) {
+ if (!(inlink->frame_count_out % framestep->frame_step)) {
return ff_filter_frame(inlink->dst->outputs[0], ref);
} else {
av_frame_free(&ref);
diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
index 88d3b75..9d26f54 100644
--- a/libavfilter/vf_geq.c
+++ b/libavfilter/vf_geq.c
@@ -208,7 +208,7 @@ static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out;
double values[VAR_VARS_NB] = {
- [VAR_N] = inlink->frame_count,
+ [VAR_N] = inlink->frame_count_out,
[VAR_T] = in->pts == AV_NOPTS_VALUE ? NAN : in->pts * av_q2d(inlink->time_base),
};
diff --git a/libavfilter/vf_hue.c b/libavfilter/vf_hue.c
index b5d7213..0d2862f 100644
--- a/libavfilter/vf_hue.c
+++ b/libavfilter/vf_hue.c
@@ -318,7 +318,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
av_frame_copy_props(outpic, inpic);
}
- hue->var_values[VAR_N] = inlink->frame_count;
+ hue->var_values[VAR_N] = inlink->frame_count_out;
hue->var_values[VAR_T] = TS2T(inpic->pts, inlink->time_base);
hue->var_values[VAR_PTS] = TS2D(inpic->pts);
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index c592dca..fdd5380 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -655,7 +655,7 @@ static AVFrame *do_blend(AVFilterContext *ctx, AVFrame *mainpic,
if (s->eval_mode == EVAL_MODE_FRAME) {
int64_t pos = av_frame_get_pkt_pos(mainpic);
- s->var_values[VAR_N] = inlink->frame_count;
+ s->var_values[VAR_N] = inlink->frame_count_out;
s->var_values[VAR_T] = mainpic->pts == AV_NOPTS_VALUE ?
NAN : mainpic->pts * av_q2d(inlink->time_base);
s->var_values[VAR_POS] = pos == -1 ? NAN : pos;
diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index e063ff7..69d3be9 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -889,7 +889,7 @@ static AVFrame *apply_palette(AVFilterLink *inlink, AVFrame *in)
}
memcpy(out->data[1], s->palette, AVPALETTE_SIZE);
if (s->calc_mean_err)
- debug_mean_error(s, in, out, inlink->frame_count);
+ debug_mean_error(s, in, out, inlink->frame_count_out);
av_frame_free(&in);
return out;
}
diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c
index 287db68..d590cfa 100644
--- a/libavfilter/vf_perspective.c
+++ b/libavfilter/vf_perspective.c
@@ -135,8 +135,8 @@ static int calc_persp_luts(AVFilterContext *ctx, AVFilterLink *inlink)
double (*ref)[2] = s->ref;
double values[VAR_VARS_NB] = { [VAR_W] = inlink->w, [VAR_H] = inlink->h,
- [VAR_IN] = inlink->frame_count + 1,
- [VAR_ON] = outlink->frame_count + 1 };
+ [VAR_IN] = inlink->frame_count_out + 1,
+ [VAR_ON] = outlink->frame_count_in + 1 };
const int h = values[VAR_H];
const int w = values[VAR_W];
double x0, x1, x2, x3, x4, x5, x6, x7, x8, q;
diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c
index 42e725a..371ff7f 100644
--- a/libavfilter/vf_rotate.c
+++ b/libavfilter/vf_rotate.c
@@ -522,7 +522,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
}
av_frame_copy_props(out, in);
- rot->var_values[VAR_N] = inlink->frame_count;
+ rot->var_values[VAR_N] = inlink->frame_count_out;
rot->var_values[VAR_T] = TS2T(in->pts, inlink->time_base);
rot->angle = res = av_expr_eval(rot->angle_expr, rot->var_values, rot);
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 5146995..83d941c 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -107,7 +107,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
"n:%4"PRId64" pts:%7s pts_time:%-7s pos:%9"PRId64" "
"fmt:%s sar:%d/%d s:%dx%d i:%c iskey:%d type:%c "
"checksum:%08"PRIX32" plane_checksum:[%08"PRIX32,
- inlink->frame_count,
+ inlink->frame_count_out,
av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base), av_frame_get_pkt_pos(frame),
desc->name,
frame->sample_aspect_ratio.num, frame->sample_aspect_ratio.den,
diff --git a/libavfilter/vf_swaprect.c b/libavfilter/vf_swaprect.c
index a467627..a0aa59d 100644
--- a/libavfilter/vf_swaprect.c
+++ b/libavfilter/vf_swaprect.c
@@ -97,7 +97,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
var_values[VAR_A] = (float) inlink->w / inlink->h;
var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? av_q2d(inlink->sample_aspect_ratio) : 1;
var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
- var_values[VAR_N] = inlink->frame_count;
+ var_values[VAR_N] = inlink->frame_count_out;
var_values[VAR_T] = in->pts == AV_NOPTS_VALUE ? NAN : in->pts * av_q2d(inlink->time_base);
var_values[VAR_POS] = av_frame_get_pkt_pos(in) == -1 ? NAN : av_frame_get_pkt_pos(in);
diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c
index 58babca..35f382e 100644
--- a/libavfilter/vf_telecine.c
+++ b/libavfilter/vf_telecine.c
@@ -244,7 +244,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
av_frame_copy_props(frame, inpicref);
frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
- av_rescale(outlink->frame_count, s->ts_unit.num,
+ av_rescale(outlink->frame_count_in, s->ts_unit.num,
s->ts_unit.den);
ret = ff_filter_frame(outlink, frame);
}
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index 8a796ce..80146a9 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -280,12 +280,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
copy_picture_field(tinterlace, out->data, out->linesize,
(const uint8_t **)cur->data, cur->linesize,
inlink->format, inlink->w, inlink->h,
- FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? inlink->frame_count & 1 ? FIELD_LOWER : FIELD_UPPER : FIELD_UPPER, tinterlace->flags);
+ FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? inlink->frame_count_out & 1 ? FIELD_LOWER : FIELD_UPPER : FIELD_UPPER, tinterlace->flags);
/* write even frame lines into the lower field of the new frame */
copy_picture_field(tinterlace, out->data, out->linesize,
(const uint8_t **)next->data, next->linesize,
inlink->format, inlink->w, inlink->h,
- FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? inlink->frame_count & 1 ? FIELD_UPPER : FIELD_LOWER : FIELD_LOWER, tinterlace->flags);
+ FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? inlink->frame_count_out & 1 ? FIELD_UPPER : FIELD_LOWER : FIELD_LOWER, tinterlace->flags);
if (tinterlace->mode != MODE_MERGEX2)
av_frame_free(&tinterlace->next);
break;
diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c
index 1d66c50..94b6c6f 100644
--- a/libavfilter/vf_vignette.c
+++ b/libavfilter/vf_vignette.c
@@ -165,7 +165,7 @@ static void update_context(VignetteContext *s, AVFilterLink *inlink, AVFrame *fr
int dst_linesize = s->fmap_linesize;
if (frame) {
- s->var_values[VAR_N] = inlink->frame_count;
+ s->var_values[VAR_N] = inlink->frame_count_out;
s->var_values[VAR_T] = TS2T(frame->pts, inlink->time_base);
s->var_values[VAR_PTS] = TS2D(frame->pts);
} else {
diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c
index 7a71503..136d6c8 100644
--- a/libavfilter/vf_zoompan.c
+++ b/libavfilter/vf_zoompan.c
@@ -149,7 +149,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va
var_values[VAR_PDURATION] = s->prev_nb_frames;
var_values[VAR_TIME] = pts * av_q2d(outlink->time_base);
var_values[VAR_FRAME] = i;
- var_values[VAR_ON] = outlink->frame_count + 1;
+ var_values[VAR_ON] = outlink->frame_count_in + 1;
if ((ret = av_expr_parse_and_eval(zoom, s->zoom_expr_str,
var_names, var_values,
NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
@@ -235,8 +235,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = in->height;
s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = s->w;
s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = s->h;
- s->var_values[VAR_IN] = inlink->frame_count + 1;
- s->var_values[VAR_ON] = outlink->frame_count + 1;
+ s->var_values[VAR_IN] = inlink->frame_count_out + 1;
+ s->var_values[VAR_ON] = outlink->frame_count_in + 1;
s->var_values[VAR_PX] = s->x;
s->var_values[VAR_PY] = s->y;
s->var_values[VAR_X] = 0;
diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c
index 3c75821..c5fdea7 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -303,7 +303,7 @@ static int request_frame(AVFilterLink *outlink)
AVFrame *picref;
int w = WIDTH, h = HEIGHT,
cw = AV_CEIL_RSHIFT(w, test->hsub), ch = AV_CEIL_RSHIFT(h, test->vsub);
- unsigned int frame = outlink->frame_count;
+ unsigned int frame = outlink->frame_count_in;
enum test_type tt = test->test;
int i;
--
2.9.3
More information about the ffmpeg-devel
mailing list