[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:25:10 CEST 2012


On Fri, Oct 26, 2012 at 07:15:40PM +0200, Clément Bœsch wrote:
> 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;

Hum, new patch attached.

-- 
Clément B.
-------------- next part --------------
From 76bbef0e30fcecae87a421d459c51235c38c54b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <ubitux at gmail.com>
Date: Fri, 26 Oct 2012 18:41:50 +0200
Subject: [PATCH 2/3] lavfi/drawtext: take into account the timezone with
 basetime option.

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

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 7b67271..a3f31a9 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -484,6 +484,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
     }
     dtext->tabsize *= glyph->advance;
 
+    /* for timezone init */
+    tzset();
+
     return 0;
 }
 
@@ -640,8 +643,12 @@ 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;
+#ifdef _XOPEN_SOURCE
+        now += timezone;
+#endif
+    }
 
     if (!buf) {
         buf_size = 2*strlen(dtext->text)+1;
-- 
1.8.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121026/a6ff7250/attachment.asc>


More information about the ffmpeg-devel mailing list