GstClock

Name

GstClock -- Clocking and synchronisation.

Synopsis


#include <gst/gst.h>


typedef     GstClockTime;
typedef     GstClockTimeDiff;
#define     GST_CLOCK_DIFF                  (s, e)
struct      GstClock;
GstClock*   gst_clock_new                   (gchar *name);
GstClock*   gst_clock_get_system            (void);
void        gst_clock_register              (GstClock *clock,
                                             GstObject *obj);
void        gst_clock_set                   (GstClock *clock,
                                             GstClockTime time);
void        gst_clock_reset                 (GstClock *clock);
void        gst_clock_wait                  (GstClock *clock,
                                             GstClockTime time,
                                             GstObject *obj);
GstClockTimeDiff gst_clock_current_diff     (GstClock *clock,
                                             GstClockTime time);

Description

GstClock provides an easy way to synchonize against a global clock.

Details

GstClockTime

typedef guint64 GstClockTime;


GstClockTimeDiff

typedef gint64 GstClockTimeDiff;


GST_CLOCK_DIFF()

#define GST_CLOCK_DIFF(s, e) (GstClockTimeDiff)((s)-(e))

Calculate the difference between to timestamps. This does not create and absolute difference so the result might be negative if the first timestamp is less than the second timestamp.

s :first timestamp
e :second timestamp


struct GstClock

struct GstClock {
  gchar *name;
  GstClockTime start_time;
  GstClockTime current_time;
  GstClockTimeDiff adjust;
  gboolean locking;
  GList *sinkobjects;
  gint num, num_locked;
  GMutex *sinkmutex;
  GMutex *lock;
};


gst_clock_new ()

GstClock*   gst_clock_new                   (gchar *name);

create a new clock element

name : the name of the new clock
Returns : the new clock element


gst_clock_get_system ()

GstClock*   gst_clock_get_system            (void);

Get the global system clock

Returns : the global clock


gst_clock_register ()

void        gst_clock_register              (GstClock *clock,
                                             GstObject *obj);

State that an object is interested in listening to the given clock

clock : the name of the clock to register to
obj : the object registering to the clock


gst_clock_set ()

void        gst_clock_set                   (GstClock *clock,
                                             GstClockTime time);

Set the time of the given clock to time.

clock : The clock to set
time : the time to set


gst_clock_reset ()

void        gst_clock_reset                 (GstClock *clock);

Reset the given clock. The of the clock will be adjusted back to 0.

clock : the clock to reset


gst_clock_wait ()

void        gst_clock_wait                  (GstClock *clock,
                                             GstClockTime time,
                                             GstObject *obj);

Wait for a specific clock tick on the given clock.

clock : the clock to wait on
time : the time to wait for
obj : the object performing the wait


gst_clock_current_diff ()

GstClockTimeDiff gst_clock_current_diff     (GstClock *clock,
                                             GstClockTime time);

Calculate the difference between the given clock and the given time

clock : the clock to calculate the diff against
time : the time
Returns : the clock difference