From 63624f966e4f24145bc6c1b1e6a441c119eb6976 Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Thu, 4 Mar 2010 22:12:35 +0100 Subject: [PATCH] dv1394src: Fix internal clock Fixes #593910. --- ext/raw1394/gst1394clock.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/raw1394/gst1394clock.c b/ext/raw1394/gst1394clock.c index 3a46d1522c..a14e2a28c6 100644 --- a/ext/raw1394/gst1394clock.c +++ b/ext/raw1394/gst1394clock.c @@ -124,10 +124,13 @@ gst_1394_clock_get_internal_time (GstClock * clock) } _1394clock->cycle_timer_lo = cycle_timer; - result = (((guint64) _1394clock->cycle_timer_hi) << 32) | cycle_timer; - result *= 40; + /* get the seconds from the cycleSeconds counter */ + result = (((((guint64) _1394clock->cycle_timer_hi) << 32) | + cycle_timer) >> 25) * GST_SECOND; + /* add the microseconds from the cycleCount counter */ + result += (((cycle_timer >> 13) & 0x1fff) * 125) * GST_USECOND; - GST_LOG_OBJECT (clock, "result %" G_GINT64_FORMAT, result); + GST_LOG_OBJECT (clock, "result %" GST_TIME_FORMAT, GST_TIME_ARGS (result)); } else { result = GST_CLOCK_TIME_NONE; }