[gst-devel] GstClockTime

Joshua N Pritikin vishnu at pobox.com
Wed Aug 7 09:12:03 CEST 2002

i notice that GstClockTime is typedef'd to guint64.  Why not gint64
(signed)?  time_t is signed.  struct timeval is signed.  Unsigned math
is a pain because we always have to worry about underflow.

For example, here is some code to check whether we are playing near the
the beginning of the selected part of a media file.  Imagine a NLE with
a small section of the film selected and the user hits "play":

      if (cur < sp->start - ((gint64) GST_MSECOND) ||
	  sp->start + ((gint64) GST_MSECOND) < cur)
	_fv_seek (fv, sp->start);

With unsigned math we can't subtract GST_MSECOND from anything
because we might go less than zero:

  gint64 start;
  if (sp->start < GST_MSECOND)
    start = 0;
    start = sp->start - GST_MSECOND;

  if (cur < start) || start + GST_MSECOND < cur)
    _tv_seek (fv, sp->start);

We can't manage with 63 bits?

Victory to the Divine Mother!!         after all,
  http://sahajayoga.org                  http://why-compete.org

More information about the gstreamer-devel mailing list