Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer authored on 2011/08/31 06:37:49... | ... |
@@ -81,6 +81,7 @@ typedef struct { |
81 | 81 |
int pixel_step[4]; ///< distance in bytes between the component of each pixel |
82 | 82 |
uint8_t rgba_map[4]; ///< map RGBA offsets to the positions in the packed RGBA format |
83 | 83 |
uint8_t *box_line[4]; ///< line used for filling the box background |
84 |
+ int64_t basetime; ///< base pts time in the real world for display |
|
84 | 85 |
} DrawTextContext; |
85 | 86 |
|
86 | 87 |
#define OFFSET(x) offsetof(DrawTextContext, x) |
... | ... |
@@ -99,6 +100,8 @@ static const AVOption drawtext_options[]= { |
99 | 99 |
{"shadowx", "set x", OFFSET(shadowx), FF_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX }, |
100 | 100 |
{"shadowy", "set y", OFFSET(shadowy), FF_OPT_TYPE_INT, {.dbl=0}, INT_MIN, INT_MAX }, |
101 | 101 |
{"tabsize", "set tab size", OFFSET(tabsize), FF_OPT_TYPE_INT, {.dbl=4}, 0, INT_MAX }, |
102 |
+{"basetime", "set base time", OFFSET(basetime), FF_OPT_TYPE_INT64, {.dbl=AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX }, |
|
103 |
+ |
|
102 | 104 |
|
103 | 105 |
/* FT_LOAD_* flags */ |
104 | 106 |
{"ft_load_flags", "set font loading flags for libfreetype", OFFSET(ft_load_flags), FF_OPT_TYPE_FLAGS, {.dbl=FT_LOAD_DEFAULT|FT_LOAD_RENDER}, 0, INT_MAX, 0, "ft_load_flags" }, |
... | ... |
@@ -574,6 +577,9 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, |
574 | 574 |
uint8_t *buf = dtext->expanded_text; |
575 | 575 |
int buf_size = dtext->expanded_text_size; |
576 | 576 |
|
577 |
+ if(dtext->basetime != AV_NOPTS_VALUE) |
|
578 |
+ now= picref->pts*av_q2d(ctx->inputs[0]->time_base) + dtext->basetime/1000000; |
|
579 |
+ |
|
577 | 580 |
if (!buf) { |
578 | 581 |
buf_size = 2*strlen(dtext->text)+1; |
579 | 582 |
buf = av_malloc(buf_size); |