[vlc-commits] demux: ttml: fix time parsing

Francois Cartegnie git at videolan.org
Thu Jan 26 21:01:22 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan 26 21:00:05 2017 +0100| [7ac323c5463cd78a69f24c68ac07035b2f7777ca] | committer: Francois Cartegnie

demux: ttml: fix time parsing

as provided by Filip Roséen <filip at atch.se>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7ac323c5463cd78a69f24c68ac07035b2f7777ca
---

 modules/demux/ttml.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 954727d..989f074 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -70,14 +70,14 @@ static char *tt_genTiming( int64_t i_time )
 {
     if( i_time < 0 )
         i_time = 0;
-    char *psz;
-    unsigned h, m, s, f;
-    f = (i_time % CLOCK_FREQ) / 10000;
+
+    unsigned f = (i_time % CLOCK_FREQ) / 10000;
     i_time /= CLOCK_FREQ;
-    h = i_time / 3600;
-    m = (i_time - h) / 3600;
-    s = (i_time - h - m);
+    unsigned h = i_time / 3600;
+    unsigned m = i_time % 3600 / 60;
+    unsigned s = i_time % 60;
 
+    char *psz;
     if( asprintf( &psz, "%2.2u:%2.2u:%2.2u.%2.2u",
                         h, m, s, f ) < 0 )
         psz = NULL;



More information about the vlc-commits mailing list