From 61b284de0d44247316fd185134c293d026e4131c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 11 Feb 2009 18:40:55 +0100 Subject: mxfdemux: Parse MXFTimestamp's milliseconds and add _to_string() function --- gst/mxf/mxfparse.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gst/mxf/mxfparse.c') diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c index c5c81fdb..2611e817 100644 --- a/gst/mxf/mxfparse.c +++ b/gst/mxf/mxfparse.c @@ -357,7 +357,7 @@ mxf_timestamp_parse (MXFTimestamp * timestamp, const guint8 * data, guint size) timestamp->hour = GST_READ_UINT8 (data + 4); timestamp->minute = GST_READ_UINT8 (data + 5); timestamp->second = GST_READ_UINT8 (data + 6); - timestamp->quarter_msecond = GST_READ_UINT8 (data + 7); + timestamp->msecond = (GST_READ_UINT8 (data + 7) * 1000) / 256; return TRUE; } @@ -385,12 +385,21 @@ mxf_timestamp_compare (const MXFTimestamp * a, const MXFTimestamp * b) return diff; else if ((diff = a->second - b->second) != 0) return diff; - else if ((diff = a->quarter_msecond - b->quarter_msecond) != 0) + else if ((diff = a->msecond - b->msecond) != 0) return diff; else return 0; } +gchar * +mxf_timestamp_to_string (const MXFTimestamp * t, gchar str[32]) +{ + g_snprintf (str, 32, + "%04d-%02u-%02u %02u:%02u:%02u.%03u", t->year, t->month, + t->day, t->hour, t->minute, t->second, t->msecond); + return str; +} + gboolean mxf_fraction_parse (MXFFraction * fraction, const guint8 * data, guint size) { -- cgit v1.2.1