cycle time for synchronisation (my whishlist entry)
Brought to you by:
aeb,
bencollins
From: Manfred W. <e95...@st...> - 2000-04-28 16:11:42
|
Hi! Since the 1394 cycle time register provides a very accurate clock, it would be a perfect means for synchronisation purposes. I would like to use it for synchronisation of the video and audio frames of a DVB stream. But there is one big problem. If I liked to present a frame at a given cycle time T, I would have to use a code like this: quadlet_t buf; do raw1394_read(rawhandle, 0xffc0 | raw1394_get_local_id(handle), CSR_CYCLE_TIME, 4, &buf); while (T > buf); presentFrame(); The problem is, that this is busy waiting and therefore very cpu consuming. So it would be nice, if we could find a way to register something to get an information, when a given cycle time is reached. My idea is to register a callback funktion for that purpose. Consider this example: int timestamp_reached; int timer_callback() { timestamp_reached=1; return 0; } ... raw1394_set_cycletime_handler(rawhandle, T, timer_callback); timestamp_reached=0; while (!timestamp_reached) raw1394_loop_iterate(rawhandle); presentFrame(); I believe that this would be cleaner, because raw1394_loop_iterate is - afaik - blocking, and therefore this would not be busy waiting. So my question is, if it is possible to implement something like "raw1394_set_cycletime_handler" in the example above or something similar (another way would be not to register a callbackfunction, but just the address of a variable which will be incremented, when libraw receives the message, that the time was reached). And if it is possible, can you imagine to implement it in the near future? I think, that would be a really nice feature. Manfred Weihs |