Change GST_GET_TIMESTAMP into gst_util_get_timestamp and replace all uses as we don't have HAVE_POSIX_TIMERS in publi...

Original commit message from CVS:
* 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.
This commit is contained in:
Stefan Kost 2007-12-11 20:23:58 +00:00
parent 9aca6f57c3
commit 428a4e9669
9 changed files with 55 additions and 38 deletions

View file

@ -1,3 +1,17 @@
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:

View file

@ -320,7 +320,6 @@ GST_TIMEVAL_TO_TIME
GST_TIME_TO_TIMEVAL
GST_TIMESPEC_TO_TIME
GST_TIME_TO_TIMESPEC
GST_GET_TIMESTAMP
GST_CLOCK_ENTRY_TRACE_NAME
GstClockEntry
GstClockCallback
@ -359,7 +358,6 @@ gst_clock_id_compare_func
gst_clock_id_ref
gst_clock_id_unref
GST_TYPE_CLOCK_TIME
<SUBSECTION Standard>
GST_CLOCK
GST_IS_CLOCK
@ -2169,6 +2167,7 @@ gst_util_uint64_scale
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

View file

@ -198,31 +198,6 @@ G_STMT_START { \
(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:

View file

@ -496,7 +496,7 @@ _gst_debug_bin_to_dot_file_with_ts (GstBin * bin, GstDebugGraphDetails details,
const gchar * file_name)
{
gchar *ts_file_name = NULL;
GstClockTime now, elapsed;
GstClockTime elapsed;
g_return_if_fail (GST_IS_BIN (bin));
@ -507,8 +507,8 @@ _gst_debug_bin_to_dot_file_with_ts (GstBin * bin, GstDebugGraphDetails details,
}
/* 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);

View file

@ -281,7 +281,7 @@ _gst_debug_init (void)
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,
@ -626,7 +626,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
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[] = {
@ -665,8 +665,8 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
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",

View file

@ -3327,3 +3327,30 @@ gst_type_register_static_full (GType parent_type,
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
}

View file

@ -689,6 +689,8 @@ GstElement * gst_parse_bin_from_description (const gchar * bin_descr
gboolean ghost_unconnected_pads,
GError ** err);
GstClockTime gst_util_get_timestamp (void) G_GNUC_PURE;
G_END_DECLS
#endif /* __GST_UTILS_H__ */

View file

@ -1969,11 +1969,11 @@ gst_base_sink_do_render_stats (GstBaseSink * basesink, gboolean start)
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);

View file

@ -773,9 +773,9 @@ main (int argc, char *argv[])
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);