diff --git a/girs/Gst-1.0.gir b/girs/Gst-1.0.gir index 788a3dc67b..92f61b1c34 100644 --- a/girs/Gst-1.0.gir +++ b/girs/Gst-1.0.gir @@ -32854,6 +32854,23 @@ clock, even if the pipeline is not in the PLAYING state. + + Return the configured latency on @pipeline. + + + @pipeline configured latency, or %GST_CLOCK_TIME_NONE if none has been configured +because @pipeline did not reach the PLAYING state yet. + +MT safe. + + + + + a #GstPipeline + + + + Get the configured delay (see gst_pipeline_set_delay()). diff --git a/subprojects/gstreamer/gst/gstpipeline.c b/subprojects/gstreamer/gst/gstpipeline.c index af31c95bc5..c1418336df 100644 --- a/subprojects/gstreamer/gst/gstpipeline.c +++ b/subprojects/gstreamer/gst/gstpipeline.c @@ -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; +} diff --git a/subprojects/gstreamer/gst/gstpipeline.h b/subprojects/gstreamer/gst/gstpipeline.h index 4d5b805884..5227c9bdd3 100644 --- a/subprojects/gstreamer/gst/gstpipeline.h +++ b/subprojects/gstreamer/gst/gstpipeline.h @@ -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