Change GST_GET_TIMESTAMP into gst_util_get_timestamp and replace all uses as we don...
authorStefan Kost <ensonic@users.sourceforge.net>
Tue, 11 Dec 2007 20:23:58 +0000 (20:23 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Tue, 11 Dec 2007 20:23:58 +0000 (20:23 +0000)
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.

ChangeLog
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

index a3d5f68..80f334c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index 1b9b3a9..d5700a9 100644 (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
index 9ec2260..3c07d04 100644 (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:
index 0927eee..71d383e 100644 (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);
index 0ca3346..d7edcf5 100644 (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",
index 27bbe77..6425ff8 100644 (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
+}
index 860bd87..dd438af 100644 (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__ */
index 9780b57..629af60 100644 (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);
 
index 01c92ec..73efd78 100644 (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);