summaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_drawbox.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-10-08 22:04:02 +0200
committerPaul B Mahol <onemda@gmail.com>2019-10-14 11:40:17 +0200
commit9e883a1448a172bef151e23a59e6b6a7f53596fc (patch)
tree04f50b847616506833b35856a8b2be62fae97887 /libavfilter/vf_drawbox.c
parent4568e54cc51cf796b86a3dc7be8289108d58ae4c (diff)
downloadffmpeg-streaming-9e883a1448a172bef151e23a59e6b6a7f53596fc.zip
ffmpeg-streaming-9e883a1448a172bef151e23a59e6b6a7f53596fc.tar.gz
avfilter/vf_drawbox: use ff_filter_process_command()
Diffstat (limited to 'libavfilter/vf_drawbox.c')
-rw-r--r--libavfilter/vf_drawbox.c55
1 files changed, 24 insertions, 31 deletions
diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c
index e5f5351..d71e3af 100644
--- a/libavfilter/vf_drawbox.c
+++ b/libavfilter/vf_drawbox.c
@@ -275,46 +275,39 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
{
+ AVFilterLink *inlink = ctx->inputs[0];
DrawBoxContext *s = ctx->priv;
+ int old_x = s->x;
+ int old_y = s->y;
+ int old_w = s->w;
+ int old_h = s->h;
+ int old_t = s->thickness;
+ int old_r = s->replace;
int ret;
- if ( !strcmp(cmd, "w") || !strcmp(cmd, "width")
- || !strcmp(cmd, "h") || !strcmp(cmd, "height")
- || !strcmp(cmd, "x") || !strcmp(cmd, "y")
- || !strcmp(cmd, "t") || !strcmp(cmd, "thickness")
- || !strcmp(cmd, "c") || !strcmp(cmd, "color")
- || !strcmp(cmd, "replace")) {
-
- int old_x = s->x;
- int old_y = s->y;
- int old_w = s->w;
- int old_h = s->h;
- int old_t = s->thickness;
- int old_r = s->replace;
-
- AVFilterLink *inlink = ctx->inputs[0];
-
- av_opt_set(s, cmd, args, 0);
- init(ctx);
-
- if ((ret = config_input(inlink)) < 0) {
- s->x = old_x;
- s->y = old_y;
- s->w = old_w;
- s->h = old_h;
- s->thickness = old_t;
- s->replace = old_r;
- return ret;
- }
- } else {
- ret = AVERROR(ENOSYS);
+ ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
+ if (ret < 0)
+ return ret;
+
+ ret = init(ctx);
+ if (ret < 0)
+ goto end;
+ ret = config_input(inlink);;
+end:
+ if (ret < 0) {
+ s->x = old_x;
+ s->y = old_y;
+ s->w = old_w;
+ s->h = old_h;
+ s->thickness = old_t;
+ s->replace = old_r;
}
return ret;
}
#define OFFSET(x) offsetof(DrawBoxContext, x)
-#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
#if CONFIG_DRAWBOX_FILTER
OpenPOWER on IntegriCloud