diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-01-17 23:41:23 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-01-17 23:41:23 +0100 |
| commit | 7cb1677e10b9692698ede5741c50d8c4b4144ddf (patch) | |
| tree | a24f02980936d0ade5a07d63e141b3d8e5649a5f /src/lib | |
| parent | 678dd30fea0434c6febe4badc47e7aa05ebe58bc (diff) | |
Move burnt subtitle checks into ::subtitle_languages().
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 33 | ||||
| -rw-r--r-- | src/lib/film.h | 6 |
2 files changed, 21 insertions, 18 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 5b6b44892..27d23b185 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -776,16 +776,25 @@ Film::mapped_audio_channels () const pair<optional<dcp::LanguageTag>, vector<dcp::LanguageTag>> -Film::subtitle_languages () const +Film::subtitle_languages(bool* burnt_in) const { + if (burnt_in) { + *burnt_in = true; + } + pair<optional<dcp::LanguageTag>, vector<dcp::LanguageTag>> result; for (auto i: content()) { for (auto const& text: i->text) { - if (text->use() && text->type() == TextType::OPEN_SUBTITLE && text->language()) { - if (text->language_is_additional()) { - result.second.push_back(text->language().get()); - } else { - result.first = text->language().get(); + if (text->use() && text->type() == TextType::OPEN_SUBTITLE) { + if (!text->burn() && burnt_in) { + *burnt_in = false; + } + if (text->language()) { + if (text->language_is_additional()) { + result.second.push_back(text->language().get()); + } else { + result.first = text->language().get(); + } } } } @@ -955,16 +964,8 @@ Film::isdcf_name (bool if_created_now) const isdcf_name += "_" + to_upper (audio_language); - auto burnt_in = true; - for (auto i: content_list) { - for (auto text: i->text) { - if (text->type() == TextType::OPEN_SUBTITLE && text->use() && !text->burn()) { - burnt_in = false; - } - } - } - - auto sub_langs = subtitle_languages(); + bool burnt_in; + auto sub_langs = subtitle_languages(&burnt_in); auto ccap_langs = closed_caption_languages(); if (sub_langs.first && sub_langs.first->language()) { auto lang = entry_for_language(*sub_langs.first); diff --git a/src/lib/film.h b/src/lib/film.h index 1341be8a3..13be4b8db 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -192,8 +192,10 @@ public: return _audio_language; } - /** @return pair containing the main subtitle language, and additional languages */ - std::pair<boost::optional<dcp::LanguageTag>, std::vector<dcp::LanguageTag>> subtitle_languages () const; + /** @param burnt_in If non-null, filled with true if all subtitles are burnt in, otherwise false. + * @return pair containing the main subtitle language, and additional languages + */ + std::pair<boost::optional<dcp::LanguageTag>, std::vector<dcp::LanguageTag>> subtitle_languages(bool* burnt_in = nullptr) const; /** @return all closed caption languages in the film */ std::vector<dcp::LanguageTag> closed_caption_languages() const; |
