+2007-12-11 Stefan Kost <ensonic@users.sf.net>
+
+ * docs/gst/gstreamer-sections.txt:
+ * gst/gstclock.h:
+ * gst/gstdebugutils.c:
+ * gst/gstinfo.c:
+ * gst/gstutils.c:
+ * gst/gstutils.h:
+ * libs/gst/base/gstbasesink.c:
+ * tools/gst-launch.c:
+ Change GST_GET_TIMESTAMP into gst_util_get_timestamp and replace all
+ uses as we don't have HAVE_POSIX_TIMERS in public headers.
+ Thanks Tim for spotting.
+
2007-12-09 Sebastian Dröge <slomo@circular-chaos.org>
* configure.ac:
GST_TIME_TO_TIMEVAL
GST_TIMESPEC_TO_TIME
GST_TIME_TO_TIMESPEC
-GST_GET_TIMESTAMP
GST_CLOCK_ENTRY_TRACE_NAME
GstClockEntry
GstClockCallback
gst_clock_id_ref
gst_clock_id_unref
GST_TYPE_CLOCK_TIME
-
<SUBSECTION Standard>
GST_CLOCK
GST_IS_CLOCK
gst_util_uint64_scale_int
gst_util_set_object_arg
gst_util_set_value_from_string
+gst_util_get_timestamp
<SUBSECTION Private>
GST_HAVE_UNALIGNED_ACCESS
gst_util_guint64_to_gdouble
(ts).tv_nsec = ((t) - (ts).tv_sec * GST_SECOND) / GST_NSECOND; \
} G_STMT_END
-/**
- * GST_GET_TIMESTAMP:
- * @now: GstClockTime variable that will get the timestamp
- *
- * Get a timestamp as GstClockTime to be used for interval meassurements.
- * The timestamp should now be interpreted in any other way.
- *
- * Since: 0.10.16
- */
-#ifdef HAVE_POSIX_TIMERS
-#define GST_GET_TIMESTAMP(now) \
-G_STMT_START { \
- struct timespec _now; \
- clock_gettime (CLOCK_MONOTONIC, &_now); \
- now = GST_TIMESPEC_TO_TIME (_now); \
-} G_STMT_END
-#else
-#define GST_GET_TIMESTAMP(now) \
-G_STMT_START { \
- GTimeVal _now; \
- g_get_current_time (&_now); \
- now = GST_TIMEVAL_TO_TIME (_now); \
-} G_STMT_END
-#endif
-
/* timestamp debugging macros */
/**
* GST_TIME_FORMAT:
const gchar * file_name)
{
gchar *ts_file_name = NULL;
- GstClockTime now, elapsed;
+ GstClockTime elapsed;
g_return_if_fail (GST_IS_BIN (bin));
}
/* add timestamp */
- GST_GET_TIMESTAMP (now);
- elapsed = GST_CLOCK_DIFF (_priv_gst_info_start_time, now);
+ elapsed = GST_CLOCK_DIFF (_priv_gst_info_start_time,
+ gst_util_get_timestamp ());
ts_file_name =
g_strdup_printf ("%" GST_TIME_FORMAT "-%s", GST_TIME_ARGS (elapsed),
file_name);
gst_atomic_int_set (&__use_color, 1);
/* get time we started for debugging messages */
- GST_GET_TIMESTAMP (_priv_gst_info_start_time);
+ _priv_gst_info_start_time = gst_util_get_timestamp ();
#ifdef HAVE_PRINTF_EXTENSION
register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr,
gchar pidcolor[10];
const gchar *levelcolor;
gint pid;
- GstClockTime now, elapsed;
+ GstClockTime elapsed;
gboolean free_color = TRUE;
gboolean free_obj = TRUE;
static const gchar *levelcolormap[] = {
free_obj = FALSE;
}
- GST_GET_TIMESTAMP (now);
- elapsed = GST_CLOCK_DIFF (_priv_gst_info_start_time, now);
+ elapsed = GST_CLOCK_DIFF (_priv_gst_info_start_time,
+ gst_util_get_timestamp ());
/*
g_printerr ("%s (%p - %" GST_TIME_FORMAT ") %s%20s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
return g_type_register_static (parent_type, type_name, &info, flags);
}
+
+
+/**
+ * gst_util_get_timestamp:
+ *
+ * Get a timestamp as GstClockTime to be used for interval meassurements.
+ * The timestamp should not be interpreted in any other way.
+ *
+ * Returns: the timestamp
+ *
+ * Since: 0.10.16
+ */
+G_GNUC_PURE GstClockTime
+gst_util_get_timestamp (void)
+{
+#ifdef HAVE_POSIX_TIMERS
+ struct timespec now;
+
+ clock_gettime (CLOCK_MONOTONIC, &now);
+ return GST_TIMESPEC_TO_TIME (now);
+#else
+ GTimeVal now;
+
+ g_get_current_time (&now);
+ return GST_TIMEVAL_TO_TIME (now);
+#endif
+}
gboolean ghost_unconnected_pads,
GError ** err);
+GstClockTime gst_util_get_timestamp (void) G_GNUC_PURE;
+
G_END_DECLS
#endif /* __GST_UTILS_H__ */
priv = basesink->priv;
if (start) {
- GST_GET_TIMESTAMP (priv->start);
+ priv->start = gst_util_get_timestamp ();
} else {
GstClockTime elapsed;
- GST_GET_TIMESTAMP (priv->stop);
+ priv->stop = gst_util_get_timestamp ();
elapsed = GST_CLOCK_DIFF (priv->start, priv->stop);
goto end;
}
- GST_GET_TIMESTAMP (tfthen);
+ tfthen = gst_util_get_timestamp ();
caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING);
- GST_GET_TIMESTAMP (tfnow);
+ tfnow = gst_util_get_timestamp ();
diff = GST_CLOCK_DIFF (tfthen, tfnow);