"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,
}
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;
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),
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;
}
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;
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;
}
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 &&
/**
* 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.
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;
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);
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);
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)
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) {
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));
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;
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 ?
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)
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);
}
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);
}
#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);
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);
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;
// 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;
}
}
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;
}
}
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];
/* 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) {
}
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;
}
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;
}
{
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);
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),
};
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);
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;
}
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;
}
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;
}
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);
"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,
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);
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);
}
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;
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 {
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)
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;
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;