diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-05-11 13:50:57 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-05-12 22:11:06 +0200 |
| commit | 83d63bb331190db4372de4d0aaf8413c51f1eee4 (patch) | |
| tree | 1fed31a4b045fb1d586b2db445474d2d923b7845 /src/lib | |
| parent | ff02c27b53222592e394d7cde1c904b27a211488 (diff) | |
Handle fonts for ccaps coming from DCP content (#2525).
Not dealing with them calls all sort of chaos as described in the
bug report.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/dcp_content.cc | 1 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.cc | 3 | ||||
| -rw-r--r-- | src/lib/reel_writer.cc | 25 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 7d835e618..e7bef573b 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -276,6 +276,7 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) for (int i = 0; i < examiner->text_count(TextType::CLOSED_CAPTION); ++i) { auto c = make_shared<TextContent>(this, TextType::CLOSED_CAPTION, TextType::CLOSED_CAPTION); c->set_dcp_track (examiner->dcp_text_track(i)); + add_fonts_from_examiner(c, examiner->fonts()); new_text.push_back (c); } diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 6586e6e81..9c4f899c6 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -230,6 +230,9 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant) LOG_GENERAL("Closed caption %1 of reel %2 found", ccap->id(), reel->id()); + for (auto const& font: ccap->asset()->font_data()) { + reel_fonts.push_back(make_shared<dcpomatic::Font>(font.first, font.second)); + } } if (reel->main_markers ()) { diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 5d9f4dae0..139c5aed4 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -491,18 +491,17 @@ maybe_add_text ( shared_ptr<Result> reel_asset; if (asset) { - if (!std::is_same<Result, dcp::ReelClosedCaptionAsset>::value) { - if (film->interop()) { - if (chosen_interop_font) { - /* We only add one font, as Interop will ignore subsequent ones (and some validators will - * complain if they are even present) - */ - asset->add_font(fonts.get(chosen_interop_font), chosen_interop_font->data().get_value_or(default_font)); - } + if (film->interop()) { + if (chosen_interop_font) { + /* We only add one font, as Interop will ignore subsequent ones (and some validators will + * complain if they are even present) + */ + asset->add_font(fonts.get(chosen_interop_font), chosen_interop_font->data().get_value_or(default_font)); } else { - for (auto const& font: fonts.map()) { - asset->add_font(font.second, font.first->data().get_value_or(default_font)); - } + } + } else { + for (auto const& font: fonts.map()) { + asset->add_font(font.second, font.first->data().get_value_or(default_font)); } } @@ -979,9 +978,7 @@ ReelWriter::write (PlayerText subs, TextType type, optional<DCPTextTrack> track, i.set_out (dcp::Time(period.to.seconds() - _period.from.seconds(), tcr)); i.set_v_position(convert_vertical_position(i, film()->interop() ? dcp::SubtitleStandard::INTEROP : dcp::SubtitleStandard::SMPTE_2014)); auto sub = make_shared<dcp::SubtitleString>(i); - if (type == TextType::OPEN_SUBTITLE) { - sub->set_font(fonts.get(i.font)); - } + sub->set_font(fonts.get(i.font)); asset->add(sub); } |
