mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 22:46:24 +00:00
discoverer: Set number to stream infos
The idea is that we can reference to streams using this unique number, within the context of that discoverer info. That number should always be usable to reference the streams for a specific stream. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/897>
This commit is contained in:
parent
879526b2e2
commit
95c1f67d69
5 changed files with 36 additions and 5 deletions
|
@ -50,7 +50,7 @@ G_DEFINE_TYPE (GstDiscovererStreamInfo, gst_discoverer_stream_info,
|
||||||
static void
|
static void
|
||||||
gst_discoverer_stream_info_init (GstDiscovererStreamInfo * info)
|
gst_discoverer_stream_info_init (GstDiscovererStreamInfo * info)
|
||||||
{
|
{
|
||||||
/* Nothing needs initialization */
|
info->stream_number = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -143,6 +143,8 @@ gst_discoverer_info_copy_int (GstDiscovererStreamInfo * info,
|
||||||
if (stream_map)
|
if (stream_map)
|
||||||
g_hash_table_insert (stream_map, info, ret);
|
g_hash_table_insert (stream_map, info, ret);
|
||||||
|
|
||||||
|
ret->stream_number = info->stream_number;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,6 +720,23 @@ gst_discoverer_stream_info_get_misc (GstDiscovererStreamInfo * info)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_discoverer_stream_info_get_stream_number:
|
||||||
|
* @info: a #GstDiscovererStreamInfo
|
||||||
|
*
|
||||||
|
* Returns: the stream number, -1 if no index could be determined. This property
|
||||||
|
* acts as a unique identifier as a 'int' for the stream.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
gint
|
||||||
|
gst_discoverer_stream_info_get_stream_number (GstDiscovererStreamInfo * info)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_DISCOVERER_STREAM_INFO (info), -1);
|
||||||
|
|
||||||
|
return info->stream_number;
|
||||||
|
}
|
||||||
|
|
||||||
/* GstDiscovererContainerInfo */
|
/* GstDiscovererContainerInfo */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1284,6 +1284,7 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (add_to_list) {
|
if (add_to_list) {
|
||||||
|
res->stream_number = dc->priv->current_info->stream_count++;
|
||||||
dc->priv->current_info->stream_list =
|
dc->priv->current_info->stream_list =
|
||||||
g_list_append (dc->priv->current_info->stream_list, res);
|
g_list_append (dc->priv->current_info->stream_list, res);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1476,9 +1477,13 @@ discoverer_collect (GstDiscoverer * dc)
|
||||||
else
|
else
|
||||||
dc->priv->current_info->live = TRUE;
|
dc->priv->current_info->live = TRUE;
|
||||||
|
|
||||||
if (dc->priv->current_topology)
|
if (dc->priv->current_topology) {
|
||||||
|
dc->priv->current_info->stream_count = 1;
|
||||||
dc->priv->current_info->stream_info = parse_stream_topology (dc,
|
dc->priv->current_info->stream_info = parse_stream_topology (dc,
|
||||||
dc->priv->current_topology, NULL);
|
dc->priv->current_topology, NULL);
|
||||||
|
if (dc->priv->current_info->stream_info)
|
||||||
|
dc->priv->current_info->stream_info->stream_number = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Images need some special handling. They do not have a duration, have
|
* Images need some special handling. They do not have a duration, have
|
||||||
|
@ -2385,8 +2390,9 @@ _parse_discovery (GVariant * variant, GstDiscovererInfo * info)
|
||||||
_parse_common_stream_info (sinfo, g_variant_get_child_value (common, 0),
|
_parse_common_stream_info (sinfo, g_variant_get_child_value (common, 0),
|
||||||
info);
|
info);
|
||||||
|
|
||||||
if (!GST_IS_DISCOVERER_CONTAINER_INFO (sinfo))
|
if (!GST_IS_DISCOVERER_CONTAINER_INFO (sinfo)) {
|
||||||
info->stream_list = g_list_append (info->stream_list, sinfo);
|
info->stream_list = g_list_append (info->stream_list, sinfo);
|
||||||
|
}
|
||||||
|
|
||||||
if (!info->stream_info) {
|
if (!info->stream_info) {
|
||||||
info->stream_info = sinfo;
|
info->stream_info = sinfo;
|
||||||
|
|
|
@ -84,6 +84,9 @@ const GstStructure* gst_discoverer_stream_info_get_misc(GstDiscovererStream
|
||||||
GST_PBUTILS_API
|
GST_PBUTILS_API
|
||||||
const gchar * gst_discoverer_stream_info_get_stream_type_nick(GstDiscovererStreamInfo* info);
|
const gchar * gst_discoverer_stream_info_get_stream_type_nick(GstDiscovererStreamInfo* info);
|
||||||
|
|
||||||
|
GST_PBUTILS_API
|
||||||
|
gint gst_discoverer_stream_info_get_stream_number(GstDiscovererStreamInfo *info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstDiscovererContainerInfo:
|
* GstDiscovererContainerInfo:
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,6 +31,7 @@ struct _GstDiscovererStreamInfo {
|
||||||
GstToc *toc;
|
GstToc *toc;
|
||||||
gchar *stream_id;
|
gchar *stream_id;
|
||||||
GstStructure *misc;
|
GstStructure *misc;
|
||||||
|
gint stream_number;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstDiscovererContainerInfo {
|
struct _GstDiscovererContainerInfo {
|
||||||
|
@ -97,6 +98,8 @@ struct _GstDiscovererInfo {
|
||||||
gboolean seekable;
|
gboolean seekable;
|
||||||
GPtrArray *missing_elements_details;
|
GPtrArray *missing_elements_details;
|
||||||
|
|
||||||
|
gint stream_count;
|
||||||
|
|
||||||
gchar *cachefile;
|
gchar *cachefile;
|
||||||
gpointer from_cache;
|
gpointer from_cache;
|
||||||
};
|
};
|
||||||
|
|
|
@ -367,9 +367,9 @@ print_stream_info (GstDiscovererStreamInfo * info, void *depth)
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_print ("%*s%s: %s\n", 2 * GPOINTER_TO_INT (depth), " ",
|
g_print ("%*s%s #%d: %s\n", 2 * GPOINTER_TO_INT (depth), " ",
|
||||||
gst_discoverer_stream_info_get_stream_type_nick (info),
|
gst_discoverer_stream_info_get_stream_type_nick (info),
|
||||||
GST_STR_NULL (desc));
|
gst_discoverer_stream_info_get_stream_number (info), GST_STR_NULL (desc));
|
||||||
|
|
||||||
if (desc) {
|
if (desc) {
|
||||||
g_free (desc);
|
g_free (desc);
|
||||||
|
|
Loading…
Reference in a new issue