Merge commit '4c205f42c86ccefa093c59434669af34ad14a52b'
* commit '4c205f42c86ccefa093c59434669af34ad14a52b': vf_drawbox: make config_props work properly when called multiple times. vf_drawtext: do not reset the frame number in config_input. vf_fps: move initializing pts from config_props to init. Conflicts: libavfilter/vf_drawbox.c libavfilter/vf_drawtext.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
c7078f4907
@ -39,7 +39,8 @@ enum { Y, U, V, A };
|
||||
|
||||
typedef struct {
|
||||
const AVClass *class;
|
||||
int x, y, w, h, thickness;
|
||||
int x, y, w_opt, h_opt, w, h;
|
||||
int thickness;
|
||||
char *color_str;
|
||||
unsigned char yuv_color[4];
|
||||
int invert_color; ///< invert luma color
|
||||
@ -88,8 +89,8 @@ static int config_input(AVFilterLink *inlink)
|
||||
s->hsub = desc->log2_chroma_w;
|
||||
s->vsub = desc->log2_chroma_h;
|
||||
|
||||
if (s->w == 0) s->w = inlink->w;
|
||||
if (s->h == 0) s->h = inlink->h;
|
||||
s->w = (s->w_opt > 0) ? s->w_opt : inlink->w;
|
||||
s->h = (s->h_opt > 0) ? s->h_opt : inlink->h;
|
||||
|
||||
av_log(inlink->dst, AV_LOG_VERBOSE, "x:%d y:%d w:%d h:%d color:0x%02X%02X%02X%02X\n",
|
||||
s->x, s->y, s->w, s->h,
|
||||
@ -141,10 +142,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
static const AVOption drawbox_options[] = {
|
||||
{ "x", "set horizontal position of the left box edge", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS },
|
||||
{ "y", "set vertical position of the top box edge", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS },
|
||||
{ "width", "set width of the box", OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
|
||||
{ "w", "set width of the box", OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
|
||||
{ "height", "set height of the box", OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
|
||||
{ "h", "set height of the box", OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
|
||||
{ "width", "set width of the box", OFFSET(w_opt), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
|
||||
{ "w", "set width of the box", OFFSET(w_opt), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
|
||||
{ "height", "set height of the box", OFFSET(h_opt), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
|
||||
{ "h", "set height of the box", OFFSET(h_opt), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
|
||||
{ "color", "set color of the box", OFFSET(color_str), AV_OPT_TYPE_STRING, { .str = "black" }, CHAR_MIN, CHAR_MAX, FLAGS },
|
||||
{ "c", "set color of the box", OFFSET(color_str), AV_OPT_TYPE_STRING, { .str = "black" }, CHAR_MIN, CHAR_MAX, FLAGS },
|
||||
{ "thickness", "set the box maximum thickness", OFFSET(thickness), AV_OPT_TYPE_INT, {.i64=4}, 0, INT_MAX, FLAGS },
|
||||
|
@ -576,8 +576,6 @@ static int config_input(AVFilterLink *inlink)
|
||||
s->var_values[VAR_VSUB] = 1 << s->dc.vsub_max;
|
||||
s->var_values[VAR_X] = NAN;
|
||||
s->var_values[VAR_Y] = NAN;
|
||||
if (!s->reinit)
|
||||
s->var_values[VAR_N] = 0;
|
||||
s->var_values[VAR_T] = NAN;
|
||||
|
||||
av_lfg_init(&s->prng, av_get_random_seed());
|
||||
|
@ -77,6 +77,8 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
if (!(s->fifo = av_fifo_alloc(2*sizeof(AVFrame*))))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
s->pts = AV_NOPTS_VALUE;
|
||||
|
||||
av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", s->framerate.num, s->framerate.den);
|
||||
return 0;
|
||||
}
|
||||
@ -111,7 +113,6 @@ static int config_props(AVFilterLink* link)
|
||||
link->frame_rate= s->framerate;
|
||||
link->w = link->src->inputs[0]->w;
|
||||
link->h = link->src->inputs[0]->h;
|
||||
s->pts = AV_NOPTS_VALUE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user