[FFmpeg-devel] [PATCH 2/3] lavfi/drawtext: take into account the timezone with basetime option.

Clément Bœsch ubitux at gmail.com
Fri Oct 26 19:15:40 CEST 2012


This way, basetime=0 will start at 00:00:00 whatever the timezone.
---
 libavfilter/vf_drawtext.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 7b67271..7653d5d 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -640,8 +640,13 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
     uint8_t *buf = dtext->expanded_text;
     int buf_size = dtext->expanded_text_size;
 
-    if(dtext->basetime != AV_NOPTS_VALUE)
+    if (dtext->basetime != AV_NOPTS_VALUE) {
         now= picref->pts*av_q2d(ctx->inputs[0]->time_base) + dtext->basetime/1000000;
+#if _XOPEN_SOURCE
+        tzset();
+        now += timezone;
+#endif
+    }
 
     if (!buf) {
         buf_size = 2*strlen(dtext->text)+1;
-- 
1.8.0



More information about the ffmpeg-devel mailing list