diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt index 1e5575dcfb..36c78a9453 100644 --- a/docs/libs/gst-plugins-base-libs-sections.txt +++ b/docs/libs/gst-plugins-base-libs-sections.txt @@ -3250,6 +3250,7 @@ gst_discoverer_info_get_tags gst_discoverer_info_get_toc gst_discoverer_info_get_uri gst_discoverer_info_get_seekable +gst_discoverer_info_get_live gst_discoverer_info_ref gst_discoverer_info_unref gst_discoverer_info_to_variant diff --git a/gst-libs/gst/pbutils/gstdiscoverer-types.c b/gst-libs/gst/pbutils/gstdiscoverer-types.c index d450241535..8bd8c23c57 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer-types.c +++ b/gst-libs/gst/pbutils/gstdiscoverer-types.c @@ -413,6 +413,7 @@ gst_discoverer_info_copy (GstDiscovererInfo * ptr) ret->duration = ptr->duration; ret->result = ptr->result; ret->seekable = ptr->seekable; + ret->live = ptr->live; if (ptr->misc) ret->misc = gst_structure_copy (ptr->misc); @@ -1027,6 +1028,17 @@ DISCOVERER_INFO_ACCESSOR_CODE (duration, GstClockTime, GST_CLOCK_TIME_NONE); DISCOVERER_INFO_ACCESSOR_CODE (seekable, gboolean, FALSE); +/** + * gst_discoverer_info_get_live: + * @info: a #GstDiscovererInfo + * + * Returns: whether the URI is live. + * + * Since: 1.14 + */ + +DISCOVERER_INFO_ACCESSOR_CODE (live, gboolean, FALSE); + /** * gst_discoverer_info_get_misc: * @info: a #GstDiscovererInfo diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index b7f5c1359b..cdc26fb08a 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -1344,6 +1344,11 @@ discoverer_collect (GstDiscoverer * dc) } } + if (dc->priv->target_state == GST_STATE_PAUSED) + dc->priv->current_info->live = FALSE; + else + dc->priv->current_info->live = TRUE; + if (dc->priv->current_topology) dc->priv->current_info->stream_info = parse_stream_topology (dc, dc->priv->current_topology, NULL); @@ -1833,8 +1838,8 @@ _serialize_info (GstDiscovererInfo * info, GstDiscovererSerializeFlags flags) tags_str = gst_tag_list_to_string (info->tags); ret = - g_variant_new ("(mstbms)", info->uri, info->duration, info->seekable, - tags_str); + g_variant_new ("(mstbmsb)", info->uri, info->duration, info->seekable, + tags_str, info->live); g_free (tags_str); @@ -1961,6 +1966,8 @@ _parse_info (GstDiscovererInfo * info, GVariant * info_variant) str = _maybe_get_string_from_tuple (info_variant, 3); if (str) info->tags = gst_tag_list_new_from_string (str); + + GET_FROM_TUPLE (info_variant, boolean, 4, &info->live); } static void diff --git a/gst-libs/gst/pbutils/gstdiscoverer.h b/gst-libs/gst/pbutils/gstdiscoverer.h index b4505ed41e..2d3f8ae03c 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.h +++ b/gst-libs/gst/pbutils/gstdiscoverer.h @@ -299,6 +299,9 @@ GstClockTime gst_discoverer_info_get_duration(const GstDiscovererIn GST_EXPORT gboolean gst_discoverer_info_get_seekable(const GstDiscovererInfo* info); +GST_EXPORT +gboolean gst_discoverer_info_get_live(const GstDiscovererInfo* info); + GST_EXPORT const GstStructure* gst_discoverer_info_get_misc(const GstDiscovererInfo* info); diff --git a/gst-libs/gst/pbutils/pbutils-private.h b/gst-libs/gst/pbutils/pbutils-private.h index 08d53ae57f..9f0c0363ed 100644 --- a/gst-libs/gst/pbutils/pbutils-private.h +++ b/gst-libs/gst/pbutils/pbutils-private.h @@ -102,6 +102,7 @@ struct _GstDiscovererInfo { GstStructure *misc; GstTagList *tags; GstToc *toc; + gboolean live; gboolean seekable; GPtrArray *missing_elements_details; diff --git a/win32/common/libgstpbutils.def b/win32/common/libgstpbutils.def index f1fc2037b0..39d0e7810e 100644 --- a/win32/common/libgstpbutils.def +++ b/win32/common/libgstpbutils.def @@ -47,6 +47,7 @@ EXPORTS gst_discoverer_info_get_missing_elements_installer_details gst_discoverer_info_get_result gst_discoverer_info_get_seekable + gst_discoverer_info_get_live gst_discoverer_info_get_stream_info gst_discoverer_info_get_stream_list gst_discoverer_info_get_streams