Glyph *glyph;
dtext->class = &drawtext_class;
- av_opt_set_defaults2(dtext, 0, 0);
+ av_opt_set_defaults(dtext);
dtext->fontcolor_string = av_strdup("black");
dtext->boxcolor_string = av_strdup("white");
dtext->shadowcolor_string = av_strdup("black");
}
dtext->tabsize *= glyph->advance;
-#if !HAVE_LOCALTIME_R
- av_log(ctx, AV_LOG_WARNING, "strftime() expansion unavailable!\n");
-#endif
-
return 0;
}
static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
{
if(!strcmp(cmd, "reinit")){
+ int ret;
uninit(ctx);
- return init(ctx, arg, NULL);
+ if((ret=init(ctx, arg, NULL)) < 0)
+ return ret;
+ return config_input(ctx->inputs[0]);
}
return AVERROR(ENOSYS);
static int draw_glyphs(DrawTextContext *dtext, AVFilterBufferRef *picref,
int width, int height, const uint8_t rgbcolor[4], const uint8_t yuvcolor[4], int x, int y)
{
- char *text = HAVE_LOCALTIME_R ? dtext->expanded_text : dtext->text;
+ char *text = dtext->expanded_text;
uint32_t code = 0;
int i;
uint8_t *p;
Glyph *glyph = NULL, *prev_glyph = NULL;
Glyph dummy = { 0 };
-#if HAVE_LOCALTIME_R
time_t now = time(0);
struct tm ltime;
uint8_t *buf = dtext->expanded_text;
buf = av_malloc(buf_size);
}
+#if HAVE_LOCALTIME_R
localtime_r(&now, <ime);
+#else
+ if(strchr(dtext->text, '%'))
+ ltime= *localtime(&now);
+#endif
do {
*buf = 1;
return AVERROR(ENOMEM);
text = dtext->expanded_text = buf;
dtext->expanded_text_size = buf_size;
-#endif
if ((len = strlen(text)) > dtext->nb_positions) {
if (!(dtext->positions =
av_realloc(dtext->positions, len*sizeof(*dtext->positions))))