Don't add a font with an empty ID for ccaps either (#2762).
authorCarl Hetherington <cth@carlh.net>
Sun, 11 Feb 2024 19:13:04 +0000 (20:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 11 Feb 2024 22:31:39 +0000 (23:31 +0100)
Previously this was all changed so that for subs we add the default
font in a cleaner way (in db22f81ccce9e1a5f205e6d8b3c0631fc039a173).

I can't see why we shouldn't treat ccaps the same way, and indeed
not doing it causes an error as shown by the included test.

src/lib/dcp_examiner.cc
test/data
test/subtitle_font_id_test.cc

index d9c904720efd09b229ec336f91c37c2f43a533ef..72eb828605abe30221077532ab7d7b9dea28aaa5 100644 (file)
@@ -237,9 +237,6 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                                for (auto const& font: asset->font_data()) {
                                        _fonts.push_back({reel_index, asset->id(), make_shared<dcpomatic::Font>(font.first, font.second)});
                                }
-                               if (asset->font_data().empty()) {
-                                       _fonts.push_back({reel_index, asset->id(), make_shared<dcpomatic::Font>("")});
-                               }
                        }
                }
 
index 704f7643393caa29d77ddba138bff3642b273c46..4cb08962ba07e99c442cb12091c0347d84d8fd89 160000 (submodule)
--- a/test/data
+++ b/test/data
@@ -1 +1 @@
-Subproject commit 704f7643393caa29d77ddba138bff3642b273c46
+Subproject commit 4cb08962ba07e99c442cb12091c0347d84d8fd89
index 9575868a1f115b35d5ecd7d4e2f8b25eb2e2479e..bc09a9cf1e95ad1254890f67aa70649f6077e11d 100644 (file)
@@ -23,6 +23,7 @@
 #include "lib/dcp_content.h"
 #include "lib/film.h"
 #include "lib/font.h"
+#include "lib/player.h"
 #include "lib/text_content.h"
 #include "lib/util.h"
 #include <dcp/cpl.h>
@@ -291,3 +292,13 @@ BOOST_AUTO_TEST_CASE(use_first_loadfont_as_default)
        BOOST_REQUIRE_EQUAL(subtitle->font_data().size(), 1U);
        BOOST_CHECK(subtitle->font_data().begin()->second == dcp::ArrayData("test/data/Inconsolata-VF.ttf"));
 }
+
+
+BOOST_AUTO_TEST_CASE(no_error_with_ccap_that_mentions_no_font)
+{
+       auto dcp = make_shared<DCPContent>("test/data/ccap_only");
+       auto film = new_test_film2("no_error_with_ccap_that_mentions_no_font", { dcp });
+       auto player = Player(film, film->playlist());
+       while (!player.pass()) {}
+}
+