API: gst_discoverer_info_get_live
authorMathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Tue, 13 Jun 2017 00:25:31 +0000 (02:25 +0200)
committerMathieu Duponchelle <mathieu@centricular.com>
Wed, 11 Oct 2017 17:47:19 +0000 (19:47 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=783722

docs/libs/gst-plugins-base-libs-sections.txt
gst-libs/gst/pbutils/gstdiscoverer-types.c
gst-libs/gst/pbutils/gstdiscoverer.c
gst-libs/gst/pbutils/gstdiscoverer.h
gst-libs/gst/pbutils/pbutils-private.h
win32/common/libgstpbutils.def

index 1e5575d..36c78a9 100644 (file)
@@ -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
index d450241..8bd8c23 100644 (file)
@@ -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);
 
@@ -1028,6 +1029,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
  *
index b7f5c13..cdc26fb 100644 (file)
@@ -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
index b4505ed..2d3f8ae 100644 (file)
@@ -300,6 +300,9 @@ 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);
 
 GST_EXPORT
index 08d53ae..9f0c036 100644 (file)
@@ -102,6 +102,7 @@ struct _GstDiscovererInfo {
   GstStructure *misc;
   GstTagList *tags;
   GstToc *toc;
+  gboolean live;
   gboolean seekable;
   GPtrArray *missing_elements_details;
 
index f1fc203..39d0e78 100644 (file)
@@ -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