Add default_language flag

Setting this flag will tag any matching tracks with kRoleMain.
The player will then know which tracks should be default when there
is not a language match.

Closes #155

Change-Id: I827304c49e345d07b1e76f7a46421b60f228f0ba
This commit is contained in:
Joey Parrish 2016-09-28 14:42:52 -07:00
parent 07c4b4f3bd
commit cda495fb57
5 changed files with 13 additions and 1 deletions

View File

@ -43,6 +43,11 @@ DEFINE_double(suggested_presentation_delay,
0.0, 0.0,
"Specifies a delay, in seconds, to be added to the media " "Specifies a delay, in seconds, to be added to the media "
"presentation time. This value is used for live profile only."); "presentation time. This value is used for live profile only.");
DEFINE_string(default_language,
"",
"Any tracks tagged with this language will have "
"<Role ... value=\"main\" /> in the manifest. This allows the "
"player to choose the correct default language for the content.");
DEFINE_bool(generate_dash_if_iop_compliant_mpd, DEFINE_bool(generate_dash_if_iop_compliant_mpd,
false, false,
"Try to generate DASH-IF IOPv3 compliant MPD. This is best effort " "Try to generate DASH-IF IOPv3 compliant MPD. This is best effort "

View File

@ -19,6 +19,7 @@ DECLARE_double(minimum_update_period);
DECLARE_double(min_buffer_time); DECLARE_double(min_buffer_time);
DECLARE_double(time_shift_buffer_depth); DECLARE_double(time_shift_buffer_depth);
DECLARE_double(suggested_presentation_delay); DECLARE_double(suggested_presentation_delay);
DECLARE_string(default_language);
DECLARE_bool(generate_dash_if_iop_compliant_mpd); DECLARE_bool(generate_dash_if_iop_compliant_mpd);
#endif // APP_MPD_FLAGS_H_ #endif // APP_MPD_FLAGS_H_

View File

@ -177,6 +177,7 @@ bool GetMpdOptions(MpdOptions* mpd_options) {
mpd_options->time_shift_buffer_depth = FLAGS_time_shift_buffer_depth; mpd_options->time_shift_buffer_depth = FLAGS_time_shift_buffer_depth;
mpd_options->suggested_presentation_delay = mpd_options->suggested_presentation_delay =
FLAGS_suggested_presentation_delay; FLAGS_suggested_presentation_delay;
mpd_options->default_language = FLAGS_default_language;
return true; return true;
} }

View File

@ -413,8 +413,12 @@ AdaptationSet* MpdBuilder::AddAdaptationSet(const std::string& lang) {
std::unique_ptr<AdaptationSet> adaptation_set( std::unique_ptr<AdaptationSet> adaptation_set(
new AdaptationSet(adaptation_set_counter_.GetNext(), lang, mpd_options_, new AdaptationSet(adaptation_set_counter_.GetNext(), lang, mpd_options_,
type_, &representation_counter_)); type_, &representation_counter_));
DCHECK(adaptation_set); DCHECK(adaptation_set);
if (!lang.empty() && lang == mpd_options_.default_language) {
adaptation_set->AddRole(AdaptationSet::kRoleMain);
}
adaptation_sets_.push_back(std::move(adaptation_set)); adaptation_sets_.push_back(std::move(adaptation_set));
return adaptation_sets_.back().get(); return adaptation_sets_.back().get();
} }

View File

@ -28,6 +28,7 @@ struct MpdOptions {
double min_buffer_time; double min_buffer_time;
double time_shift_buffer_depth; double time_shift_buffer_depth;
double suggested_presentation_delay; double suggested_presentation_delay;
std::string default_language;
}; };
} // namespace shaka } // namespace shaka