if (info->toc)
gst_toc_unref (info->toc);
+ g_free (info->stream_id);
+
if (info->misc)
gst_structure_free (info->misc);
}
if (info->toc)
ret->toc = gst_toc_ref (info->toc);
+ if (info->stream_id)
+ ret->stream_id = g_strdup (info->stream_id);
+
if (info->misc)
ret->misc = gst_structure_copy (info->misc);
}
/**
+ * gst_discoverer_stream_info_get_stream_id:
+ * @info: a #GstDiscovererStreamInfo
+ *
+ * Returns: (transfer none): the stream ID of this stream. If you wish to
+ * use the stream ID after the life-time of @info you will need to copy it.
+ */
+const gchar *
+gst_discoverer_stream_info_get_stream_id (GstDiscovererStreamInfo * info)
+{
+ g_return_val_if_fail (GST_IS_DISCOVERER_STREAM_INFO (info), NULL);
+
+ return info->stream_id;
+}
+
+/**
* gst_discoverer_stream_info_get_misc:
* @info: a #GstDiscovererStreamInfo
*
static GQuark _CAPS_QUARK;
static GQuark _TAGS_QUARK;
static GQuark _TOC_QUARK;
+static GQuark _STREAM_ID_QUARK;
static GQuark _MISSING_PLUGIN_QUARK;
static GQuark _STREAM_TOPOLOGY_QUARK;
static GQuark _TOPOLOGY_PAD_QUARK;
GstElement *sink;
GstTagList *tags;
GstToc *toc;
+ gchar *stream_id;
} PrivateStream;
struct _GstDiscovererPrivate
_CAPS_QUARK = g_quark_from_static_string ("caps");
_TAGS_QUARK = g_quark_from_static_string ("tags");
- _TOC_QUARK = g_quark_from_static_string ("toc");
+ _TOC_QUARK = g_quark_from_static_string ("stream-id");
+ _STREAM_ID_QUARK = g_quark_from_static_string ("toc");
_MISSING_PLUGIN_QUARK = g_quark_from_static_string ("missing-plugin");
_STREAM_TOPOLOGY_QUARK = g_quark_from_static_string ("stream-topology");
_TOPOLOGY_PAD_QUARK = g_quark_from_static_string ("pad");
DISCO_UNLOCK (ps->dc);
break;
}
+ case GST_EVENT_STREAM_START:{
+ const gchar *stream_id;
+
+ gst_event_parse_stream_start (event, &stream_id);
+
+ g_free (ps->stream_id);
+ ps->stream_id = stream_id ? g_strdup (stream_id) : NULL;
+ break;
+ }
default:
break;
}
if (ps->toc) {
gst_toc_unref (ps->toc);
}
+ g_free (ps->stream_id);
g_slice_free (PrivateStream, ps);
gst_structure_id_set (st, _TAGS_QUARK, GST_TYPE_TAG_LIST, ps->tags, NULL);
if (ps->toc)
gst_structure_id_set (st, _TOC_QUARK, GST_TYPE_TOC, ps->toc, NULL);
+ if (ps->stream_id)
+ gst_structure_id_set (st, _STREAM_ID_QUARK, G_TYPE_STRING, ps->stream_id,
+ NULL);
return st;
}
GstTagList *tags_st;
GstToc *toc_st;
const gchar *name;
+ gchar *stream_id;
int tmp;
guint utmp;
info->parent.toc = toc_st;
}
+ if (gst_structure_id_has_field (st, _STREAM_ID_QUARK)) {
+ gst_structure_id_get (st, _STREAM_ID_QUARK, G_TYPE_STRING, &stream_id,
+ NULL);
+ info->parent.stream_id = stream_id;
+ }
+
if (!info->language && ((GstDiscovererStreamInfo *) info)->tags) {
gchar *language;
if (gst_tag_list_get_string (((GstDiscovererStreamInfo *) info)->tags,
info->parent.toc = toc_st;
}
+ if (gst_structure_id_has_field (st, _STREAM_ID_QUARK)) {
+ gst_structure_id_get (st, _STREAM_ID_QUARK, G_TYPE_STRING, &stream_id,
+ NULL);
+ info->parent.stream_id = stream_id;
+ }
+
gst_caps_unref (caps);
return (GstDiscovererStreamInfo *) info;
info->parent.toc = toc_st;
}
+ if (gst_structure_id_has_field (st, _STREAM_ID_QUARK)) {
+ gst_structure_id_get (st, _STREAM_ID_QUARK, G_TYPE_STRING, &stream_id,
+ NULL);
+ info->parent.stream_id = stream_id;
+ }
+
if (!info->language && ((GstDiscovererStreamInfo *) info)->tags) {
gchar *language;
if (gst_tag_list_get_string (((GstDiscovererStreamInfo *) info)->tags,
info->toc = toc_st;
}
+ if (gst_structure_id_get (st, _STREAM_ID_QUARK, G_TYPE_STRING, &stream_id,
+ NULL)) {
+ info->stream_id = stream_id;
+ }
+
gst_caps_unref (caps);
return info;
}
my_g_string_append_printf (s, depth, " None\n");
}
+ my_g_string_append_printf (s, depth, "Stream ID: %s\n",
+ gst_discoverer_stream_info_get_stream_id (info));
+
audio_info = (GstDiscovererAudioInfo *) info;
ctmp = gst_discoverer_audio_info_get_language (audio_info);
my_g_string_append_printf (s, depth, "Language: %s\n",
my_g_string_append_printf (s, depth, " None\n");
}
+ my_g_string_append_printf (s, depth, "Stream ID: %s\n",
+ gst_discoverer_stream_info_get_stream_id (info));
+
video_info = (GstDiscovererVideoInfo *) info;
my_g_string_append_printf (s, depth, "Width: %u\n",
gst_discoverer_video_info_get_width (video_info));
my_g_string_append_printf (s, depth, " None\n");
}
+ my_g_string_append_printf (s, depth, "Stream ID: %s\n",
+ gst_discoverer_stream_info_get_stream_id (info));
+
subtitle_info = (GstDiscovererSubtitleInfo *) info;
ctmp = gst_discoverer_subtitle_info_get_language (subtitle_info);
my_g_string_append_printf (s, depth, "Language: %s\n",