Add Film::closed_caption_languages().
authorCarl Hetherington <cth@carlh.net>
Tue, 12 Sep 2023 21:14:06 +0000 (23:14 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 12 Sep 2023 21:14:06 +0000 (23:14 +0200)
src/lib/film.cc
src/lib/film.h

index daa88282d755cfd8b6e9f3d3b4c9f576de9ee5da..dabef62bb24b230a46aeea506d06a29b14fb166b 100644 (file)
@@ -815,6 +815,22 @@ Film::subtitle_languages () const
 }
 
 
+vector<dcp::LanguageTag>
+Film::closed_caption_languages() const
+{
+       vector<dcp::LanguageTag> result;
+       for (auto i: content()) {
+               for (auto text: i->text) {
+                       if (text->use() && text->type() == TextType::CLOSED_CAPTION && text->dcp_track() && text->dcp_track()->language) {
+                               result.push_back(*text->dcp_track()->language);
+                       }
+               }
+       }
+
+       return result;
+}
+
+
 /** @return a ISDCF-compliant name for a DCP of this film */
 string
 Film::isdcf_name (bool if_created_now) const
index 22b58f746a4ddc5602663409ce5ec6eb49b4df34..5c230614decc9fe657afd52bccc13d2b20ccb061 100644 (file)
@@ -192,6 +192,8 @@ public:
 
        /** @return pair containing the main subtitle language, and additional languages */
        std::pair<boost::optional<dcp::LanguageTag>, std::vector<dcp::LanguageTag>> subtitle_languages () const;
+       /** @return all closed caption languages in the film */
+       std::vector<dcp::LanguageTag> closed_caption_languages() const;
 
        std::string content_summary (dcpomatic::DCPTimePeriod period) const;