gst/gstclock.*: Anonymous structs are a gcc (and some other compilers) extension, so don't use them. Since this is on...

Original commit message from CVS:
* gst/gstclock.c: (gst_clock_init), (gst_clock_adjust_unlocked),
(gst_clock_set_rate_offset), (gst_clock_get_rate_offset):
* gst/gstclock.h:
Anonymous structs are a gcc (and some other compilers) extension, so
don't use them. Since this is only for ABI-compatibility, and our
API/ABI freeze is over in a few days, this whole thing will only
last a few days, so don't bother trying to think up a meaningful
name for the struct.
This commit is contained in:
Michael Smith 2005-11-17 12:36:30 +00:00
parent c557e030a9
commit 3f80a0d393
3 changed files with 26 additions and 15 deletions

View file

@ -1,3 +1,14 @@
2005-11-17 Michael Smith <msmith@fluendo.com>
* gst/gstclock.c: (gst_clock_init), (gst_clock_adjust_unlocked),
(gst_clock_set_rate_offset), (gst_clock_get_rate_offset):
* gst/gstclock.h:
Anonymous structs are a gcc (and some other compilers) extension, so
don't use them. Since this is only for ABI-compatibility, and our
API/ABI freeze is over in a few days, this whole thing will only
last a few days, so don't bother trying to think up a meaningful
name for the struct.
2005-11-17 Andy Wingo <wingo@pobox.com> 2005-11-17 Andy Wingo <wingo@pobox.com>
* gst/gstclock.h (GstClock): Add rate and offset properties, * gst/gstclock.h (GstClock): Add rate and offset properties,

View file

@ -533,8 +533,8 @@ gst_clock_init (GstClock * clock)
clock->flags = 0; clock->flags = 0;
clock->stats = FALSE; clock->stats = FALSE;
clock->rate = 1.0; clock->A.rate = 1.0;
clock->offset = 0; clock->A.offset = 0;
} }
static void static void
@ -619,22 +619,22 @@ gst_clock_adjust_unlocked (GstClock * clock, GstClockTime internal)
/* internal is uint64, rate is double, offset is int64, ret is uint64 */ /* internal is uint64, rate is double, offset is int64, ret is uint64 */
ret = internal * clock->rate; ret = internal * clock->A.rate;
if (clock->offset < 0) { if (clock->A.offset < 0) {
if ((clock->offset == G_MININT64 && ret <= G_MAXINT64) if ((clock->A.offset == G_MININT64 && ret <= G_MAXINT64)
|| (clock->offset + ((gint64) ret) < 0)) || (clock->A.offset + ((gint64) ret) < 0))
/* underflow */ /* underflow */
ret = 0; ret = 0;
else else
ret -= (guint64) (-clock->offset); ret -= (guint64) (-clock->A.offset);
} else { } else {
if (clock->offset > 0 && ret >= G_MAXINT64 if (clock->A.offset > 0 && ret >= G_MAXINT64
&& G_MAXUINT64 - ret - 1 <= clock->offset) && G_MAXUINT64 - ret - 1 <= clock->A.offset)
/* overflow, but avoiding CLOCK_TIME_NONE which is MAXUINT64 */ /* overflow, but avoiding CLOCK_TIME_NONE which is MAXUINT64 */
ret = G_MAXUINT64 - 1; ret = G_MAXUINT64 - 1;
else else
ret += (guint64) clock->offset; ret += (guint64) clock->A.offset;
} }
/* make sure the time is increasing */ /* make sure the time is increasing */
@ -760,8 +760,8 @@ gst_clock_set_rate_offset (GstClock * clock, gdouble rate,
g_return_if_fail (rate > 0.0); g_return_if_fail (rate > 0.0);
GST_LOCK (clock); GST_LOCK (clock);
clock->rate = rate; clock->A.rate = rate;
clock->offset = offset; clock->A.offset = offset;
GST_UNLOCK (clock); GST_UNLOCK (clock);
} }
@ -787,8 +787,8 @@ gst_clock_get_rate_offset (GstClock * clock, gdouble * rate,
g_return_if_fail (offset != NULL); g_return_if_fail (offset != NULL);
GST_LOCK (clock); GST_LOCK (clock);
*rate = clock->rate; *rate = clock->A.rate;
*offset = clock->offset; *offset = clock->A.offset;
GST_UNLOCK (clock); GST_UNLOCK (clock);
} }

View file

@ -388,7 +388,7 @@ struct _GstClock {
* bit machines at least */ * bit machines at least */
gdouble rate; gdouble rate;
GstClockTime offset; GstClockTime offset;
}; } A;
gpointer _gst_reserved[GST_PADDING-1+1]; gpointer _gst_reserved[GST_PADDING-1+1];
}; };
}; };