1/* GStreamer
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
4 * 2005 Wim Taymans <wim@fluendo.com>
5 *
6 * gstclock.h: Header for clock subsystem
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24#ifndef __GST_CLOCK_H__
25#define __GST_CLOCK_H__
26
27#include <gst/gstconfig.h>
28#include <glib.h>
29
30G_BEGIN_DECLS
31
32/* --- standard type macros --- */
33#define GST_TYPE_CLOCK (gst_clock_get_type ())
34#define GST_CLOCK(clock) (G_TYPE_CHECK_INSTANCE_CAST ((clock), GST_TYPE_CLOCK, GstClock))
35#define GST_IS_CLOCK(clock) (G_TYPE_CHECK_INSTANCE_TYPE ((clock), GST_TYPE_CLOCK))
36#define GST_CLOCK_CLASS(cclass) (G_TYPE_CHECK_CLASS_CAST ((cclass), GST_TYPE_CLOCK, GstClockClass))
37#define GST_IS_CLOCK_CLASS(cclass) (G_TYPE_CHECK_CLASS_TYPE ((cclass), GST_TYPE_CLOCK))
38#define GST_CLOCK_GET_CLASS(clock) (G_TYPE_INSTANCE_GET_CLASS ((clock), GST_TYPE_CLOCK, GstClockClass))
39#define GST_CLOCK_CAST(clock) ((GstClock*)(clock))
40
41/**
42 * GstClockTime:
43 *
44 * A datatype to hold a time, measured in nanoseconds.
45 */
46typedef guint64 GstClockTime;
47
48/**
49 * GST_TYPE_CLOCK_TIME:
50 *
51 * The #GType of a #GstClockTime.
52 */
53#define GST_TYPE_CLOCK_TIME G_TYPE_UINT64
54
55/**
56 * GstClockTimeDiff:
57 *
58 * A datatype to hold a time difference, measured in nanoseconds.
59 */
60typedef gint64 GstClockTimeDiff;
61/**
62 * GstClockID:
63 *
64 * A datatype to hold the handle to an outstanding sync or async clock callback.
65 */
66typedef gpointer GstClockID;
67
68/**
69 * GST_CLOCK_TIME_NONE: (value 18446744073709551615) (type GstClockTime)
70 *
71 * Constant to define an undefined clock time.
72 */
73#define GST_CLOCK_TIME_NONE ((GstClockTime) -1)
74/**
75 * GST_CLOCK_TIME_IS_VALID:
76 * @time: clock time to validate
77 *
78 * Tests if a given #GstClockTime represents a valid defined time.
79 */
80#define GST_CLOCK_TIME_IS_VALID(time) (((GstClockTime)(time)) != GST_CLOCK_TIME_NONE)
81
82/**
83 * GST_CLOCK_STIME_NONE: (value -9223372036854775808) (type GstClockTimeDiff)
84 *
85 * Constant to define an undefined clock time.
86 */
87#define GST_CLOCK_STIME_NONE ((GstClockTimeDiff)G_MININT64)
88/**
89 * GST_CLOCK_STIME_IS_VALID:
90 * @time: signed clock time to validate
91 *
92 * Tests if a given #GstClockTimeDiff of #gint64 represents a valid defined time.
93 *
94 * Since: 1.6
95 */
96#define GST_CLOCK_STIME_IS_VALID(time) (((GstClockTimeDiff)(time)) != GST_CLOCK_STIME_NONE)
97
98/**
99 * GST_SECOND: (value 1000000000) (type GstClockTimeDiff)
100 *
101 * Constant that defines one GStreamer second.
102 */
103#define GST_SECOND ((GstClockTimeDiff)(G_USEC_PER_SEC * G_GINT64_CONSTANT (1000)))
104/**
105 * GST_MSECOND: (value 1000000) (type GstClockTimeDiff)
106 *
107 * Constant that defines one GStreamer millisecond.
108 */
109#define GST_MSECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000)))
110/**
111 * GST_USECOND: (value 1000) (type GstClockTimeDiff)
112 *
113 * Constant that defines one GStreamer microsecond.
114 */
115#define GST_USECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000000)))
116/**
117 * GST_NSECOND: (value 1) (type GstClockTimeDiff)
118 *
119 * Constant that defines one GStreamer nanosecond
120 */
121#define GST_NSECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000000000)))
122
123
124/**
125 * GST_TIME_AS_SECONDS:
126 * @time: the time
127 *
128 * Converts a #GstClockTime to seconds.
129 */
130#define GST_TIME_AS_SECONDS(time) ((time) / GST_SECOND)
131/**
132 * GST_TIME_AS_MSECONDS:
133 * @time: the time
134 *
135 * Converts a #GstClockTime to milliseconds (1/1000 of a second).
136 */
137#define GST_TIME_AS_MSECONDS(time) ((time) / G_GINT64_CONSTANT (1000000))
138/**
139 * GST_TIME_AS_USECONDS:
140 * @time: the time
141 *
142 * Converts a #GstClockTime to microseconds (1/1000000 of a second).
143 */
144#define GST_TIME_AS_USECONDS(time) ((time) / G_GINT64_CONSTANT (1000))
145/**
146 * GST_TIME_AS_NSECONDS:
147 * @time: the time
148 *
149 * Converts a #GstClockTime to nanoseconds (1/1000000000 of a second).
150 */
151#define GST_TIME_AS_NSECONDS(time) (time)
152
153/**
154 * GST_CLOCK_DIFF:
155 * @s: the first time
156 * @e: the second time
157 *
158 * Calculates a difference between two clock times as a #GstClockTimeDiff.
159 * The difference is calculated as @e - @s.
160 */
161#define GST_CLOCK_DIFF(s, e) (GstClockTimeDiff)((e) - (s))
162
163/**
164 * GST_TIMEVAL_TO_TIME:
165 * @tv: the timeval to convert
166 *
167 * Converts a GTimeVal to a #GstClockTime.
168 */
169#define GST_TIMEVAL_TO_TIME(tv) (GstClockTime)((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND)
170
171/**
172 * GST_TIME_TO_TIMEVAL:
173 * @t: The #GstClockTime to convert
174 * @tv: The target timeval
175 *
176 * Converts a #GstClockTime to a GTimeVal
177 *
178 * > on 32-bit systems, a timeval has a range of only 2^32 - 1 seconds,
179 * > which is about 68 years. Expect trouble if you want to schedule stuff
180 * > in your pipeline for 2038.
181 */
182#define GST_TIME_TO_TIMEVAL(t,tv) \
183G_STMT_START { \
184 g_assert ("Value of time " #t " is out of timeval's range" && \
185 ((t) / GST_SECOND) < G_MAXLONG); \
186 (tv).tv_sec = (glong) (((GstClockTime) (t)) / GST_SECOND); \
187 (tv).tv_usec = (glong) ((((GstClockTime) (t)) - \
188 ((GstClockTime) (tv).tv_sec) * GST_SECOND) \
189 / GST_USECOND); \
190} G_STMT_END
191
192/**
193 * GST_TIMESPEC_TO_TIME:
194 * @ts: the timespec to convert
195 *
196 * Converts a struct timespec (see `man pselect`) to a #GstClockTime.
197 */
198#define GST_TIMESPEC_TO_TIME(ts) (GstClockTime)((ts).tv_sec * GST_SECOND + (ts).tv_nsec * GST_NSECOND)
199/**
200 * GST_TIME_TO_TIMESPEC:
201 * @t: The #GstClockTime to convert
202 * @ts: The target timespec
203 *
204 * Converts a #GstClockTime to a struct timespec (see `man pselect`)
205 */
206#define GST_TIME_TO_TIMESPEC(t,ts) \
207G_STMT_START { \
208 g_assert ("Value of time " #t " is out of timespec's range" && \
209 ((t) / GST_SECOND) < G_MAXLONG); \
210 (ts).tv_sec = (glong) ((t) / GST_SECOND); \
211 (ts).tv_nsec = (glong) (((t) - (ts).tv_sec * GST_SECOND) / GST_NSECOND); \
212} G_STMT_END
213
214/* timestamp debugging macros */
215/**
216 * GST_TIME_FORMAT: (skip):
217 *
218 * A string that can be used in printf-like format strings to display a
219 * #GstClockTime value in `h:m:s` format. Use GST_TIME_ARGS() to construct
220 * the matching arguments.
221 *
222 * Example:
223 *
224 * ``` C
225 * printf("%" GST_TIME_FORMAT "\n", GST_TIME_ARGS(ts));
226 * ```
227 */
228#define GST_TIME_FORMAT "u:%02u:%02u.%09u"
229/**
230 * GST_TIME_ARGS: (skip):
231 * @t: a #GstClockTime
232 *
233 * Formats @t for the #GST_TIME_FORMAT format string. Note: @t will be
234 * evaluated more than once.
235 */
236#define GST_TIME_ARGS(t) \
237 GST_CLOCK_TIME_IS_VALID (t) ? \
238 (guint) (((GstClockTime)(t)) / (GST_SECOND * 60 * 60)) : 99, \
239 GST_CLOCK_TIME_IS_VALID (t) ? \
240 (guint) ((((GstClockTime)(t)) / (GST_SECOND * 60)) % 60) : 99, \
241 GST_CLOCK_TIME_IS_VALID (t) ? \
242 (guint) ((((GstClockTime)(t)) / GST_SECOND) % 60) : 99, \
243 GST_CLOCK_TIME_IS_VALID (t) ? \
244 (guint) (((GstClockTime)(t)) % GST_SECOND) : 999999999
245/**
246 * GST_STIME_FORMAT: (skip):
247 *
248 * A string that can be used in printf-like format strings to display a signed
249 * #GstClockTimeDiff or #gint64 value in `h:m:s` format. Use GST_TIME_ARGS() to
250 * construct the matching arguments.
251 *
252 * Example:
253 *
254 * ``` C
255 * printf("%" GST_STIME_FORMAT "\n", GST_STIME_ARGS(ts));
256 * ```
257 *
258 * Since: 1.6
259 */
260#define GST_STIME_FORMAT "c%" GST_TIME_FORMAT
261/**
262 * GST_STIME_ARGS: (skip):
263 * @t: a #GstClockTimeDiff or #gint64
264 *
265 * Formats @t for the #GST_STIME_FORMAT format string. Note: @t will be
266 * evaluated more than once.
267 *
268 * Since: 1.6
269 */
270#define GST_STIME_ARGS(t) \
271 ((t) == GST_CLOCK_STIME_NONE || (t) >= 0) ? '+' : '-', \
272 GST_CLOCK_STIME_IS_VALID (t) ? \
273 (guint) (((GstClockTime)(ABS(t))) / (GST_SECOND * 60 * 60)) : 99, \
274 GST_CLOCK_STIME_IS_VALID (t) ? \
275 (guint) ((((GstClockTime)(ABS(t))) / (GST_SECOND * 60)) % 60) : 99, \
276 GST_CLOCK_STIME_IS_VALID (t) ? \
277 (guint) ((((GstClockTime)(ABS(t))) / GST_SECOND) % 60) : 99, \
278 GST_CLOCK_STIME_IS_VALID (t) ? \
279 (guint) (((GstClockTime)(ABS(t))) % GST_SECOND) : 999999999
280
281typedef struct _GstClockEntry GstClockEntry;
282typedef struct _GstClock GstClock;
283typedef struct _GstClockClass GstClockClass;
284typedef struct _GstClockPrivate GstClockPrivate;
285
286/* --- prototype for async callbacks --- */
287/**
288 * GstClockCallback:
289 * @clock: The clock that triggered the callback
290 * @time: The time it was triggered
291 * @id: The #GstClockID that expired
292 * @user_data: user data passed in the gst_clock_id_wait_async() function
293 *
294 * The function prototype of the callback.
295 *
296 * Returns: %TRUE or %FALSE (currently unused)
297 */
298typedef gboolean (*GstClockCallback) (GstClock *clock, GstClockTime time,
299 GstClockID id, gpointer user_data);
300/**
301 * GstClockReturn:
302 * @GST_CLOCK_OK: The operation succeeded.
303 * @GST_CLOCK_EARLY: The operation was scheduled too late.
304 * @GST_CLOCK_UNSCHEDULED: The clockID was unscheduled
305 * @GST_CLOCK_BUSY: The ClockID is busy
306 * @GST_CLOCK_BADTIME: A bad time was provided to a function.
307 * @GST_CLOCK_ERROR: An error occurred
308 * @GST_CLOCK_UNSUPPORTED: Operation is not supported
309 * @GST_CLOCK_DONE: The ClockID is done waiting
310 *
311 * The return value of a clock operation.
312 */
313typedef enum
314{
315 GST_CLOCK_OK = 0,
316 GST_CLOCK_EARLY = 1,
317 GST_CLOCK_UNSCHEDULED = 2,
318 GST_CLOCK_BUSY = 3,
319 GST_CLOCK_BADTIME = 4,
320 GST_CLOCK_ERROR = 5,
321 GST_CLOCK_UNSUPPORTED = 6,
322 GST_CLOCK_DONE = 7
323} GstClockReturn;
324
325/**
326 * GstClockEntryType:
327 * @GST_CLOCK_ENTRY_SINGLE: a single shot timeout
328 * @GST_CLOCK_ENTRY_PERIODIC: a periodic timeout request
329 *
330 * The type of the clock entry
331 */
332typedef enum {
333 GST_CLOCK_ENTRY_SINGLE,
334 GST_CLOCK_ENTRY_PERIODIC
335} GstClockEntryType;
336
337/**
338 * GST_CLOCK_ENTRY:
339 * @entry: the entry to cast
340 *
341 * Casts to a clock entry
342 */
343#define GST_CLOCK_ENTRY(entry) ((GstClockEntry *)(entry))
344
345#ifndef GST_DISABLE_DEPRECATED
346/**
347 * GST_CLOCK_ENTRY_CLOCK:
348 * @entry: the entry to query
349 *
350 * Gets the owner clock of the entry
351 *
352 * Deprecated: Use gst_clock_id_get_clock() instead.
353 */
354#define GST_CLOCK_ENTRY_CLOCK(entry) ((entry)->clock)
355#endif
356/**
357 * GST_CLOCK_ENTRY_TYPE:
358 * @entry: the entry to query
359 *
360 * Gets the type of the clock entry
361 */
362#define GST_CLOCK_ENTRY_TYPE(entry) ((entry)->type)
363/**
364 * GST_CLOCK_ENTRY_TIME:
365 * @entry: the entry to query
366 *
367 * Gets the requested time of this entry
368 */
369#define GST_CLOCK_ENTRY_TIME(entry) ((entry)->time)
370/**
371 * GST_CLOCK_ENTRY_INTERVAL:
372 * @entry: the entry to query
373 *
374 * Gets the interval of this periodic entry
375 */
376#define GST_CLOCK_ENTRY_INTERVAL(entry) ((entry)->interval)
377/**
378 * GST_CLOCK_ENTRY_STATUS:
379 * @entry: the entry to query
380 *
381 * The status of the entry
382 */
383#define GST_CLOCK_ENTRY_STATUS(entry) ((entry)->status)
384
385/**
386 * GstClockEntry:
387 * @refcount: reference counter (read-only)
388 *
389 * All pending timeouts or periodic notifies are converted into
390 * an entry.
391 * Note that GstClockEntry should be treated as an opaque structure. It must
392 * not be extended or allocated using a custom allocator.
393 */
394struct _GstClockEntry {
395 gint refcount;
396 /*< private >*/
397#ifndef GST_REMOVE_DEPRECATED
398#ifndef GST_DISABLE_DEPRECATED
399 GstClock *clock;
400#else
401 gpointer _clock;
402#endif
403#endif
404 GstClockEntryType type;
405 GstClockTime time;
406 GstClockTime interval;
407 GstClockReturn status;
408 GstClockCallback func;
409 gpointer user_data;
410 GDestroyNotify destroy_data;
411 gboolean unscheduled;
412 gboolean woken_up;
413
414 /*< private >*/
415 gpointer _gst_reserved[GST_PADDING];
416};
417
418#include <gst/gstobject.h>
419
420/**
421 * GstClockFlags:
422 * @GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC: clock can do a single sync timeout request
423 * @GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC: clock can do a single async timeout request
424 * @GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC: clock can do sync periodic timeout requests
425 * @GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC: clock can do async periodic timeout callbacks
426 * @GST_CLOCK_FLAG_CAN_SET_RESOLUTION: clock's resolution can be changed
427 * @GST_CLOCK_FLAG_CAN_SET_MASTER: clock can be slaved to a master clock
428 * @GST_CLOCK_FLAG_LAST: subclasses can add additional flags starting from this flag
429 *
430 * The capabilities of this clock
431 */
432typedef enum {
433 GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC = (GST_OBJECT_FLAG_LAST << 0),
434 GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC = (GST_OBJECT_FLAG_LAST << 1),
435 GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC = (GST_OBJECT_FLAG_LAST << 2),
436 GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC = (GST_OBJECT_FLAG_LAST << 3),
437 GST_CLOCK_FLAG_CAN_SET_RESOLUTION = (GST_OBJECT_FLAG_LAST << 4),
438 GST_CLOCK_FLAG_CAN_SET_MASTER = (GST_OBJECT_FLAG_LAST << 5),
439
440 /**
441 * GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC:
442 *
443 * clock needs to be synced before it can be used
444 *
445 * Since: 1.6
446 */
447 GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC = (GST_OBJECT_FLAG_LAST << 6),
448 /* padding */
449 GST_CLOCK_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8)
450} GstClockFlags;
451
452/**
453 * GST_CLOCK_FLAGS:
454 * @clock: the clock to query
455 *
456 * Gets the #GstClockFlags clock flags.
457 */
458#define GST_CLOCK_FLAGS(clock) GST_OBJECT_FLAGS(clock)
459
460/**
461 * GstClock:
462 * @object: the parent structure
463 *
464 * #GstClock base structure.
465 */
466struct _GstClock {
467 GstObject object;
468
469 /*< private >*/
470 GstClockPrivate *priv;
471
472 gpointer _gst_reserved[GST_PADDING];
473};
474
475/**
476 * GstClockClass:
477 * @parent_class: the parent class structure
478 *
479 * GStreamer clock class. Override the vmethods to implement the clock
480 * functionality.
481 */
482struct _GstClockClass {
483 GstObjectClass parent_class;
484
485 /*< public >*/
486 /* vtable */
487
488 /**
489 * GstClockClass::change_resolution:
490 * @clock: the #GstClock
491 * @old_resolution: the previous resolution
492 * @new_resolution: the new resolution
493 *
494 * Change the resolution of the clock. Not all values might
495 * be acceptable.
496 *
497 * Returns: the new resolution
498 */
499 GstClockTime (*change_resolution) (GstClock *clock,
500 GstClockTime old_resolution,
501 GstClockTime new_resolution);
502
503 /**
504 * GstClockClass::get_resolution:
505 * @clock: the #GstClock
506 *
507 * Get the resolution of the clock.
508 *
509 * Returns: the current resolution
510 */
511 GstClockTime (*get_resolution) (GstClock *clock);
512
513 /**
514 * GstClockClass::get_internal_time:
515 * @clock: the #GstClock
516 *
517 * Get the internal unadjusted time of the clock.
518 *
519 * Implement #GstClockClass::wait instead.
520 *
521 * Returns: the internal time
522 */
523 GstClockTime (*get_internal_time) (GstClock *clock);
524
525 /* waiting on an ID */
526
527 /**
528 * GstClockClass::wait:
529 * @clock: the #GstClock
530 * @entry: the entry to wait on
531 * @jitter: (out) (allow-none): a pointer that will contain the jitter
532 *
533 * Perform a blocking wait on the given #GstClockEntry and return
534 * the jitter.
535 *
536 * Returns: the result of the blocking wait. #GST_CLOCK_EARLY will be returned
537 * if the current clock time is past the time of @id, #GST_CLOCK_OK if
538 * @id was scheduled in time. #GST_CLOCK_UNSCHEDULED if @id was
539 * unscheduled with gst_clock_id_unschedule().
540 */
541 GstClockReturn (*wait) (GstClock *clock, GstClockEntry *entry,
542 GstClockTimeDiff *jitter);
543
544 /**
545 * GstClockClass::wait_async:
546 * @clock: the #GstClock
547 * @entry: the entry to wait on
548 *
549 * Perform an asynchronous wait on the given #GstClockEntry.
550 *
551 * Returns: the result of the non blocking wait.
552 */
553 GstClockReturn (*wait_async) (GstClock *clock, GstClockEntry *entry);
554
555 /**
556 * GstClockClass::unschedule:
557 * @clock: the #GstClock
558 * @entry: the entry to unschedule
559 *
560 * Unblock a blocking or async wait operation.
561 */
562 void (*unschedule) (GstClock *clock, GstClockEntry *entry);
563
564 /*< private >*/
565 gpointer _gst_reserved[GST_PADDING];
566};
567
568GST_API
569GType gst_clock_get_type (void);
570
571GST_API
572GstClockTime gst_clock_set_resolution (GstClock *clock,
573 GstClockTime resolution);
574GST_API
575GstClockTime gst_clock_get_resolution (GstClock *clock);
576
577GST_API
578GstClockTime gst_clock_get_time (GstClock *clock);
579
580GST_API
581void gst_clock_set_calibration (GstClock *clock, GstClockTime internal,
582 GstClockTime external,
583 GstClockTime rate_num,
584 GstClockTime rate_denom);
585GST_API
586void gst_clock_get_calibration (GstClock *clock, GstClockTime *internal,
587 GstClockTime *external,
588 GstClockTime *rate_num,
589 GstClockTime *rate_denom);
590
591/* master/slave clocks */
592
593GST_API
594gboolean gst_clock_set_master (GstClock *clock, GstClock *master);
595
596GST_API
597GstClock* gst_clock_get_master (GstClock *clock);
598
599GST_API
600void gst_clock_set_timeout (GstClock *clock,
601 GstClockTime timeout);
602GST_API
603GstClockTime gst_clock_get_timeout (GstClock *clock);
604
605GST_API
606gboolean gst_clock_add_observation (GstClock *clock, GstClockTime slave,
607 GstClockTime master, gdouble *r_squared);
608GST_API
609gboolean gst_clock_add_observation_unapplied (GstClock *clock, GstClockTime slave,
610 GstClockTime master, gdouble *r_squared,
611 GstClockTime *internal,
612 GstClockTime *external,
613 GstClockTime *rate_num,
614 GstClockTime *rate_denom);
615
616/* getting and adjusting internal/external time */
617
618GST_API
619GstClockTime gst_clock_get_internal_time (GstClock *clock);
620
621GST_API
622GstClockTime gst_clock_adjust_unlocked (GstClock *clock, GstClockTime internal);
623
624GST_API
625GstClockTime gst_clock_adjust_with_calibration (GstClock *clock,
626 GstClockTime internal_target,
627 GstClockTime cinternal,
628 GstClockTime cexternal,
629 GstClockTime cnum,
630 GstClockTime cdenom);
631GST_API
632GstClockTime gst_clock_unadjust_with_calibration (GstClock *clock,
633 GstClockTime external_target,
634 GstClockTime cinternal,
635 GstClockTime cexternal,
636 GstClockTime cnum,
637 GstClockTime cdenom);
638GST_API
639GstClockTime gst_clock_unadjust_unlocked (GstClock * clock, GstClockTime external);
640
641/* waiting for, signalling and checking for synchronization */
642
643GST_API
644gboolean gst_clock_wait_for_sync (GstClock * clock, GstClockTime timeout);
645
646GST_API
647gboolean gst_clock_is_synced (GstClock * clock);
648
649/* to be used by subclasses only */
650
651GST_API
652void gst_clock_set_synced (GstClock * clock, gboolean synced);
653
654/* creating IDs that can be used to get notifications */
655
656GST_API
657GstClockID gst_clock_new_single_shot_id (GstClock *clock,
658 GstClockTime time);
659GST_API
660GstClockID gst_clock_new_periodic_id (GstClock *clock,
661 GstClockTime start_time,
662 GstClockTime interval);
663
664/* reference counting */
665
666GST_API
667GstClockID gst_clock_id_ref (GstClockID id);
668
669GST_API
670void gst_clock_id_unref (GstClockID id);
671
672/* operations on IDs */
673
674GST_API
675gint gst_clock_id_compare_func (gconstpointer id1, gconstpointer id2);
676
677GST_API
678GstClock * gst_clock_id_get_clock (GstClockID id);
679
680GST_API
681gboolean gst_clock_id_uses_clock (GstClockID id, GstClock * clock);
682
683GST_API
684GstClockTime gst_clock_id_get_time (GstClockID id);
685
686GST_API
687GstClockReturn gst_clock_id_wait (GstClockID id,
688 GstClockTimeDiff *jitter);
689GST_API
690GstClockReturn gst_clock_id_wait_async (GstClockID id,
691 GstClockCallback func,
692 gpointer user_data,
693 GDestroyNotify destroy_data);
694GST_API
695void gst_clock_id_unschedule (GstClockID id);
696
697GST_API
698gboolean gst_clock_single_shot_id_reinit (GstClock * clock,
699 GstClockID id,
700 GstClockTime time);
701GST_API
702gboolean gst_clock_periodic_id_reinit (GstClock * clock,
703 GstClockID id,
704 GstClockTime start_time,
705 GstClockTime interval);
706
707G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstClock, gst_object_unref)
708G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GstClockID, gst_clock_id_unref, 0)
709
710G_END_DECLS
711
712#endif /* __GST_CLOCK_H__ */
713

source code of include/gstreamer-1.0/gst/gstclock.h