diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2011-04-14 18:20:07 +0100 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2011-04-14 21:00:40 +0100 |
commit | 96178f61e788cfac8327a1866dcaeaf5afa55d7b (patch) | |
tree | 64148892decedc94f97597daf218aa7b3532b957 | |
parent | 8a58761ad941551fda72aa332c080cb5b2c487d3 (diff) |
chapters: Fix output of timestamps from the chapters plugin
It wasn't outputting timestamps that it could read for any times greater
than 1 minute.
This fixes it to output correct NPT-formatted timestamps for all times,
which it can read.
Closes: bgo#647513
-rw-r--r-- | src/plugins/chapters/totem-cmml-parser.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/chapters/totem-cmml-parser.c b/src/plugins/chapters/totem-cmml-parser.c index 07a761ea..01cacba9 100644 --- a/src/plugins/chapters/totem-cmml-parser.c +++ b/src/plugins/chapters/totem-cmml-parser.c @@ -805,6 +805,9 @@ totem_cmml_write_file_async (TotemCmmlAsyncData *data) guint8 *stream; TotemCmmlClip *clip; gchar start_buf[G_ASCII_DTOSTR_BUF_SIZE]; + gchar *start_string; + gint hours, minutes; + gdouble seconds; clip = (TotemCmmlClip *) cur_clip->data; time_start = ((gdouble) clip->time_start) / 1000; @@ -818,8 +821,13 @@ totem_cmml_write_file_async (TotemCmmlAsyncData *data) if (G_UNLIKELY (res < 0)) break; - res = xmlTextWriterWriteAttribute (writer, (const xmlChar *) "start", - (const xmlChar *) g_ascii_dtostr (start_buf, sizeof (buf), time_start)); + /* Format the time in NPT format (npt:%d:%d:%f) */ + hours = ((glong) time_start) / 3600; + minutes = ((glong) time_start % 3600) / 60; + seconds = time_start - ((glong) hours * 3600) - ((glong) minutes * 60); + start_string = g_strdup_printf ("npt:%d:%d:%s", hours, minutes, g_ascii_dtostr (start_buf, sizeof (buf), seconds)); + res = xmlTextWriterWriteAttribute (writer, (const xmlChar *) "start", (const xmlChar *) start_string); + g_free (start_string); if (G_UNLIKELY (res < 0)) break; |