[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:53:09 CEST 2012


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

The #ifdef didn't actually serve any purpose and was wrong. Should be good
now, sorry for the noise.

-- 
Clément B.
-------------- next part --------------
From bc425cb022a374ef4d4a963a0a02961bfc1b61b1 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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 7b67271..76bce5e 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,10 @@ 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;
+        now += timezone;
+    }
 
     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/dccdb84e/attachment.asc>


More information about the ffmpeg-devel mailing list