mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
mssdemux2: Ensure stream/track uniqueness
If there is more than one track of the same type (say audio), we would end up creating several stream/types with the same name. Instead use the MSS stream name property to make them unique Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2319>
This commit is contained in:
parent
10f72da504
commit
2ec79418df
3 changed files with 33 additions and 6 deletions
|
@ -369,14 +369,28 @@ gst_mss_demux_setup_streams (GstAdaptiveDemux * demux)
|
||||||
GstStreamType stream_type =
|
GstStreamType stream_type =
|
||||||
gst_stream_type_from_mss_type (gst_mss_stream_get_type
|
gst_stream_type_from_mss_type (gst_mss_stream_get_type
|
||||||
(manifeststream));
|
(manifeststream));
|
||||||
const gchar *lang, *stream_id = gst_stream_type_get_name (stream_type);
|
const gchar *lang = gst_mss_stream_get_lang (manifeststream);
|
||||||
gchar *name;
|
const gchar *name = gst_mss_stream_get_name (manifeststream);
|
||||||
|
gchar *stream_id;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstTagList *tags = NULL;
|
GstTagList *tags = NULL;
|
||||||
|
|
||||||
name = g_strdup_printf ("mss-stream-%s", stream_id);
|
if (name)
|
||||||
mss_stream = g_object_new (GST_TYPE_MSS_DEMUX_STREAM, "name", name, NULL);
|
stream_id =
|
||||||
g_free (name);
|
g_strdup_printf ("mss-stream-%s-%s",
|
||||||
|
gst_stream_type_get_name (stream_type),
|
||||||
|
gst_mss_stream_get_name (manifeststream));
|
||||||
|
else if (lang)
|
||||||
|
stream_id =
|
||||||
|
g_strdup_printf ("mss-stream-%s-%s",
|
||||||
|
gst_stream_type_get_name (stream_type), lang);
|
||||||
|
else
|
||||||
|
stream_id =
|
||||||
|
g_strdup_printf ("mss-stream-%s",
|
||||||
|
gst_stream_type_get_name (stream_type));
|
||||||
|
|
||||||
|
mss_stream =
|
||||||
|
g_object_new (GST_TYPE_MSS_DEMUX_STREAM, "name", stream_id, NULL);
|
||||||
|
|
||||||
stream = GST_ADAPTIVE_DEMUX2_STREAM_CAST (mss_stream);
|
stream = GST_ADAPTIVE_DEMUX2_STREAM_CAST (mss_stream);
|
||||||
stream->stream_type = stream_type;
|
stream->stream_type = stream_type;
|
||||||
|
@ -391,7 +405,6 @@ gst_mss_demux_setup_streams (GstAdaptiveDemux * demux)
|
||||||
caps = gst_mss_stream_get_caps (mss_stream->manifest_stream);
|
caps = gst_mss_stream_get_caps (mss_stream->manifest_stream);
|
||||||
gst_adaptive_demux2_stream_set_caps (stream, create_mss_caps (mss_stream,
|
gst_adaptive_demux2_stream_set_caps (stream, create_mss_caps (mss_stream,
|
||||||
caps));
|
caps));
|
||||||
lang = gst_mss_stream_get_lang (mss_stream->manifest_stream);
|
|
||||||
if (lang != NULL)
|
if (lang != NULL)
|
||||||
tags = gst_tag_list_new (GST_TAG_LANGUAGE_CODE, lang, NULL);
|
tags = gst_tag_list_new (GST_TAG_LANGUAGE_CODE, lang, NULL);
|
||||||
|
|
||||||
|
@ -399,6 +412,7 @@ gst_mss_demux_setup_streams (GstAdaptiveDemux * demux)
|
||||||
GST_STREAM_FLAG_NONE, (gchar *) stream_id, create_mss_caps (mss_stream,
|
GST_STREAM_FLAG_NONE, (gchar *) stream_id, create_mss_caps (mss_stream,
|
||||||
caps), tags);
|
caps), tags);
|
||||||
|
|
||||||
|
g_free (stream_id);
|
||||||
gst_adaptive_demux2_add_stream (demux, stream);
|
gst_adaptive_demux2_add_stream (demux, stream);
|
||||||
gst_adaptive_demux2_stream_add_track (stream, track);
|
gst_adaptive_demux2_stream_add_track (stream, track);
|
||||||
gst_adaptive_demux_track_unref (track);
|
gst_adaptive_demux_track_unref (track);
|
||||||
|
|
|
@ -44,6 +44,7 @@ GST_DEBUG_CATEGORY_EXTERN (mssdemux2_debug);
|
||||||
#define MSS_PROP_DURATION "d"
|
#define MSS_PROP_DURATION "d"
|
||||||
#define MSS_PROP_DVR_WINDOW_LENGTH "DVRWindowLength"
|
#define MSS_PROP_DVR_WINDOW_LENGTH "DVRWindowLength"
|
||||||
#define MSS_PROP_LANGUAGE "Language"
|
#define MSS_PROP_LANGUAGE "Language"
|
||||||
|
#define MSS_PROP_NAME "Name"
|
||||||
#define MSS_PROP_NUMBER "n"
|
#define MSS_PROP_NUMBER "n"
|
||||||
#define MSS_PROP_REPETITIONS "r"
|
#define MSS_PROP_REPETITIONS "r"
|
||||||
#define MSS_PROP_STREAM_DURATION "Duration"
|
#define MSS_PROP_STREAM_DURATION "Duration"
|
||||||
|
@ -84,6 +85,7 @@ struct _GstMssStream
|
||||||
|
|
||||||
gchar *url;
|
gchar *url;
|
||||||
gchar *lang;
|
gchar *lang;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
GstMssFragmentParser fragment_parser;
|
GstMssFragmentParser fragment_parser;
|
||||||
|
|
||||||
|
@ -254,6 +256,7 @@ _gst_mss_stream_init (GstMssManifest * manifest, GstMssStream * stream,
|
||||||
stream->xmlnode = node;
|
stream->xmlnode = node;
|
||||||
|
|
||||||
/* get the base url path generator */
|
/* get the base url path generator */
|
||||||
|
stream->name = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_NAME);
|
||||||
stream->url = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_URL);
|
stream->url = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_URL);
|
||||||
stream->lang = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_LANGUAGE);
|
stream->lang = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_LANGUAGE);
|
||||||
|
|
||||||
|
@ -263,12 +266,14 @@ _gst_mss_stream_init (GstMssManifest * manifest, GstMssStream * stream,
|
||||||
* of the manifest.
|
* of the manifest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
GST_DEBUG ("lang '%s' url %s", stream->lang, stream->url);
|
||||||
GST_DEBUG ("Live stream: %s, look-ahead fragments: %" G_GUINT64_FORMAT,
|
GST_DEBUG ("Live stream: %s, look-ahead fragments: %" G_GUINT64_FORMAT,
|
||||||
manifest->is_live ? "yes" : "no", manifest->look_ahead_fragment_count);
|
manifest->is_live ? "yes" : "no", manifest->look_ahead_fragment_count);
|
||||||
stream->has_live_fragments = manifest->is_live
|
stream->has_live_fragments = manifest->is_live
|
||||||
&& manifest->look_ahead_fragment_count;
|
&& manifest->look_ahead_fragment_count;
|
||||||
|
|
||||||
for (iter = node->children; iter; iter = iter->next) {
|
for (iter = node->children; iter; iter = iter->next) {
|
||||||
|
GST_LOG ("Handling child '%s'", iter->name);
|
||||||
if (node_has_type (iter, MSS_NODE_STREAM_FRAGMENT)) {
|
if (node_has_type (iter, MSS_NODE_STREAM_FRAGMENT)) {
|
||||||
gst_mss_fragment_list_builder_add (&builder, iter);
|
gst_mss_fragment_list_builder_add (&builder, iter);
|
||||||
} else if (node_has_type (iter, MSS_NODE_STREAM_QUALITY)) {
|
} else if (node_has_type (iter, MSS_NODE_STREAM_QUALITY)) {
|
||||||
|
@ -439,6 +444,7 @@ gst_mss_stream_free (GstMssStream * stream)
|
||||||
g_list_free_full (stream->qualities,
|
g_list_free_full (stream->qualities,
|
||||||
(GDestroyNotify) gst_mss_stream_quality_free);
|
(GDestroyNotify) gst_mss_stream_quality_free);
|
||||||
xmlFree (stream->url);
|
xmlFree (stream->url);
|
||||||
|
xmlFree (stream->name);
|
||||||
xmlFree (stream->lang);
|
xmlFree (stream->lang);
|
||||||
g_regex_unref (stream->regex_position);
|
g_regex_unref (stream->regex_position);
|
||||||
g_regex_unref (stream->regex_bitrate);
|
g_regex_unref (stream->regex_bitrate);
|
||||||
|
@ -1499,6 +1505,12 @@ gst_mss_stream_get_lang (GstMssStream * stream)
|
||||||
return stream->lang;
|
return stream->lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
gst_mss_stream_get_name (GstMssStream * stream)
|
||||||
|
{
|
||||||
|
return stream->name;
|
||||||
|
}
|
||||||
|
|
||||||
static GstClockTime
|
static GstClockTime
|
||||||
gst_mss_manifest_get_dvr_window_length_clock_time (GstMssManifest * manifest)
|
gst_mss_manifest_get_dvr_window_length_clock_time (GstMssManifest * manifest)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,6 +71,7 @@ GstFlowReturn gst_mss_stream_advance_fragment (GstMssStream * stream);
|
||||||
GstFlowReturn gst_mss_stream_regress_fragment (GstMssStream * stream);
|
GstFlowReturn gst_mss_stream_regress_fragment (GstMssStream * stream);
|
||||||
void gst_mss_stream_seek (GstMssStream * stream, gboolean forward, GstSeekFlags flags, gint64 time, gint64 * final_time);
|
void gst_mss_stream_seek (GstMssStream * stream, gboolean forward, GstSeekFlags flags, gint64 time, gint64 * final_time);
|
||||||
const gchar * gst_mss_stream_get_lang (GstMssStream * stream);
|
const gchar * gst_mss_stream_get_lang (GstMssStream * stream);
|
||||||
|
const gchar * gst_mss_stream_get_name (GstMssStream * stream);
|
||||||
|
|
||||||
const gchar * gst_mss_stream_type_name (GstMssStreamType streamtype);
|
const gchar * gst_mss_stream_type_name (GstMssStreamType streamtype);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue