mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
Optimize the two functions that return the number and the list of languages in a single function
This commit is contained in:
parent
fab388c9fd
commit
ec44485510
3 changed files with 37 additions and 63 deletions
|
@ -540,15 +540,13 @@ gst_dash_demux_sink_event (GstPad * pad, GstEvent * event)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GList *listLang = NULL;
|
||||||
guint nb_audio =
|
guint nb_audio =
|
||||||
gst_mpdparser_get_nb_audio_adapt_set (demux->client->
|
gst_mpdparser_get_list_and_nb_of_audio_language (&listLang,
|
||||||
cur_period->AdaptationSets);
|
demux->client->cur_period->AdaptationSets);
|
||||||
GST_INFO_OBJECT (demux, "Number of language is=%d", nb_audio);
|
|
||||||
if (nb_audio == 0)
|
if (nb_audio == 0)
|
||||||
nb_audio = 1;
|
nb_audio = 1;
|
||||||
GList *listLang = NULL;
|
GST_INFO_OBJECT (demux, "Number of language is=%d", nb_audio);
|
||||||
gst_mpdparser_get_list_of_audio_language (&listLang,
|
|
||||||
demux->client->cur_period->AdaptationSets);
|
|
||||||
guint i = 0;
|
guint i = 0;
|
||||||
for (i = 0; i < nb_audio; i++) {
|
for (i = 0; i < nb_audio; i++) {
|
||||||
gchar *lang = (gchar *) g_list_nth_data (listLang, i);
|
gchar *lang = (gchar *) g_list_nth_data (listLang, i);
|
||||||
|
|
|
@ -2898,61 +2898,38 @@ guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstMpdClient *cli
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
gst_mpdparser_get_nb_audio_adapt_set(GList * AdaptationSets)
|
gst_mpdparser_get_list_and_nb_of_audio_language (GList **lang,
|
||||||
|
GList *AdaptationSets)
|
||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
GstAdaptationSetNode *adapt_set;
|
GstAdaptationSetNode *adapt_set;
|
||||||
guint nb_adapatation_set = 0;
|
gchar *this_mimeType = "audio";
|
||||||
gchar *this_mimeType = "audio";
|
gchar *mimeType = NULL;
|
||||||
gchar *mimeType = NULL;
|
guint nb_adapatation_set = 0;
|
||||||
if (AdaptationSets == NULL)
|
if (AdaptationSets == NULL)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
for (list = g_list_first (AdaptationSets); list; list = g_list_next (list)) {
|
for (list = g_list_first (AdaptationSets); list; list = g_list_next (list)) {
|
||||||
adapt_set = (GstAdaptationSetNode *) list->data;
|
adapt_set = (GstAdaptationSetNode *) list->data;
|
||||||
if (adapt_set) {
|
if (adapt_set) {
|
||||||
GstRepresentationNode *rep;
|
gchar *this_lang = adapt_set->lang;
|
||||||
rep =
|
GstRepresentationNode *rep;
|
||||||
gst_mpdparser_get_lowest_representation (adapt_set->Representations);
|
rep =
|
||||||
if (rep->RepresentationBase)
|
gst_mpdparser_get_lowest_representation (adapt_set->Representations);
|
||||||
mimeType = rep->RepresentationBase->mimeType;
|
if (rep->RepresentationBase)
|
||||||
if (!mimeType && adapt_set->RepresentationBase) {
|
mimeType = rep->RepresentationBase->mimeType;
|
||||||
mimeType = adapt_set->RepresentationBase->mimeType;
|
if (!mimeType && adapt_set->RepresentationBase) {
|
||||||
}
|
mimeType = adapt_set->RepresentationBase->mimeType;
|
||||||
if (strncmp_ext (mimeType, this_mimeType) == 0)
|
}
|
||||||
nb_adapatation_set++;
|
|
||||||
}
|
if (strncmp_ext (mimeType, this_mimeType) == 0) {
|
||||||
}
|
if (this_lang) {
|
||||||
return nb_adapatation_set;
|
nb_adapatation_set++;
|
||||||
|
*lang = g_list_append (*lang, this_lang);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nb_adapatation_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gst_mpdparser_get_list_of_audio_language(GList** lang, GList * AdaptationSets)
|
|
||||||
{
|
|
||||||
GList *list;
|
|
||||||
GstAdaptationSetNode *adapt_set;
|
|
||||||
gchar *this_mimeType = "audio";
|
|
||||||
gchar *mimeType = NULL;
|
|
||||||
if (AdaptationSets == NULL)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
for (list = g_list_first (AdaptationSets); list; list = g_list_next (list)) {
|
|
||||||
adapt_set = (GstAdaptationSetNode *) list->data;
|
|
||||||
if (adapt_set) {
|
|
||||||
gchar *this_lang = adapt_set->lang;
|
|
||||||
GstRepresentationNode *rep;
|
|
||||||
rep =
|
|
||||||
gst_mpdparser_get_lowest_representation (adapt_set->Representations);
|
|
||||||
if (rep->RepresentationBase)
|
|
||||||
mimeType = rep->RepresentationBase->mimeType;
|
|
||||||
if (!mimeType && adapt_set->RepresentationBase) {
|
|
||||||
mimeType = adapt_set->RepresentationBase->mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp_ext (mimeType, this_mimeType) == 0){
|
|
||||||
if(this_lang){
|
|
||||||
*lang = g_list_append (*lang, this_lang);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -483,9 +483,8 @@ guint gst_mpd_client_get_height_of_video_current_stream (GstMpdClient *client,
|
||||||
guint gst_mpd_client_get_rate_of_audio_current_stream (GstMpdClient *client, GstActiveStream *stream);
|
guint gst_mpd_client_get_rate_of_audio_current_stream (GstMpdClient *client, GstActiveStream *stream);
|
||||||
guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstMpdClient *client, GstActiveStream *stream);
|
guint gst_mpd_client_get_num_channels_of_audio_current_stream (GstMpdClient *client, GstActiveStream *stream);
|
||||||
|
|
||||||
/* To support multi language */
|
/* Support multi language */
|
||||||
guint gst_mpdparser_get_nb_audio_adapt_set(GList *AdaptationSets);
|
guint gst_mpdparser_get_list_and_nb_of_audio_language(GList **lang, GList *AdaptationSets);
|
||||||
void gst_mpdparser_get_list_of_audio_language(GList** lang, GList * AdaptationSets);
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_MPDPARSER_H__ */
|
#endif /* __GST_MPDPARSER_H__ */
|
||||||
|
|
Loading…
Reference in a new issue