- added macros GST_CLOCK_TIME_IS_VALID and GST_BUFFE_TIMESTAMP_IS_VALID

Original commit message from CVS:
- added macros GST_CLOCK_TIME_IS_VALID and GST_BUFFE_TIMESTAMP_IS_VALID
- use macros in some places
- buffer's timestamp field is a GstClockTime, not a guint64 - this is currently the same, but be sure to only use GstClockTime when working with timestamps in the future
This commit is contained in:
Benjamin Otte 2003-04-13 03:07:07 +00:00
parent e3b00b80bc
commit f4f0a51890
4 changed files with 11 additions and 8 deletions

View file

@ -188,8 +188,7 @@ gst_buffer_new (void)
(GstDataFreeFunction) gst_buffer_default_free,
(GstDataCopyFunction) gst_buffer_default_copy);
GST_BUFFER_BUFFERPOOL (buf) = NULL;
GST_BUFFER_POOL_PRIVATE (buf) = NULL;
GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
return buf;
}

View file

@ -25,6 +25,7 @@
#define __GST_BUFFER_H__
#include <gst/gstdata.h>
#include <gst/gstclock.h>
G_BEGIN_DECLS
@ -64,6 +65,8 @@ extern GType _gst_buffer_pool_type;
#define GST_BUFFER_BUFFERPOOL(buf) (GST_BUFFER(buf)->pool)
#define GST_BUFFER_POOL_PRIVATE(buf) (GST_BUFFER(buf)->pool_private)
#define GST_BUFFER_TIMESTAMP_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)))
typedef enum {
GST_BUFFER_READONLY = GST_DATA_READONLY,
GST_BUFFER_SUBBUFFER = GST_DATA_FLAG_LAST,
@ -84,7 +87,7 @@ struct _GstBuffer {
guint64 maxsize; /* max size of this buffer */
/* timestamp */
guint64 timestamp;
GstClockTime timestamp;
/* media specific offset */
guint64 offset;

View file

@ -115,7 +115,7 @@ gst_clock_new_periodic_id (GstClock *clock, GstClockTime start_time,
GstClockTime interval)
{
g_return_val_if_fail (GST_IS_CLOCK (clock), NULL);
g_return_val_if_fail (start_time != GST_CLOCK_TIME_NONE, NULL);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (start_time), NULL);
g_return_val_if_fail (interval != 0, NULL);
return gst_clock_entry_new (clock,
@ -165,7 +165,7 @@ gst_clock_id_wait (GstClockID id, GstClockTimeDiff *jitter)
entry = (GstClockEntry *) id;
requested = GST_CLOCK_ENTRY_TIME (entry);
if (requested == GST_CLOCK_TIME_NONE) {
if (! GST_CLOCK_TIME_IS_VALID (requested)) {
return GST_CLOCK_TIMEOUT;
}
@ -227,7 +227,7 @@ gst_clock_id_wait_async (GstClockID id,
entry = (GstClockEntry *) id;
clock = entry->clock;
if (GST_CLOCK_ENTRY_TIME (entry) == GST_CLOCK_TIME_NONE) {
if (! GST_CLOCK_TIME_IS_VALID (GST_CLOCK_ENTRY_TIME (entry))) {
(func) (clock, GST_CLOCK_TIME_NONE, id, user_data);
return GST_CLOCK_TIMEOUT;
}
@ -601,7 +601,7 @@ gst_clock_handle_discont (GstClock *clock, guint64 time)
" %" G_GUINT64_FORMAT " %d",
time, clock->start_time, clock->accept_discont);
if (time == GST_CLOCK_TIME_NONE)
if (! GST_CLOCK_TIME_IS_VALID (time))
return TRUE;
GST_LOCK (clock);

View file

@ -39,7 +39,8 @@ typedef guint64 GstClockTime;
typedef gint64 GstClockTimeDiff;
typedef gpointer GstClockID;
#define GST_CLOCK_TIME_NONE ((guint64)-1)
#define GST_CLOCK_TIME_NONE ((GstClockTime)-1)
#define GST_CLOCK_TIME_IS_VALID(time) ((time) != GST_CLOCK_TIME_NONE)
#define GST_SECOND ((guint64) G_USEC_PER_SEC * G_GINT64_CONSTANT (1000))
#define GST_MSECOND ((guint64) GST_SECOND / G_GINT64_CONSTANT (1000))