gst/gstutils.c (gst_util_seqnum_next): Refactor for clarity.

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

* gst/gstutils.c (gst_util_seqnum_next): Refactor for clarity.

Also add API: to previous changelog entry.
This commit is contained in:
Andy Wingo 2008-11-04 13:56:37 +00:00
parent 5f5fbbdd7d
commit 1f1d642981
2 changed files with 15 additions and 9 deletions

View file

@ -1,15 +1,24 @@
2008-11-04 Andy Wingo <wingo@pobox.com> 2008-11-04 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c (gst_util_seqnum_next): Refactor for clarity.
2008-11-04 Andy Wingo <wingo@pobox.com>
Add sequence numbers to events and messages. See #559250.
* gst/gstutils.c (gst_util_seqnum_next, gst_util_seqnum_compare):
API: New functions.
* gst/gstevent.h: * gst/gstevent.h:
* gst/gstevent.c (_gst_event_copy, gst_event_new): Initialize new * gst/gstevent.c (_gst_event_copy, gst_event_new): Initialize new
events with a new sequence number, and copy it when copying. events with a new sequence number, and copy it when copying.
(gst_event_get_seqnum, gst_event_set_seqnum): Accessors for an (gst_event_get_seqnum, gst_event_set_seqnum): API: Accessors for
event's sequence number. an event's sequence number.
* gst/gstmessage.h: * gst/gstmessage.h:
* gst/gstmessage.c (_gst_message_copy, gst_message_new_custom): * gst/gstmessage.c (_gst_message_copy, gst_message_new_custom):
(gst_event_get_seqnum, gst_event_set_seqnum): As with events, so (gst_event_get_seqnum, gst_event_set_seqnum): API: As with events,
with messages. so with messages.
* docs/gst/gstreamer-sections.txt: Add new functions to the docs. * docs/gst/gstreamer-sections.txt: Add new functions to the docs.

View file

@ -594,11 +594,8 @@ overflow:
guint32 guint32
gst_util_seqnum_next (void) gst_util_seqnum_next (void)
{ {
static gint counter = -1; static gint counter = 0;
gint ret; return g_atomic_int_exchange_and_add (&counter, 1);
ret = g_atomic_int_exchange_and_add (&counter, 1);
return (guint32) (ret + 1);
} }
/** /**