From 66f3658e7c731105a40090bcdbd4157162501e4c Mon Sep 17 00:00:00 2001 From: Koos Vriezen Date: Mon, 12 May 2008 18:18:22 +0200 Subject: [PATCH] Partially implement start synced on an element begin time Is used a lot in canals.smi (the center link on http://homepages.cwi.nl/~media/SMIL/fiets/fiets.smil --- src/laugh-timing.c | 25 +++++++++++++++++++++++++ src/laugh-timing.h | 1 + 2 files changed, 26 insertions(+) diff --git a/src/laugh-timing.c b/src/laugh-timing.c index b8b32d2..74092bf 100644 --- a/src/laugh-timing.c +++ b/src/laugh-timing.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "laugh-timing.h" @@ -542,6 +543,7 @@ gboolean laugh_timing_setting_start (LaughRoleTiming *segment) g_printf ("laugh_timing_setting_start %s\n", laugh_tag_from_id (segment->node->id)); segment->active = TRUE; + segment->start_time_stamp = clutter_get_timestamp (); if (segment->begin) { tt = segment->begin->type; @@ -556,6 +558,29 @@ gboolean laugh_timing_setting_start (LaughRoleTiming *segment) else _laugh_timing_setting_started (segment); break; + case LaughTimingStartSync: + if (segment->begin->element_id) { + LaughRoleTiming *role; + LaughNode *elm = laugh_document_get_element_by_id ( + segment->node->document, + laugh_document_id_from_string ( + segment->node->document, segment->begin->element_id)); + if (!elm) + break; + role = (LaughRoleTiming *) laugh_node_role_get (elm, LaughRoleTypeTiming); + if (!role) + break; + if (elm->state >= LaughStateBegun) { + glong diff = (clutter_get_timestamp ()-role->start_time_stamp) / 1000; + if (diff < offset) + segment->begin->handler_id = g_timeout_add (offset - diff, + _laugh_timing_timeout, segment); + else + _laugh_timing_setting_started (segment); + } else { + g_printf ("TODO: laugh_timing_setting_start StartSync\n"); + } + } /*TODO other types*/ default: break; diff --git a/src/laugh-timing.h b/src/laugh-timing.h index 555b374..ff38273 100644 --- a/src/laugh-timing.h +++ b/src/laugh-timing.h @@ -84,6 +84,7 @@ struct _LaughRoleTiming LaughTiming *end; gboolean active; + gulong start_time_stamp; GSList *sub_segments; LaughRoleTiming *parent; -- 2.11.4.GIT