gstreamer_core/gst/gstclock.h
changeset 0 0e761a78d257
child 8 4a7fac7dd34a
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     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., 59 Temple Place - Suite 330,
       
    21  * Boston, MA 02111-1307, USA.
       
    22  */
       
    23 
       
    24 #ifndef __GST_CLOCK_H__
       
    25 #define __GST_CLOCK_H__
       
    26 
       
    27 #include <gst/gstobject.h>
       
    28 
       
    29 G_BEGIN_DECLS
       
    30 
       
    31 /* --- standard type macros --- */
       
    32 #define GST_TYPE_CLOCK			(gst_clock_get_type ())
       
    33 #define GST_CLOCK(clock)		(G_TYPE_CHECK_INSTANCE_CAST ((clock), GST_TYPE_CLOCK, GstClock))
       
    34 #define GST_IS_CLOCK(clock)		(G_TYPE_CHECK_INSTANCE_TYPE ((clock), GST_TYPE_CLOCK))
       
    35 #define GST_CLOCK_CLASS(cclass)		(G_TYPE_CHECK_CLASS_CAST ((cclass), GST_TYPE_CLOCK, GstClockClass))
       
    36 #define GST_IS_CLOCK_CLASS(cclass)	(G_TYPE_CHECK_CLASS_TYPE ((cclass), GST_TYPE_CLOCK))
       
    37 #define GST_CLOCK_GET_CLASS(clock)	(G_TYPE_INSTANCE_GET_CLASS ((clock), GST_TYPE_CLOCK, GstClockClass))
       
    38 #define GST_CLOCK_CAST(clock)		((GstClock*)(clock))
       
    39 
       
    40 #define GST_CLOCK_SLAVE_LOCK(clock)	g_mutex_lock (GST_CLOCK_CAST (clock)->slave_lock)
       
    41 #define GST_CLOCK_SLAVE_UNLOCK(clock)	g_mutex_unlock (GST_CLOCK_CAST (clock)->slave_lock)
       
    42 
       
    43 /**
       
    44  * GstClockTime:
       
    45  *
       
    46  * A datatype to hold a time, measured in nanoseconds.
       
    47  */
       
    48 typedef guint64	GstClockTime;
       
    49 
       
    50 /**
       
    51  * GST_TYPE_CLOCK_TIME:
       
    52  *
       
    53  * The GType of a GstClockTime.
       
    54  */
       
    55 #define GST_TYPE_CLOCK_TIME G_TYPE_UINT64
       
    56 
       
    57 /**
       
    58  * GstClockTimeDiff:
       
    59  *
       
    60  * A datatype to hold a timedifference, measured in nanoseconds.
       
    61  */
       
    62 typedef gint64 GstClockTimeDiff;
       
    63 /**
       
    64  * GstClockID:
       
    65  *
       
    66  * A datatype to hold the handle to an outstanding sync or async clock callback.
       
    67  */
       
    68 typedef gpointer GstClockID;
       
    69 
       
    70 /**
       
    71  * GST_CLOCK_TIME_NONE:
       
    72  *
       
    73  * Constant to define an undefined clock time.
       
    74  */
       
    75 #define GST_CLOCK_TIME_NONE		((GstClockTime) -1)
       
    76 /**
       
    77  * GST_CLOCK_TIME_IS_VALID:
       
    78  * @time: clock time to validate
       
    79  *
       
    80  * Tests if a given #GstClockTime represents a valid defined time.
       
    81  */
       
    82 #define GST_CLOCK_TIME_IS_VALID(time)	(((GstClockTime)(time)) != GST_CLOCK_TIME_NONE)
       
    83 
       
    84 /**
       
    85  * GST_SECOND:
       
    86  *
       
    87  * Constant that defines one GStreamer second.
       
    88  */
       
    89 #define GST_SECOND  (G_USEC_PER_SEC * G_GINT64_CONSTANT (1000))
       
    90 /**
       
    91  * GST_MSECOND:
       
    92  *
       
    93  * Constant that defines one GStreamer millisecond.
       
    94  */
       
    95 #define GST_MSECOND (GST_SECOND / G_GINT64_CONSTANT (1000))
       
    96 /**
       
    97  * GST_USECOND:
       
    98  *
       
    99  * Constant that defines one GStreamer microsecond.
       
   100  */
       
   101 #define GST_USECOND (GST_SECOND / G_GINT64_CONSTANT (1000000))
       
   102 /**
       
   103  * GST_NSECOND:
       
   104  *
       
   105  * Constant that defines one GStreamer nanosecond
       
   106  */
       
   107 #define GST_NSECOND (GST_SECOND / G_GINT64_CONSTANT (1000000000))
       
   108 
       
   109 
       
   110 /**
       
   111  * GST_TIME_AS_SECONDS:
       
   112  * @time: the time
       
   113  *
       
   114  * Convert a #GstClockTime to seconds.
       
   115  *
       
   116  * Since: 0.10.16
       
   117  */
       
   118 #define GST_TIME_AS_SECONDS(time)  ((time) / GST_SECOND)
       
   119 /**
       
   120  * GST_TIME_AS_MSECONDS:
       
   121  *
       
   122  * Convert a #GstClockTime to milliseconds (1/1000 of a second).
       
   123  *
       
   124  * Since: 0.10.16
       
   125  */
       
   126 #define GST_TIME_AS_MSECONDS(time) ((time) / G_GINT64_CONSTANT (1000000))
       
   127 /**
       
   128  * GST_TIME_TO_USECONDS:
       
   129  *
       
   130  * Convert a #GstClockTime to microseconds (1/1000000 of a second).
       
   131  *
       
   132  * Since: 0.10.16
       
   133  */
       
   134 #define GST_TIME_AS_USECONDS(time) ((time) / G_GINT64_CONSTANT (1000))
       
   135 /**
       
   136  * GST_TIME_TO_NSECONDS:
       
   137  *
       
   138  * Convert a #GstClockTime to nanoseconds (1/1000000000 of a second).
       
   139  *
       
   140  * Since: 0.10.16
       
   141  */
       
   142 #define GST_TIME_AS_NSECONDS(time) (time)
       
   143 
       
   144 /**
       
   145  * GST_CLOCK_DIFF:
       
   146  * @s: the first time
       
   147  * @e: the second time
       
   148  *
       
   149  * Calculate a difference between two clock times as a #GstClockTimeDiff.
       
   150  * The difference is calculated as @e - @s.
       
   151  */
       
   152 #define GST_CLOCK_DIFF(s, e)		(GstClockTimeDiff)((e) - (s))
       
   153 
       
   154 /**
       
   155  * GST_TIMEVAL_TO_TIME:
       
   156  * @tv: the timeval to convert
       
   157  *
       
   158  * Convert a GTimeVal to a #GstClockTime.
       
   159  */
       
   160 #define GST_TIMEVAL_TO_TIME(tv)		(GstClockTime)((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND)
       
   161 
       
   162 /**
       
   163  * GST_TIME_TO_TIMEVAL:
       
   164  * @t: The GstClockTime to convert
       
   165  * @tv: The target timeval
       
   166  *
       
   167  * Note: on 32-bit systems, a timeval has a range of only 2^32 - 1 seconds,
       
   168  * which is about 68 years.  Expect trouble if you want to schedule stuff
       
   169  * in your pipeline for 2038.
       
   170  *
       
   171  * Convert a GstClockTime to a GTimeVal
       
   172  */
       
   173 #define GST_TIME_TO_TIMEVAL(t,tv)				\
       
   174 G_STMT_START {							\
       
   175   (tv).tv_sec  = ((GstClockTime) (t)) / GST_SECOND;		\
       
   176   (tv).tv_usec = (((GstClockTime) (t)) -			\
       
   177                   ((GstClockTime) (tv).tv_sec) * GST_SECOND)	\
       
   178                  / GST_USECOND;					\
       
   179 } G_STMT_END
       
   180 
       
   181 /**
       
   182  * GST_TIMESPEC_TO_TIME:
       
   183  * @ts: the timespec to convert
       
   184  *
       
   185  * Convert a struct timespec (see man pselect) to a #GstClockTime.
       
   186  */
       
   187 #define GST_TIMESPEC_TO_TIME(ts)	(GstClockTime)((ts).tv_sec * GST_SECOND + (ts).tv_nsec * GST_NSECOND)
       
   188 /**
       
   189  * GST_TIME_TO_TIMESPEC:
       
   190  * @t: The GstClockTime to convert
       
   191  * @ts: The target timespec
       
   192  *
       
   193  * Convert a #GstClockTime to a struct timespec (see man pselect)
       
   194  */
       
   195 #define GST_TIME_TO_TIMESPEC(t,ts)			\
       
   196 G_STMT_START {						\
       
   197   (ts).tv_sec  =  (t) / GST_SECOND;			\
       
   198   (ts).tv_nsec = ((t) - (ts).tv_sec * GST_SECOND) / GST_NSECOND;	\
       
   199 } G_STMT_END
       
   200 
       
   201 /* timestamp debugging macros */
       
   202 /**
       
   203  * GST_TIME_FORMAT:
       
   204  *
       
   205  * A format that can be used in printf like format strings to format
       
   206  * a GstClockTime value.
       
   207  */
       
   208 #define GST_TIME_FORMAT "u:%02u:%02u.%09u"
       
   209 /**
       
   210  * GST_TIME_ARGS:
       
   211  * @t: a #GstClockTime
       
   212  *
       
   213  * Format @t for the GST_TIME_FORMAT format string.
       
   214  */
       
   215 #define GST_TIME_ARGS(t) \
       
   216         GST_CLOCK_TIME_IS_VALID (t) ? \
       
   217         (guint) (((GstClockTime)(t)) / (GST_SECOND * 60 * 60)) : 99, \
       
   218         GST_CLOCK_TIME_IS_VALID (t) ? \
       
   219         (guint) ((((GstClockTime)(t)) / (GST_SECOND * 60)) % 60) : 99, \
       
   220         GST_CLOCK_TIME_IS_VALID (t) ? \
       
   221         (guint) ((((GstClockTime)(t)) / GST_SECOND) % 60) : 99, \
       
   222         GST_CLOCK_TIME_IS_VALID (t) ? \
       
   223         (guint) (((GstClockTime)(t)) % GST_SECOND) : 999999999
       
   224 
       
   225 /**
       
   226  * GST_CLOCK_ENTRY_TRACE_NAME:
       
   227  *
       
   228  * The name used for tracing clock entry allocations.
       
   229  */
       
   230 #define GST_CLOCK_ENTRY_TRACE_NAME "GstClockEntry"
       
   231 
       
   232 typedef struct _GstClockEntry	GstClockEntry;
       
   233 typedef struct _GstClock	GstClock;
       
   234 typedef struct _GstClockClass	GstClockClass;
       
   235 
       
   236 /* --- prototype for async callbacks --- */
       
   237 /**
       
   238  * GstClockCallback:
       
   239  * @clock: The clock that triggered the callback
       
   240  * @time: The time it was triggered
       
   241  * @id: The #GstClockID that expired
       
   242  * @user_data: user data passed in the gst_clock_id_wait_async() function
       
   243  *
       
   244  * The function prototype of the callback.
       
   245  *
       
   246  * Returns: %TRUE or %FALSE (currently unused)
       
   247  */
       
   248 typedef gboolean	(*GstClockCallback)	(GstClock *clock, GstClockTime time,
       
   249 						 GstClockID id, gpointer user_data);
       
   250 /**
       
   251  * GstClockReturn:
       
   252  * @GST_CLOCK_OK: The operation succeded.
       
   253  * @GST_CLOCK_EARLY: The operation was scheduled too late.
       
   254  * @GST_CLOCK_UNSCHEDULED: The clockID was unscheduled
       
   255  * @GST_CLOCK_BUSY: The ClockID is busy
       
   256  * @GST_CLOCK_BADTIME: A bad time was provided to a function.
       
   257  * @GST_CLOCK_ERROR: An error occured
       
   258  * @GST_CLOCK_UNSUPPORTED: Operation is not supported
       
   259  *
       
   260  * The return value of a clock operation.
       
   261  */
       
   262 typedef enum
       
   263 {
       
   264   GST_CLOCK_OK		=  0,
       
   265   GST_CLOCK_EARLY	=  1,
       
   266   GST_CLOCK_UNSCHEDULED	=  2,
       
   267   GST_CLOCK_BUSY	=  3,
       
   268   GST_CLOCK_BADTIME	=  4,
       
   269   GST_CLOCK_ERROR	=  5,
       
   270   GST_CLOCK_UNSUPPORTED	=  6
       
   271 } GstClockReturn;
       
   272 
       
   273 /**
       
   274  * GstClockEntryType:
       
   275  * @GST_CLOCK_ENTRY_SINGLE: a single shot timeout
       
   276  * @GST_CLOCK_ENTRY_PERIODIC: a periodic timeout request
       
   277  *
       
   278  * The type of the clock entry
       
   279  */
       
   280 typedef enum {
       
   281   GST_CLOCK_ENTRY_SINGLE,
       
   282   GST_CLOCK_ENTRY_PERIODIC
       
   283 } GstClockEntryType;
       
   284 
       
   285 /**
       
   286  * GST_CLOCK_ENTRY:
       
   287  * @entry: the entry to cast
       
   288  *
       
   289  * Cast to a clock entry
       
   290  */
       
   291 #define GST_CLOCK_ENTRY(entry)		((GstClockEntry *)(entry))
       
   292 /**
       
   293  * GST_CLOCK_ENTRY_CLOCK:
       
   294  * @entry: the entry to query
       
   295  *
       
   296  * Get the owner clock of the entry
       
   297  */
       
   298 #define GST_CLOCK_ENTRY_CLOCK(entry)	((entry)->clock)
       
   299 /**
       
   300  * GST_CLOCK_ENTRY_TYPE:
       
   301  * @entry: the entry to query
       
   302  *
       
   303  * Get the type of the clock entry
       
   304  */
       
   305 #define GST_CLOCK_ENTRY_TYPE(entry)	((entry)->type)
       
   306 /**
       
   307  * GST_CLOCK_ENTRY_TIME:
       
   308  * @entry: the entry to query
       
   309  *
       
   310  * Get the requested time of this entry
       
   311  */
       
   312 #define GST_CLOCK_ENTRY_TIME(entry)	((entry)->time)
       
   313 /**
       
   314  * GST_CLOCK_ENTRY_INTERVAL:
       
   315  * @entry: the entry to query
       
   316  *
       
   317  * Get the interval of this periodic entry
       
   318  */
       
   319 #define GST_CLOCK_ENTRY_INTERVAL(entry)	((entry)->interval)
       
   320 /**
       
   321  * GST_CLOCK_ENTRY_STATUS:
       
   322  * @entry: the entry to query
       
   323  *
       
   324  * The status of the entry
       
   325  */
       
   326 #define GST_CLOCK_ENTRY_STATUS(entry)	((entry)->status)
       
   327 
       
   328 /**
       
   329  * GstClockEntry:
       
   330  * @refcount: reference counter (read-only)
       
   331  *
       
   332  * All pending timeouts or periodic notifies are converted into
       
   333  * an entry.
       
   334  */
       
   335 struct _GstClockEntry {
       
   336   gint			refcount;
       
   337   /*< protected >*/
       
   338   GstClock		*clock;
       
   339   GstClockEntryType	 type;
       
   340   GstClockTime		 time;
       
   341   GstClockTime		 interval;
       
   342   GstClockReturn	 status;
       
   343   GstClockCallback	 func;
       
   344   gpointer		 user_data;
       
   345 };
       
   346 
       
   347 /**
       
   348  * GstClockFlags:
       
   349  * @GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC: clock can do a single sync timeout request
       
   350  * @GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC: clock can do a single async timeout request
       
   351  * @GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC: clock can do sync periodic timeout requests
       
   352  * @GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC: clock can do async periodic timeout callbacks
       
   353  * @GST_CLOCK_FLAG_CAN_SET_RESOLUTION: clock's resolution can be changed
       
   354  * @GST_CLOCK_FLAG_CAN_SET_MASTER: clock can be slaved to a master clock
       
   355  * @GST_CLOCK_FLAG_LAST: subclasses can add additional flags starting from this flag
       
   356  *
       
   357  * The capabilities of this clock
       
   358  */
       
   359 typedef enum {
       
   360   GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC     = (GST_OBJECT_FLAG_LAST << 0),
       
   361   GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC    = (GST_OBJECT_FLAG_LAST << 1),
       
   362   GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC   = (GST_OBJECT_FLAG_LAST << 2),
       
   363   GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC  = (GST_OBJECT_FLAG_LAST << 3),
       
   364   GST_CLOCK_FLAG_CAN_SET_RESOLUTION     = (GST_OBJECT_FLAG_LAST << 4),
       
   365   GST_CLOCK_FLAG_CAN_SET_MASTER         = (GST_OBJECT_FLAG_LAST << 5),
       
   366   /* padding */
       
   367   GST_CLOCK_FLAG_LAST		        = (GST_OBJECT_FLAG_LAST << 8)
       
   368 } GstClockFlags;
       
   369 
       
   370 /**
       
   371  * GST_CLOCK_FLAGS:
       
   372  * @clock: the clock to query
       
   373  *
       
   374  * Gets the #GstClockFlags clock flags.
       
   375  */
       
   376 #define GST_CLOCK_FLAGS(clock)  GST_OBJECT_FLAGS(clock)
       
   377 
       
   378 /**
       
   379  * GST_CLOCK_COND:
       
   380  * @clock: the clock to query
       
   381  *
       
   382  * Gets the #GCond that gets signaled when the entries of the clock
       
   383  * changed.
       
   384  */
       
   385 #define GST_CLOCK_COND(clock)            (GST_CLOCK_CAST(clock)->entries_changed)
       
   386 /**
       
   387  * GST_CLOCK_WAIT:
       
   388  * @clock: the clock to wait on
       
   389  *
       
   390  * Wait on the clock until the entries changed.
       
   391  */
       
   392 #define GST_CLOCK_WAIT(clock)            g_cond_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock))
       
   393 /**
       
   394  * GST_CLOCK_TIMED_WAIT:
       
   395  * @clock: the clock to wait on
       
   396  * @tv: a GTimeVal to wait.
       
   397  *
       
   398  * Wait on the clock until the entries changed or the specified timeout
       
   399  * occured. 
       
   400  */
       
   401 #define GST_CLOCK_TIMED_WAIT(clock,tv)   g_cond_timed_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock),tv)
       
   402 /**
       
   403  * GST_CLOCK_BROADCAST:
       
   404  * @clock: the clock to broadcast
       
   405  *
       
   406  * Signal that the entries in the clock have changed.
       
   407  */
       
   408 #define GST_CLOCK_BROADCAST(clock)       g_cond_broadcast(GST_CLOCK_COND(clock))
       
   409 
       
   410 /**
       
   411  * GstClock:
       
   412  *
       
   413  * GstClock base structure. The values of this structure are
       
   414  * protected for subclasses, use the methods to use the #GstClock.
       
   415  */
       
   416 struct _GstClock {
       
   417   GstObject	 object;
       
   418 
       
   419   GMutex	*slave_lock; /* order: SLAVE_LOCK, OBJECT_LOCK */
       
   420 
       
   421   /*< protected >*/ /* with LOCK */
       
   422   GstClockTime	 internal_calibration; 
       
   423   GstClockTime	 external_calibration;
       
   424   GstClockTime	 rate_numerator;
       
   425   GstClockTime	 rate_denominator;
       
   426   GstClockTime	 last_time;
       
   427   GList		*entries;
       
   428   GCond		*entries_changed;
       
   429 
       
   430   /*< private >*/ /* with LOCK */
       
   431   GstClockTime	 resolution;
       
   432   gboolean	 stats;
       
   433 
       
   434   /* for master/slave clocks */
       
   435   GstClock      *master;
       
   436 
       
   437   /* with SLAVE_LOCK */
       
   438   gboolean       filling;
       
   439   gint           window_size;
       
   440   gint           window_threshold;
       
   441   gint           time_index;
       
   442   GstClockTime   timeout;
       
   443   GstClockTime  *times;
       
   444   GstClockID     clockid;
       
   445 
       
   446   /*< private >*/
       
   447   GstClockTime	 _gst_reserved[GST_PADDING];
       
   448 };
       
   449 
       
   450 /**
       
   451  * GstClockClass:
       
   452  * @parent_class: the parent class structure
       
   453  * @change_resolution: change the resolution of the clock. Not all values might
       
   454  *                     be acceptable. The new resolution should be returned.
       
   455  * @get_resolution: get the resolution of the clock.
       
   456  * @get_internal_time: get the internal unadjusted time of the clock.
       
   457  * @wait: perform a blocking wait for the given GstClockEntry. Deprecated,
       
   458  *        implement @wait_jitter instead.
       
   459  * @wait_async: perform an asynchronous wait for the given GstClockEntry.
       
   460  * @unschedule: unblock a blocking or async wait operation.
       
   461  * @wait_jitter: perform a blocking wait on the given GstClockEntry and return
       
   462  *               the jitter. (Since: 0.10.10)
       
   463  *
       
   464  * GStreamer clock class. Override the vmethods to implement the clock
       
   465  * functionality.
       
   466  */
       
   467 struct _GstClockClass {
       
   468   GstObjectClass        parent_class;
       
   469 
       
   470   /*< public >*/
       
   471   /* vtable */
       
   472   GstClockTime          (*change_resolution)    (GstClock *clock,
       
   473                                                  GstClockTime old_resolution,
       
   474 						 GstClockTime new_resolution);
       
   475   GstClockTime          (*get_resolution)       (GstClock *clock);
       
   476 
       
   477   GstClockTime		(*get_internal_time)	(GstClock *clock);
       
   478 
       
   479   /* waiting on an ID */
       
   480   GstClockReturn        (*wait)			(GstClock *clock, GstClockEntry *entry);
       
   481   GstClockReturn        (*wait_async)           (GstClock *clock, GstClockEntry *entry);
       
   482   void                  (*unschedule)		(GstClock *clock, GstClockEntry *entry);
       
   483 
       
   484   /* ABI added to replace the deprecated wait */
       
   485   GstClockReturn        (*wait_jitter)		(GstClock *clock, GstClockEntry *entry,
       
   486 		  				 GstClockTimeDiff *jitter);
       
   487   /*< private >*/
       
   488   gpointer _gst_reserved[GST_PADDING - 1];
       
   489 };
       
   490 #ifdef __SYMBIAN32__
       
   491 IMPORT_C
       
   492 #endif
       
   493 
       
   494 
       
   495 GType			gst_clock_get_type		(void);
       
   496 #ifdef __SYMBIAN32__
       
   497 IMPORT_C
       
   498 #endif
       
   499 
       
   500 
       
   501 GstClockTime		gst_clock_set_resolution	(GstClock *clock,
       
   502                                                          GstClockTime resolution);
       
   503 #ifdef __SYMBIAN32__
       
   504 IMPORT_C
       
   505 #endif
       
   506 
       
   507 GstClockTime		gst_clock_get_resolution	(GstClock *clock);
       
   508 #ifdef __SYMBIAN32__
       
   509 IMPORT_C
       
   510 #endif
       
   511 
       
   512 
       
   513 GstClockTime		gst_clock_get_time		(GstClock *clock);
       
   514 #ifdef __SYMBIAN32__
       
   515 IMPORT_C
       
   516 #endif
       
   517 
       
   518 void			gst_clock_set_calibration	(GstClock *clock, GstClockTime internal,
       
   519                                                          GstClockTime external,
       
   520                                                          GstClockTime rate_num,
       
   521                                                          GstClockTime rate_denom);
       
   522 #ifdef __SYMBIAN32__
       
   523 IMPORT_C
       
   524 #endif
       
   525 
       
   526 void			gst_clock_get_calibration	(GstClock *clock, GstClockTime *internal,
       
   527                                                          GstClockTime *external,
       
   528                                                          GstClockTime *rate_num,
       
   529                                                          GstClockTime *rate_denom);
       
   530 
       
   531 /* master/slave clocks */
       
   532 #ifdef __SYMBIAN32__
       
   533 IMPORT_C
       
   534 #endif
       
   535 
       
   536 gboolean		gst_clock_set_master		(GstClock *clock, GstClock *master);
       
   537 #ifdef __SYMBIAN32__
       
   538 IMPORT_C
       
   539 #endif
       
   540 
       
   541 GstClock*		gst_clock_get_master		(GstClock *clock);
       
   542 #ifdef __SYMBIAN32__
       
   543 IMPORT_C
       
   544 #endif
       
   545 
       
   546 gboolean		gst_clock_add_observation       (GstClock *clock, GstClockTime slave, 
       
   547 							 GstClockTime master, gdouble *r_squared);
       
   548 
       
   549 
       
   550 /* getting and adjusting internal/external time */
       
   551 #ifdef __SYMBIAN32__
       
   552 IMPORT_C
       
   553 #endif
       
   554 
       
   555 GstClockTime		gst_clock_get_internal_time	(GstClock *clock);
       
   556 #ifdef __SYMBIAN32__
       
   557 IMPORT_C
       
   558 #endif
       
   559 
       
   560 GstClockTime		gst_clock_adjust_unlocked	(GstClock *clock, GstClockTime internal);
       
   561 #ifdef __SYMBIAN32__
       
   562 IMPORT_C
       
   563 #endif
       
   564 
       
   565 GstClockTime            gst_clock_unadjust_unlocked     (GstClock * clock, GstClockTime external);
       
   566 
       
   567 
       
   568 /* creating IDs that can be used to get notifications */
       
   569 #ifdef __SYMBIAN32__
       
   570 IMPORT_C
       
   571 #endif
       
   572 
       
   573 GstClockID		gst_clock_new_single_shot_id	(GstClock *clock,
       
   574 							 GstClockTime time);
       
   575 #ifdef __SYMBIAN32__
       
   576 IMPORT_C
       
   577 #endif
       
   578 
       
   579 GstClockID		gst_clock_new_periodic_id	(GstClock *clock,
       
   580 							 GstClockTime start_time,
       
   581 							 GstClockTime interval);
       
   582 
       
   583 /* reference counting */
       
   584 #ifdef __SYMBIAN32__
       
   585 IMPORT_C
       
   586 #endif
       
   587 
       
   588 GstClockID              gst_clock_id_ref                (GstClockID id);
       
   589 #ifdef __SYMBIAN32__
       
   590 IMPORT_C
       
   591 #endif
       
   592 
       
   593 void                    gst_clock_id_unref              (GstClockID id);
       
   594 
       
   595 /* operations on IDs */
       
   596 #ifdef __SYMBIAN32__
       
   597 IMPORT_C
       
   598 #endif
       
   599 
       
   600 gint			gst_clock_id_compare_func	(gconstpointer id1, gconstpointer id2);
       
   601 #ifdef __SYMBIAN32__
       
   602 IMPORT_C
       
   603 #endif
       
   604 
       
   605 
       
   606 GstClockTime		gst_clock_id_get_time		(GstClockID id);
       
   607 #ifdef __SYMBIAN32__
       
   608 IMPORT_C
       
   609 #endif
       
   610 
       
   611 GstClockReturn		gst_clock_id_wait		(GstClockID id,
       
   612 							 GstClockTimeDiff *jitter);
       
   613 #ifdef __SYMBIAN32__
       
   614 IMPORT_C
       
   615 #endif
       
   616 
       
   617 GstClockReturn		gst_clock_id_wait_async		(GstClockID id,
       
   618 							 GstClockCallback func,
       
   619 							 gpointer user_data);
       
   620 #ifdef __SYMBIAN32__
       
   621 IMPORT_C
       
   622 #endif
       
   623 
       
   624 void			gst_clock_id_unschedule		(GstClockID id);
       
   625 
       
   626 
       
   627 G_END_DECLS
       
   628 
       
   629 #endif /* __GST_CLOCK_H__ */