gst/gstclock.h (GstClock): Remove offset property. Add internal_calibration and external_calibration. Fix padding. Pa...

Original commit message from CVS:
2005-11-19  Andy Wingo  <wingo@pobox.com>

* gst/gstclock.h (GstClock): Remove offset property. Add
internal_calibration and external_calibration. Fix padding. Pad
also by GstClockTime so we don't run into problems.

* gst/gstclock.c (gst_clock_set_rate_offset): Remove.
(gst_clock_get_rate_offset): Remove.
(gst_clock_set_time_adjust): Remove. Fixes #321712.
This commit is contained in:
Andy Wingo 2005-11-19 18:06:56 +00:00
parent 5748aa1156
commit c0b753f74f
3 changed files with 23 additions and 100 deletions

View file

@ -1,5 +1,13 @@
2005-11-19 Andy Wingo <wingo@pobox.com>
* gst/gstclock.h (GstClock): Remove offset property. Add
internal_calibration and external_calibration. Fix padding. Pad
also by GstClockTime so we don't run into problems.
* gst/gstclock.c (gst_clock_set_rate_offset): Remove.
(gst_clock_get_rate_offset): Remove.
(gst_clock_set_time_adjust): Remove. Fixes #321712.
* gst/gstutils.h:
* gst/gstutils.c (g_static_rec_cond_wait)
(g_static_rec_cond_timed_wait): Removed, no longer needed.

View file

@ -526,15 +526,15 @@ gst_clock_class_init (GstClockClass * klass)
static void
gst_clock_init (GstClock * clock)
{
clock->adjust = 0;
clock->last_time = 0;
clock->entries = NULL;
clock->entries_changed = g_cond_new ();
clock->flags = 0;
clock->stats = FALSE;
clock->A.rate = 1.0;
clock->A.offset = 0;
clock->internal_calibration = 0;
clock->external_calibration = 0;
clock->rate = 1.0;
}
static void
@ -617,8 +617,8 @@ gst_clock_adjust_unlocked (GstClock * clock, GstClockTime internal)
{
GstClockTime ret;
ret = (internal - clock->adjust) * clock->A.rate;
ret += clock->A.offset;
ret = (internal - clock->internal_calibration) * clock->rate;
ret += clock->external_calibration;
/* make sure the time is increasing */
clock->last_time = MAX (ret, clock->last_time);
@ -692,76 +692,6 @@ gst_clock_get_time (GstClock * clock)
return ret;
}
/**
* gst_clock_set_time_adjust
* @clock: a #GstClock to adjust
* @adjust: the new time
*
* Adjusts the time of @clock. This function is buggy and is scheduled to die.
*
* Obsolete, do not use.
*
* MT safe.
*/
void
gst_clock_set_time_adjust (GstClock * clock, GstClockTime adjust)
{
g_return_if_fail (GST_IS_CLOCK (clock));
GST_LOCK (clock);
clock->adjust = adjust;
GST_UNLOCK (clock);
}
/**
* gst_clock_set_rate_offset
* @clock: a #GstClock to adjust
* @rate: the new rate
* @offset: the "initial" offset of @clock relative to its internal time
*
* Adjusts the internal rate and offset of @clock. Obsolete, do not use.
*
* Obsolete, do not use.
*
* MT safe.
*/
void
gst_clock_set_rate_offset (GstClock * clock, gdouble rate,
GstClockTimeDiff offset)
{
g_return_if_fail (GST_IS_CLOCK (clock));
g_return_if_fail (rate > 0.0);
GST_LOCK (clock);
clock->A.rate = rate;
clock->A.offset = offset;
GST_UNLOCK (clock);
}
/**
* gst_clock_get_rate_offset
* @clock: a #GstClock to adjust
* @rate: a location to store the rate
* @offset: a location to store the offset
*
* Obsolete, do not use.
*
* MT safe.
*/
void
gst_clock_get_rate_offset (GstClock * clock, gdouble * rate,
GstClockTimeDiff * offset)
{
g_return_if_fail (GST_IS_CLOCK (clock));
g_return_if_fail (rate != NULL);
g_return_if_fail (offset != NULL);
GST_LOCK (clock);
*rate = clock->A.rate;
*offset = clock->A.offset;
GST_UNLOCK (clock);
}
/**
* gst_clock_set_calibration
* @clock: a #GstClock to calibrate
@ -800,11 +730,9 @@ gst_clock_set_calibration (GstClock * clock, GstClockTime internal, GstClockTime
g_return_if_fail (internal <= gst_clock_get_internal_time (clock));
GST_LOCK (clock);
/* these need to be reworked for the api freeze break, we're really abusing
* them now */
clock->adjust = internal;
clock->A.rate = rate;
clock->A.offset = external;
clock->internal_calibration = internal;
clock->external_calibration = external;
clock->rate = rate;
GST_UNLOCK (clock);
}
@ -831,11 +759,11 @@ gst_clock_get_calibration (GstClock * clock, GstClockTime * internal,
GST_LOCK (clock);
if (rate)
*rate = clock->A.rate;
*rate = clock->rate;
if (external)
*external = clock->A.offset;
*external = clock->external_calibration;
if (internal)
*internal = clock->adjust;
*internal = clock->internal_calibration;
GST_UNLOCK (clock);
}

View file

@ -373,7 +373,9 @@ struct _GstClock {
GstClockFlags flags;
/*< protected >*/ /* with LOCK */
GstClockTime adjust; /* rename me... */
GstClockTime internal_calibration;
GstClockTime external_calibration;
gdouble rate;
GstClockTime last_time;
GList *entries;
GCond *entries_changed;
@ -382,15 +384,7 @@ struct _GstClock {
guint64 resolution;
gboolean stats;
union {
struct {
/* should be moved to protected -- note the padding is finished now, on 32
* bit machines at least */
gdouble rate;
GstClockTime offset;
} A;
gpointer _gst_reserved[GST_PADDING-1+1];
};
GstClockTime _gst_reserved[GST_PADDING];
};
struct _GstClockClass {
@ -419,18 +413,11 @@ guint64 gst_clock_set_resolution (GstClock *clock, guint64 resolution);
guint64 gst_clock_get_resolution (GstClock *clock);
GstClockTime gst_clock_get_time (GstClock *clock);
void gst_clock_set_rate_offset (GstClock *clock, gdouble rate,
GstClockTimeDiff offset);
void gst_clock_get_rate_offset (GstClock *clock, gdouble *rate,
GstClockTimeDiff *offset);
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);
/* remove me */
void gst_clock_set_time_adjust (GstClock *clock, GstClockTime adjust);
GstClockTime gst_clock_get_internal_time (GstClock *clock);
GstClockTime gst_clock_adjust_unlocked (GstClock *clock, GstClockTime internal);