drawtext: Support changing parameters through reinit command at runtime.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-08-28 20:47:33 +02:00
parent bb22f39fe2
commit f782ce3b4d
1 changed files with 11 additions and 0 deletions

View File

@ -401,6 +401,16 @@ static int config_input(AVFilterLink *inlink)
return 0; return 0;
} }
static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
{
if(!strcmp(cmd, "reinit")){
uninit(ctx);
return init(ctx, arg, NULL);
}
return AVERROR(ENOSYS);
}
#define GET_BITMAP_VAL(r, c) \ #define GET_BITMAP_VAL(r, c) \
bitmap->pixel_mode == FT_PIXEL_MODE_MONO ? \ bitmap->pixel_mode == FT_PIXEL_MODE_MONO ? \
(bitmap->buffer[(r) * bitmap->pitch + ((c)>>3)] & (0x80 >> ((c)&7))) * 255 : \ (bitmap->buffer[(r) * bitmap->pitch + ((c)>>3)] & (0x80 >> ((c)&7))) * 255 : \
@ -707,4 +717,5 @@ AVFilter avfilter_vf_drawtext = {
.outputs = (AVFilterPad[]) {{ .name = "default", .outputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO, }, .type = AVMEDIA_TYPE_VIDEO, },
{ .name = NULL}}, { .name = NULL}},
.process_command = command,
}; };