summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-05-11 13:50:57 +0200
committerCarl Hetherington <cth@carlh.net>2023-05-12 22:11:06 +0200
commit83d63bb331190db4372de4d0aaf8413c51f1eee4 (patch)
tree1fed31a4b045fb1d586b2db445474d2d923b7845 /src
parentff02c27b53222592e394d7cde1c904b27a211488 (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')
-rw-r--r--src/lib/dcp_content.cc1
-rw-r--r--src/lib/dcp_examiner.cc3
-rw-r--r--src/lib/reel_writer.cc25
-rw-r--r--src/wx/verify_dcp_dialog.cc6
4 files changed, 21 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);
}
diff --git a/src/wx/verify_dcp_dialog.cc b/src/wx/verify_dcp_dialog.cc
index 07e3589e5..b3e229087 100644
--- a/src/wx/verify_dcp_dialog.cc
+++ b/src/wx/verify_dcp_dialog.cc
@@ -106,6 +106,9 @@ VerifyDCPDialog::VerifyDCPDialog (wxWindow* parent, shared_ptr<VerifyDCPJob> job
if (note.size()) {
message.Replace("%size", std_to_wx(dcp::raw_convert<string>(note.size().get())));
}
+ if (note.id()) {
+ message.Replace("%id", std_to_wx(note.id().get()));
+ }
add_bullet (note.type(), message);
counts[note.type()]++;
};
@@ -419,6 +422,9 @@ VerifyDCPDialog::VerifyDCPDialog (wxWindow* parent, shared_ptr<VerifyDCPJob> job
case dcp::VerificationNote::Code::INCORRECT_SUBTITLE_NAMESPACE_COUNT:
add(i, _("The XML in the subtitle asset %n has more than one namespace declaration."));
break;
+ case dcp::VerificationNote::Code::MISSING_LOAD_FONT:
+ add(i, _("A subtitle or closed caption refers to a font with ID %id that does not have a corresponding <LoadFont> node."));
+ break;
}
}