diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | docs/gst/gstreamer-sections.txt | 3 | ||||
-rw-r--r-- | gst/gstclock.h | 25 | ||||
-rw-r--r-- | gst/gstdebugutils.c | 6 | ||||
-rw-r--r-- | gst/gstinfo.c | 8 | ||||
-rw-r--r-- | gst/gstutils.c | 27 | ||||
-rw-r--r-- | gst/gstutils.h | 2 | ||||
-rw-r--r-- | libs/gst/base/gstbasesink.c | 4 | ||||
-rw-r--r-- | tools/gst-launch.c | 4 |
9 files changed, 55 insertions, 38 deletions
@@ -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: diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 1b9b3a91d4..d5700a96a4 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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 diff --git a/gst/gstclock.h b/gst/gstclock.h index 9ec226076a..3c07d044ce 100644 --- a/gst/gstclock.h +++ b/gst/gstclock.h @@ -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: diff --git a/gst/gstdebugutils.c b/gst/gstdebugutils.c index 0927eeebfc..71d383ebd6 100644 --- a/gst/gstdebugutils.c +++ b/gst/gstdebugutils.c @@ -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); diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 0ca33469fd..d7edcf5df9 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -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", diff --git a/gst/gstutils.c b/gst/gstutils.c index 27bbe775c3..6425ff86e2 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -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 +} diff --git a/gst/gstutils.h b/gst/gstutils.h index 860bd873ee..dd438af890 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -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__ */ diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 9780b571d1..629af60262 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -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); diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 01c92ecfba..73efd78d5a 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -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); |