|
|
@ -571,29 +571,29 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, |
|
|
|
Glyph dummy = { 0 }; |
|
|
|
Glyph dummy = { 0 }; |
|
|
|
|
|
|
|
|
|
|
|
#if HAVE_LOCALTIME_R |
|
|
|
#if HAVE_LOCALTIME_R |
|
|
|
time_t now = time(0); |
|
|
|
time_t now = time(0); |
|
|
|
struct tm ltime; |
|
|
|
struct tm ltime; |
|
|
|
uint8_t *buf = dtext->expanded_text; |
|
|
|
uint8_t *buf = dtext->expanded_text; |
|
|
|
int buf_size = dtext->expanded_text_size; |
|
|
|
int buf_size = dtext->expanded_text_size; |
|
|
|
|
|
|
|
|
|
|
|
if (!buf) { |
|
|
|
if (!buf) { |
|
|
|
buf_size = 2*strlen(dtext->text)+1; |
|
|
|
buf_size = 2*strlen(dtext->text)+1; |
|
|
|
buf = av_malloc(buf_size); |
|
|
|
buf = av_malloc(buf_size); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
localtime_r(&now, <ime); |
|
|
|
localtime_r(&now, <ime); |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
do { |
|
|
|
*buf = 1; |
|
|
|
*buf = 1; |
|
|
|
if (strftime(buf, buf_size, dtext->text, <ime) != 0 || *buf == 0) |
|
|
|
if (strftime(buf, buf_size, dtext->text, <ime) != 0 || *buf == 0) |
|
|
|
break; |
|
|
|
break; |
|
|
|
buf_size *= 2; |
|
|
|
buf_size *= 2; |
|
|
|
} while ((buf = av_realloc(buf, buf_size))); |
|
|
|
} while ((buf = av_realloc(buf, buf_size))); |
|
|
|
|
|
|
|
|
|
|
|
if (!buf) |
|
|
|
if (!buf) |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
text = dtext->expanded_text = buf; |
|
|
|
text = dtext->expanded_text = buf; |
|
|
|
dtext->expanded_text_size = buf_size; |
|
|
|
dtext->expanded_text_size = buf_size; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
if ((len = strlen(text)) > dtext->nb_positions) { |
|
|
|
if ((len = strlen(text)) > dtext->nb_positions) { |
|
|
|
if (!(dtext->positions = |
|
|
|
if (!(dtext->positions = |
|
|
|