"T", /* frame time in seconds */
"POS", /* original position in the file of the frame */
"PTS", /* frame pts */
+ "TS", /* interval start time in seconds */
+ "TE", /* interval end time in seconds */
+ "TI", /* interval interpolated value: TI = (T - TS) / (TE - TS) */
NULL
};
VAR_T,
VAR_POS,
VAR_PTS,
+ VAR_TS,
+ VAR_TE,
+ VAR_TI,
VAR_VARS_NB
};
av_freep(&s->intervals);
}
-#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
-
static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
{
AVFilterContext *ctx = inlink->dst;
if (cmd->flags & flags) {
if (cmd->flags & COMMAND_FLAG_EXPR) {
double var_values[VAR_VARS_NB], res;
+ double start = TS2T(interval->start_ts, AV_TIME_BASE_Q);
+ double end = TS2T(interval->end_ts, AV_TIME_BASE_Q);
+ double current = TS2T(ref->pts, inlink->time_base);
var_values[VAR_N] = inlink->frame_count_in;
var_values[VAR_POS] = ref->pkt_pos == -1 ? NAN : ref->pkt_pos;
var_values[VAR_PTS] = TS2D(ref->pts);
- var_values[VAR_T] = TS2T(ref->pts, inlink->time_base);
+ var_values[VAR_T] = current;
+ var_values[VAR_TS] = start;
+ var_values[VAR_TE] = end;
+ var_values[VAR_TI] = (current - start) / (end - start);
if ((ret = av_expr_parse_and_eval(&res, cmd->arg, var_names, var_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL)) < 0) {
{ NULL }
};
-AVFilter ff_vf_sendcmd = {
+const AVFilter ff_vf_sendcmd = {
.name = "sendcmd",
.description = NULL_IF_CONFIG_SMALL("Send commands to filters."),
.init = init,
{ NULL }
};
-AVFilter ff_af_asendcmd = {
+const AVFilter ff_af_asendcmd = {
.name = "asendcmd",
.description = NULL_IF_CONFIG_SMALL("Send commands to filters."),
.init = init,