[gst-cvs] gstreamer: pipeline: deprecate old methods, fix test

Wim Taymans wtay at kemper.freedesktop.org
Fri May 29 03:46:51 PDT 2009


Module: gstreamer
Branch: master
Commit: 087c8957d28bd948b514feff3fc8999786d1ac3a
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=087c8957d28bd948b514feff3fc8999786d1ac3a

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Fri May 29 12:21:36 2009 +0200

pipeline: deprecate old methods, fix test

Deprecate the old _set_stream_time and _get_last_stream_time methods because
they are now equivalent to the better named _set/_get_start_time.

---

 gst/gstpipeline.c             |   32 ++++++++++++++------------------
 gst/gstpipeline.h             |    2 ++
 tests/check/gst/gstpipeline.c |   11 +++++------
 3 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c
index e454d24..0872048 100644
--- a/gst/gstpipeline.c
+++ b/gst/gstpipeline.c
@@ -573,11 +573,7 @@ gst_pipeline_get_bus (GstPipeline * pipeline)
  * @pipeline: a #GstPipeline
  * @time: the new running time to set
  *
- * Note, the name of this function is wrong, it should be
- * gst_pipeline_set_new_running_time(), this function does not change the stream
- * time of the pipeline elements but the running time.
- *
- * Set the new running time of @pipeline to @time. The running time is used to
+ * Set the new start time of @pipeline to @time. The start time is used to
  * set the base time on the elements (see gst_element_set_base_time())
  * in the PAUSED->PLAYING state transition.
  *
@@ -588,30 +584,27 @@ gst_pipeline_get_bus (GstPipeline * pipeline)
  * pipelines have the same clock.
  *
  * MT safe.
+ *
+ * Deprecated: This function has the wrong name and is equivalent to
+ * gst_element_set_start_time(). 
  */
+#ifndef GST_REMOVE_DEPRECATED
 void
 gst_pipeline_set_new_stream_time (GstPipeline * pipeline, GstClockTime time)
 {
   g_return_if_fail (GST_IS_PIPELINE (pipeline));
 
-  GST_OBJECT_LOCK (pipeline);
-  GST_ELEMENT_START_TIME (pipeline) = time;
-  GST_OBJECT_UNLOCK (pipeline);
-
-  GST_DEBUG_OBJECT (pipeline, "set new stream_time to %" GST_TIME_FORMAT,
-      GST_TIME_ARGS (time));
+  gst_element_set_start_time (GST_ELEMENT_CAST (pipeline), time);
 
   if (time == GST_CLOCK_TIME_NONE)
     GST_DEBUG_OBJECT (pipeline, "told not to adjust base_time");
 }
+#endif /* GST_REMOVE_DEPRECATED */
 
 /**
  * gst_pipeline_get_last_stream_time:
  * @pipeline: a #GstPipeline
  *
- * Note, the name of this function is wrong, it should be
- * gst_pipeline_get_last_running_time().
- *
  * Gets the last running time of @pipeline. If the pipeline is PLAYING,
  * the returned time is the running time used to configure the element's
  * base time in the PAUSED->PLAYING state. If the pipeline is PAUSED, the
@@ -621,10 +614,14 @@ gst_pipeline_set_new_stream_time (GstPipeline * pipeline, GstClockTime time)
  * configured to not handle the management of the element's base time
  * (see gst_pipeline_set_new_stream_time()).
  *
+ * MT safe.
+ *
  * Returns: a #GstClockTime.
  *
- * MT safe.
+ * Deprecated: This function has the wrong name and is equivalent to
+ * gst_element_get_start_time(). 
  */
+#ifndef GST_REMOVE_DEPRECATED
 GstClockTime
 gst_pipeline_get_last_stream_time (GstPipeline * pipeline)
 {
@@ -632,12 +629,11 @@ gst_pipeline_get_last_stream_time (GstPipeline * pipeline)
 
   g_return_val_if_fail (GST_IS_PIPELINE (pipeline), GST_CLOCK_TIME_NONE);
 
-  GST_OBJECT_LOCK (pipeline);
-  result = GST_ELEMENT_START_TIME (pipeline);
-  GST_OBJECT_UNLOCK (pipeline);
+  result = gst_element_get_start_time (GST_ELEMENT_CAST (pipeline));
 
   return result;
 }
+#endif /* GST_REMOVE_DEPRECATED */
 
 static GstClock *
 gst_pipeline_provide_clock_func (GstElement * element)
diff --git a/gst/gstpipeline.h b/gst/gstpipeline.h
index 53a9e0a..6180c16 100644
--- a/gst/gstpipeline.h
+++ b/gst/gstpipeline.h
@@ -93,8 +93,10 @@ GstElement*	gst_pipeline_new		(const gchar *name);
 
 GstBus*		gst_pipeline_get_bus		(GstPipeline *pipeline);
 
+#ifndef GST_DISABLE_DEPRECATED
 void		gst_pipeline_set_new_stream_time  (GstPipeline *pipeline, GstClockTime time);
 GstClockTime	gst_pipeline_get_last_stream_time (GstPipeline *pipeline);
+#endif
 
 void            gst_pipeline_use_clock          (GstPipeline *pipeline, GstClock *clock);
 gboolean        gst_pipeline_set_clock          (GstPipeline *pipeline, GstClock *clock);
diff --git a/tests/check/gst/gstpipeline.c b/tests/check/gst/gstpipeline.c
index 244a5cc..17cc336 100644
--- a/tests/check/gst/gstpipeline.c
+++ b/tests/check/gst/gstpipeline.c
@@ -283,7 +283,7 @@ GST_START_TEST (test_base_time)
   fail_unless (clock && GST_IS_CLOCK (clock), "i want a clock dammit");
   gst_pipeline_use_clock (GST_PIPELINE (pipeline), clock);
 
-  fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline)) == 0,
+  fail_unless (gst_element_get_start_time (pipeline) == 0,
       "stream time doesn't start off at 0");
 
   probe_lock = g_mutex_new ();
@@ -331,7 +331,7 @@ GST_START_TEST (test_base_time)
     fail_unless (upper >= base, "bogus base time: %" GST_TIME_FORMAT " > %"
         GST_TIME_FORMAT, GST_TIME_ARGS (base), GST_TIME_ARGS (upper));
 
-    stream = gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline));
+    stream = gst_element_get_start_time (pipeline);
 
     fail_unless (stream > 0, "bogus new stream time: %" GST_TIME_FORMAT " > %"
         GST_TIME_FORMAT, GST_TIME_ARGS (stream), GST_TIME_ARGS (0));
@@ -399,7 +399,7 @@ GST_START_TEST (test_base_time)
 
     fail_if (observed == GST_CLOCK_TIME_NONE, "no timestamp recorded");
 
-    stream = gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline));
+    stream = gst_element_get_start_time (pipeline);
 
     fail_unless (base >= oldbase + WAIT_TIME, "base time not reset");
     fail_unless (upper >= base + stream, "bogus base time: %"
@@ -439,8 +439,7 @@ GST_START_TEST (test_base_time)
     fail_unless (lower >= upper + WAIT_TIME, "clock did not advance?");
 
     /* bling */
-    gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline),
-        GST_CLOCK_TIME_NONE);
+    gst_element_set_start_time (pipeline, GST_CLOCK_TIME_NONE);
 
     gst_element_set_state (pipeline, GST_STATE_PLAYING);
     fail_unless (gst_element_get_state (pipeline, NULL, NULL,
@@ -470,7 +469,7 @@ GST_START_TEST (test_base_time)
 
     fail_if (observed == GST_CLOCK_TIME_NONE, "no timestamp recorded");
 
-    fail_unless (gst_pipeline_get_last_stream_time (GST_PIPELINE (pipeline))
+    fail_unless (gst_element_get_start_time (pipeline)
         == GST_CLOCK_TIME_NONE, "stream time was reset");
 
     fail_unless (base == oldbase, "base time was reset");





More information about the Gstreamer-commits mailing list