mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
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.
This commit is contained in:
parent
6affcdd2ad
commit
087c8957d2
3 changed files with 21 additions and 24 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue