diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-03-07 16:57:30 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-03-07 17:00:12 +0100 |
commit | 13a153d801011c4ec82b90af1351e10dcf1754e1 (patch) | |
tree | d6f5b51ed7135ca2cfbd27e20a1c00d14cf41b96 | |
parent | 328247076c7e77dea53ab59341ff1d85a1ad43cf (diff) | |
download | ffmpeg-13a153d801011c4ec82b90af1351e10dcf1754e1.tar.gz |
avfilter/f_sendcmd: export width and height too
-rw-r--r-- | doc/filters.texi | 6 | ||||
-rw-r--r-- | libavfilter/f_sendcmd.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/doc/filters.texi b/doc/filters.texi index 8427b88d3d..26c5b4db48 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -27041,6 +27041,12 @@ The end time in seconds of the current command interval. @item TI The interpolated time of the current command interval, TI = (T - TS) / (TE - TS). + +@item W +The video frame width. + +@item H +The video frame height. @end table @end table diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c index 7261a05aae..04bfc84a06 100644 --- a/libavfilter/f_sendcmd.c +++ b/libavfilter/f_sendcmd.c @@ -46,6 +46,8 @@ static const char *const var_names[] = { "TS", /* interval start time in seconds */ "TE", /* interval end time in seconds */ "TI", /* interval interpolated value: TI = (T - TS) / (TE - TS) */ + "W", /* width for video frames */ + "H", /* height for video frames */ NULL }; @@ -57,6 +59,8 @@ enum var_name { VAR_TS, VAR_TE, VAR_TI, + VAR_W, + VAR_H, VAR_VARS_NB }; @@ -531,6 +535,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref) var_values[VAR_TS] = start; var_values[VAR_TE] = end; var_values[VAR_TI] = (current - start) / (end - start); + var_values[VAR_W] = ref->width; + var_values[VAR_H] = ref->height; if ((ret = av_expr_parse_and_eval(&res, cmd->arg, var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, NULL)) < 0) { |