Commit b1dea2c0 authored by Paul B Mahol's avatar Paul B Mahol

lavfi/blend: add N variable

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 6a08ccd6
...@@ -1936,6 +1936,9 @@ of @var{all_expr}. Note that related mode options will be ignored if those are s ...@@ -1936,6 +1936,9 @@ of @var{all_expr}. Note that related mode options will be ignored if those are s
The expressions can use the following variables: The expressions can use the following variables:
@table @option @table @option
@item N
The sequential number of the filtered frame, starting from @code{0}.
@item X @item X
@item Y @item Y
the coordinates of the current sample the coordinates of the current sample
......
...@@ -60,8 +60,8 @@ enum BlendMode { ...@@ -60,8 +60,8 @@ enum BlendMode {
BLEND_NB BLEND_NB
}; };
static const char *const var_names[] = { "X", "Y", "W", "H", "SW", "SH", "T", "A", "B", "TOP", "BOTTOM", NULL }; static const char *const var_names[] = { "X", "Y", "W", "H", "SW", "SH", "T", "N", "A", "B", "TOP", "BOTTOM", NULL };
enum { VAR_X, VAR_Y, VAR_W, VAR_H, VAR_SW, VAR_SH, VAR_T, VAR_A, VAR_B, VAR_TOP, VAR_BOTTOM, VAR_VARS_NB }; enum { VAR_X, VAR_Y, VAR_W, VAR_H, VAR_SW, VAR_SH, VAR_T, VAR_N, VAR_A, VAR_B, VAR_TOP, VAR_BOTTOM, VAR_VARS_NB };
typedef struct FilterParams { typedef struct FilterParams {
enum BlendMode mode; enum BlendMode mode;
...@@ -81,6 +81,7 @@ typedef struct { ...@@ -81,6 +81,7 @@ typedef struct {
struct FFBufQueue queue_bottom; struct FFBufQueue queue_bottom;
int hsub, vsub; ///< chroma subsampling values int hsub, vsub; ///< chroma subsampling values
int frame_requested; int frame_requested;
int framenum;
char *all_expr; char *all_expr;
enum BlendMode all_mode; enum BlendMode all_mode;
double all_opacity; double all_opacity;
...@@ -387,6 +388,7 @@ static void blend_frame(AVFilterContext *ctx, ...@@ -387,6 +388,7 @@ static void blend_frame(AVFilterContext *ctx,
uint8_t *bottom = bottom_buf->data[plane]; uint8_t *bottom = bottom_buf->data[plane];
param = &b->params[plane]; param = &b->params[plane];
param->values[VAR_N] = b->framenum++;
param->values[VAR_T] = dst_buf->pts == AV_NOPTS_VALUE ? NAN : dst_buf->pts * av_q2d(inlink->time_base); param->values[VAR_T] = dst_buf->pts == AV_NOPTS_VALUE ? NAN : dst_buf->pts * av_q2d(inlink->time_base);
param->values[VAR_W] = outw; param->values[VAR_W] = outw;
param->values[VAR_H] = outh; param->values[VAR_H] = outh;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment