mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
core: pipeline: add gst_pipeline_get_configured_latency()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4472>
This commit is contained in:
parent
ba4ab9dc16
commit
c9c7e83a78
3 changed files with 52 additions and 0 deletions
|
@ -32854,6 +32854,23 @@ clock, even if the pipeline is not in the PLAYING state.</doc>
|
|||
</instance-parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="get_configured_latency" c:identifier="gst_pipeline_get_configured_latency" version="1.24">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpipeline.c">Return the configured latency on @pipeline.</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gstpipeline.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpipeline.c">@pipeline configured latency, or %GST_CLOCK_TIME_NONE if none has been configured
|
||||
because @pipeline did not reach the PLAYING state yet.
|
||||
|
||||
MT safe.</doc>
|
||||
<type name="ClockTime" c:type="GstClockTime"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<instance-parameter name="pipeline" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpipeline.c">a #GstPipeline</doc>
|
||||
<type name="Pipeline" c:type="GstPipeline*"/>
|
||||
</instance-parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="get_delay" c:identifier="gst_pipeline_get_delay">
|
||||
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpipeline.c">Get the configured delay (see gst_pipeline_set_delay()).</doc>
|
||||
<source-position filename="../subprojects/gstreamer/gst/gstpipeline.h"/>
|
||||
|
|
|
@ -114,6 +114,7 @@ struct _GstPipelinePrivate
|
|||
/* with LOCK */
|
||||
gboolean auto_flush_bus;
|
||||
gboolean is_live;
|
||||
GstClockTime min_latency;
|
||||
|
||||
/* when we need to update stream_time or clock when going back to
|
||||
* PLAYING*/
|
||||
|
@ -234,6 +235,7 @@ gst_pipeline_init (GstPipeline * pipeline)
|
|||
pipeline->priv->latency = DEFAULT_LATENCY;
|
||||
|
||||
pipeline->priv->is_live = FALSE;
|
||||
pipeline->priv->min_latency = GST_CLOCK_TIME_NONE;
|
||||
|
||||
/* create and set a default bus */
|
||||
bus = gst_bus_new ();
|
||||
|
@ -521,6 +523,7 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition)
|
|||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
GST_OBJECT_LOCK (element);
|
||||
pipeline->priv->is_live = FALSE;
|
||||
pipeline->priv->min_latency = GST_CLOCK_TIME_NONE;
|
||||
GST_OBJECT_UNLOCK (element);
|
||||
reset_start_time (pipeline, 0);
|
||||
break;
|
||||
|
@ -701,6 +704,10 @@ gst_pipeline_do_latency (GstBin * bin)
|
|||
|
||||
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
|
||||
|
||||
GST_OBJECT_LOCK (pipeline);
|
||||
pipeline->priv->min_latency = min_latency;
|
||||
GST_OBJECT_UNLOCK (pipeline);
|
||||
|
||||
GST_DEBUG_OBJECT (pipeline,
|
||||
"got min latency %" GST_TIME_FORMAT ", max latency %"
|
||||
GST_TIME_FORMAT ", live %d", GST_TIME_ARGS (min_latency),
|
||||
|
@ -1200,3 +1207,28 @@ gst_pipeline_is_live (GstPipeline * pipeline)
|
|||
|
||||
return is_live;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pipeline_get_configured_latency:
|
||||
* @pipeline: a #GstPipeline
|
||||
*
|
||||
* Return the configured latency on @pipeline.
|
||||
*
|
||||
* Returns: @pipeline configured latency, or %GST_CLOCK_TIME_NONE if none has been configured
|
||||
* because @pipeline did not reach the PLAYING state yet.
|
||||
*
|
||||
* MT safe.
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
GstClockTime
|
||||
gst_pipeline_get_configured_latency (GstPipeline * pipeline)
|
||||
{
|
||||
GstClockTime min_latency;
|
||||
|
||||
GST_OBJECT_LOCK (pipeline);
|
||||
min_latency = pipeline->priv->min_latency;
|
||||
GST_OBJECT_UNLOCK (pipeline);
|
||||
|
||||
return min_latency;
|
||||
}
|
||||
|
|
|
@ -133,6 +133,9 @@ gboolean gst_pipeline_get_auto_flush_bus (GstPipeline *pipeline);
|
|||
GST_API
|
||||
gboolean gst_pipeline_is_live (GstPipeline *pipeline);
|
||||
|
||||
GST_API
|
||||
GstClockTime gst_pipeline_get_configured_latency (GstPipeline * pipeline);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPipeline, gst_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue