dashdemux: Basic support for container-specific-track-id tag

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6041>
This commit is contained in:
Philippe Normand 2024-02-03 11:54:01 +00:00
parent e9ecde83a7
commit 080320609c

View file

@ -796,6 +796,7 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux)
GstPad *srcpad;
gchar *lang = NULL;
GstTagList *tags = NULL;
gchar *track_id = NULL;
active_stream =
gst_mpd_client_get_active_stream_by_index (demux->client, i);
@ -813,6 +814,48 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux)
if (srcpad == NULL)
continue;
if (active_stream->cur_adapt_set) {
/* FIXME: For CEA 608 and CEA 708 tracks we should check the Accessibility
* descriptor:
* https://dev.w3.org/html5/html-sourcing-inband-tracks/#mpegdash
* * An ISOBMFF CEA 608 caption service: the string "cc" concatenated with
* the value of the 'channel-number' field in the Accessibility descriptor
* in the ContentComponent or AdaptationSet.
* * An ISOBMFF CEA 708 caption service: the string "sn" concatenated with
* the value of the 'service-number' field in the Accessibility descriptor
* in the ContentComponent or AdaptationSet.
* * Otherwise:
*/
/* Content of the id attribute in the ContentComponent or AdaptationSet
* element. */
if (active_stream->cur_adapt_set->id) {
track_id = g_strdup_printf ("%d", active_stream->cur_adapt_set->id);
} else {
GList *it;
for (it = active_stream->cur_adapt_set->ContentComponents; it;
it = it->next) {
GstMPDContentComponentNode *cc_node = it->data;
if (cc_node->id) {
track_id = g_strdup_printf ("%u", cc_node->id);
break;
}
}
/* Empty string if the id attribute is not present on either
* element. */
if (!track_id)
track_id = g_strdup ("");
}
}
if (track_id) {
tags =
gst_tag_list_new (GST_TAG_CONTAINER_SPECIFIC_TRACK_ID, track_id,
NULL);
g_free (track_id);
}
caps = gst_dash_demux_get_input_caps (demux, active_stream);
GST_LOG_OBJECT (demux, "Creating stream %d %" GST_PTR_FORMAT, i, caps);
@ -835,10 +878,14 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux)
}
if (lang) {
if (!tags)
tags = gst_tag_list_new_empty ();
if (gst_tag_check_language_code (lang))
tags = gst_tag_list_new (GST_TAG_LANGUAGE_CODE, lang, NULL);
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_LANGUAGE_CODE,
lang, NULL);
else
tags = gst_tag_list_new (GST_TAG_LANGUAGE_NAME, lang, NULL);
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_LANGUAGE_NAME,
lang, NULL);
}
stream = (GstDashDemuxStream *)