+
+vector<dcp::LanguageTag>
+Film::audio_languages () const
+{
+ vector<dcp::LanguageTag> result;
+ for (auto i: content()) {
+ if (i->audio && !i->audio->mapping().mapped_output_channels().empty() && i->audio->language()) {
+ result.push_back (i->audio->language().get());
+ }
+ }
+
+ std::sort (result.begin(), result.end());
+ auto last = std::unique (result.begin(), result.end());
+ result.erase (last, result.end());
+ return result;
+}
+
+
+pair<optional<dcp::LanguageTag>, vector<dcp::LanguageTag>>
+Film::subtitle_languages () const
+{
+ pair<optional<dcp::LanguageTag>, vector<dcp::LanguageTag>> result;
+ for (auto i: content()) {
+ for (auto j: i->text) {
+ if (j->use() && j->type() == TextType::OPEN_SUBTITLE && j->language()) {
+ if (j->language_is_additional()) {
+ result.second.push_back (j->language().get());
+ } else {
+ result.first = j->language().get();
+ }
+ }
+ }
+ if (i->video && i->video->burnt_subtitle_language()) {
+ result.first = i->video->burnt_subtitle_language();
+ }
+ }
+
+ std::sort (result.second.begin(), result.second.end());
+ auto last = std::unique (result.second.begin(), result.second.end());
+ result.second.erase (last, result.second.end());
+ return result;
+}
+
+