mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
gst/: Convert Clock flags to object flags.
Original commit message from CVS: * gst/gstclock.c: (gst_clock_init), (gst_clock_set_master), (gst_clock_get_master): * gst/gstclock.h: * gst/gstsystemclock.c: (gst_system_clock_init): Convert Clock flags to object flags. Added methods to manage master/slave clocks.
This commit is contained in:
parent
a35882df1f
commit
e6bbe0ddb2
4 changed files with 71 additions and 11 deletions
|
@ -1,3 +1,12 @@
|
|||
2005-11-21 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstclock.c: (gst_clock_init), (gst_clock_set_master),
|
||||
(gst_clock_get_master):
|
||||
* gst/gstclock.h:
|
||||
* gst/gstsystemclock.c: (gst_system_clock_init):
|
||||
Convert Clock flags to object flags.
|
||||
Added methods to manage master/slave clocks.
|
||||
|
||||
2005-11-21 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* check/gst/gstsegment.c: (GST_START_TEST):
|
||||
|
|
|
@ -529,7 +529,6 @@ gst_clock_init (GstClock * clock)
|
|||
clock->last_time = 0;
|
||||
clock->entries = NULL;
|
||||
clock->entries_changed = g_cond_new ();
|
||||
clock->flags = 0;
|
||||
clock->stats = FALSE;
|
||||
|
||||
clock->internal_calibration = 0;
|
||||
|
@ -767,6 +766,53 @@ gst_clock_get_calibration (GstClock * clock, GstClockTime * internal,
|
|||
GST_OBJECT_UNLOCK (clock);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clock_set_master
|
||||
* @clock: a #GstClock
|
||||
* @master: a master #GstClock
|
||||
*
|
||||
* Set @master as the master clock for @clock. @clock will be automatically
|
||||
* calibrated so that gst_clock_get_time() reports the same time as the
|
||||
* master clock.
|
||||
*
|
||||
* A clock provider that slaves its clock to a master can get the current
|
||||
* calibration values with gst_clock_get_calibration().
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
void
|
||||
gst_clock_set_master (GstClock * clock, GstClock * master)
|
||||
{
|
||||
GST_OBJECT_LOCK (clock);
|
||||
gst_object_replace ((GstObject **) & clock->master, (GstObject *) master);
|
||||
GST_OBJECT_UNLOCK (clock);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clock_get_master
|
||||
* @clock: a #GstClock
|
||||
*
|
||||
* Get the master clock that @clock is slaved to or NULL when the clock is
|
||||
* not slaved to any master clock.
|
||||
*
|
||||
* Returns: a master #GstClock or NULL when this clock is not slaved to a master
|
||||
* clock. Unref after usage.
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
GstClock *
|
||||
gst_clock_get_master (GstClock * clock)
|
||||
{
|
||||
GstClock *result = NULL;
|
||||
|
||||
GST_OBJECT_LOCK (clock);
|
||||
if (clock->master)
|
||||
result = gst_object_ref (clock->master);
|
||||
GST_OBJECT_UNLOCK (clock);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_clock_update_stats (GstClock * clock)
|
||||
{
|
||||
|
|
|
@ -308,15 +308,18 @@ struct _GstClockEntry {
|
|||
* @GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC: clock can do sync periodic timeout requests
|
||||
* @GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC: clock can do async periodic timeout callbacks
|
||||
* @GST_CLOCK_FLAG_CAN_SET_RESOLUTION: clock's resolution can be changed
|
||||
* @GST_CLOCK_FLAG_LAST: subclasses can add additional flags starting from this flag
|
||||
*
|
||||
* The capabilities of this clock
|
||||
*/
|
||||
typedef enum {
|
||||
GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC = (1 << 1),
|
||||
GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC = (1 << 2),
|
||||
GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC = (1 << 3),
|
||||
GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC = (1 << 4),
|
||||
GST_CLOCK_FLAG_CAN_SET_RESOLUTION = (1 << 5),
|
||||
GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC = (GST_OBJECT_FLAG_LAST << 0),
|
||||
GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC = (GST_OBJECT_FLAG_LAST << 1),
|
||||
GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC = (GST_OBJECT_FLAG_LAST << 2),
|
||||
GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC = (GST_OBJECT_FLAG_LAST << 3),
|
||||
GST_CLOCK_FLAG_CAN_SET_RESOLUTION = (GST_OBJECT_FLAG_LAST << 4),
|
||||
/* padding */
|
||||
GST_CLOCK_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8),
|
||||
} GstClockFlags;
|
||||
|
||||
/**
|
||||
|
@ -369,9 +372,6 @@ typedef enum {
|
|||
struct _GstClock {
|
||||
GstObject object;
|
||||
|
||||
/*< public >*/
|
||||
GstClockFlags flags;
|
||||
|
||||
/*< protected >*/ /* with LOCK */
|
||||
GstClockTime internal_calibration;
|
||||
GstClockTime external_calibration;
|
||||
|
@ -384,6 +384,8 @@ struct _GstClock {
|
|||
GstClockTime resolution;
|
||||
gboolean stats;
|
||||
|
||||
GstClock *master;
|
||||
|
||||
GstClockTime _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
|
@ -419,6 +421,9 @@ void gst_clock_set_calibration (GstClock *clock, GstClockTime internal,
|
|||
GstClockTime external, gdouble rate);
|
||||
void gst_clock_get_calibration (GstClock *clock, GstClockTime *internal,
|
||||
GstClockTime *external, gdouble *rate);
|
||||
/* master/slave clocks */
|
||||
void gst_clock_set_master (GstClock *clock, GstClock *master);
|
||||
GstClock* gst_clock_get_master (GstClock *clock);
|
||||
|
||||
GstClockTime gst_clock_get_internal_time (GstClock *clock);
|
||||
GstClockTime gst_clock_adjust_unlocked (GstClock *clock, GstClockTime internal);
|
||||
|
|
|
@ -120,11 +120,11 @@ gst_system_clock_init (GstSystemClock * clock)
|
|||
{
|
||||
GError *error = NULL;
|
||||
|
||||
GST_CLOCK_FLAGS (clock) =
|
||||
GST_OBJECT_FLAG_SET (clock,
|
||||
GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC |
|
||||
GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC |
|
||||
GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC |
|
||||
GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC;
|
||||
GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC);
|
||||
|
||||
GST_OBJECT_LOCK (clock);
|
||||
clock->thread = g_thread_create ((GThreadFunc) gst_system_clock_async_thread,
|
||||
|
|
Loading…
Reference in a new issue