Browse code

drawtext: Support changing parameters through reinit command at runtime.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/08/29 03:47:33
Showing 1 changed files
... ...
@@ -401,6 +401,16 @@ static int config_input(AVFilterLink *inlink)
401 401
     return 0;
402 402
 }
403 403
 
404
+static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
405
+{
406
+    if(!strcmp(cmd, "reinit")){
407
+        uninit(ctx);
408
+        return init(ctx, arg, NULL);
409
+    }
410
+
411
+    return AVERROR(ENOSYS);
412
+}
413
+
404 414
 #define GET_BITMAP_VAL(r, c)                                            \
405 415
     bitmap->pixel_mode == FT_PIXEL_MODE_MONO ?                          \
406 416
         (bitmap->buffer[(r) * bitmap->pitch + ((c)>>3)] & (0x80 >> ((c)&7))) * 255 : \
... ...
@@ -707,4 +717,5 @@ AVFilter avfilter_vf_drawtext = {
707 707
     .outputs   = (AVFilterPad[]) {{ .name             = "default",
708 708
                                     .type             = AVMEDIA_TYPE_VIDEO, },
709 709
                                   { .name = NULL}},
710
+    .process_command = command,
710 711
 };