Merge remote-tracking branch 'origin/main' into v2.17.x
authorCarl Hetherington <cth@carlh.net>
Fri, 28 Jun 2024 11:04:30 +0000 (13:04 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 28 Jun 2024 11:04:30 +0000 (13:04 +0200)
1  2 
cscript
src/lib/font_id_allocator.cc
test/data
test/subtitle_font_id_test.cc

diff --cc cscript
index baece29e1b2f458bf12ef1ed61c82052a8403352,1695985694bccb52490eebc9ca34b24f016995c6..c5e2df9e914fc88d34520bca17a0fe5681fcbde6
+++ b/cscript
@@@ -533,7 -523,19 +533,7 @@@ def make_spec(filename, version, target
      print('/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :', file=f)
  
  def dependencies(target, options):
-     deps = [('libdcp', 'v1.9.9', {'c++17': target.platform == 'osx'})]
 -
 -    if target.platform == 'linux':
 -        ffmpeg_options = { 'shared': False }
 -    else:
 -        ffmpeg_options = {}
 -
 -    if target.platform != 'linux' or target.distro != 'arch':
 -        deps = [('ffmpeg', '7276e269a93c2ae30e302c34708e8095ac5475e8', ffmpeg_options)]
 -    else:
 -        # Use distro-provided FFmpeg on Arch
 -        deps = []
 -
 -    deps.append(('libdcp', 'v1.8.101'))
++    deps = [('libdcp', 'v1.9.10', {'c++17': target.platform == 'osx'})]
      deps.append(('libsub', 'v1.6.49'))
      deps.append(('leqm-nrt', '30dcaea1373ac62fba050e02ce5b0c1085797a23'))
      deps.append(('rtaudio', 'f619b76'))
index 76b52e730c15afafd7d5ffee3ce277b4afa81217,5e4ae9c0f2d1d4bd8b3426d3009c5a550a735c71..d5430e8584907f94856cd7f2033ff3a0052748d7
@@@ -102,8 -116,10 +102,10 @@@ strin
  FontIDAllocator::font_id(int reel_index, string asset_id, string font_id) const
  {
        auto iter = _map.find(Font(reel_index, asset_id, font_id));
-       DCPOMATIC_ASSERT(iter != _map.end());
+       if (iter == _map.end()) {
+               return default_font_id();
+       }
 -      return String::compose("%1_%2", iter->second, font_id);
 +      return iter->second;
  }
  
  
diff --cc test/data
index 02050bb9632658f0ce85ace219302b534f81eecc,6a4fa8b7c13e4f09fcee995191a2c86e1eff9d6d..3a3b29c0f1e9e2654ddee2028be623e1e1b3a33f
+++ b/test/data
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit 02050bb9632658f0ce85ace219302b534f81eecc
 -Subproject commit 6a4fa8b7c13e4f09fcee995191a2c86e1eff9d6d
++Subproject commit 3a3b29c0f1e9e2654ddee2028be623e1e1b3a33f
index 49ad4ea05ddf3a5c6550c8e4c609c1f19db64636,12d804d20a23b0de9eb31f68bf485a317b349d7d..8ced35108552d6b716c71a4d536fe0c784df2983
@@@ -304,31 -303,16 +304,46 @@@ BOOST_AUTO_TEST_CASE(no_error_with_ccap
  }
  
  
 -                      dcp::VerificationNote::Code::MISSING_CPL_METADATA,
 +BOOST_AUTO_TEST_CASE(subtitle_font_ids_survive_project_save)
 +{
 +      std::string const name = "subtitle_font_ids_survive_project_save";
 +
 +      auto subs = content_factory("test/data/short.srt")[0];
 +      auto film = new_test_film(name + "_film", { subs });
 +      film->set_interop(false);
 +      make_and_verify_dcp(
 +              film,
 +              {
 +                      dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
 +                      dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
 +                      dcp::VerificationNote::Code::MISSING_CPL_METADATA
 +              });
 +
 +      auto dcp = std::make_shared<DCPContent>(film->dir(film->dcp_name()));
 +      auto film2 = new_test_film(name + "_film2", { dcp });
 +      film2->write_metadata();
 +
 +      auto film3 = std::make_shared<Film>(film2->dir("."));
 +      film3->read_metadata();
 +      BOOST_REQUIRE(!film3->content().empty());
 +      auto check_dcp = std::dynamic_pointer_cast<DCPContent>(film3->content()[0]);
 +      BOOST_REQUIRE(check_dcp);
 +
 +      check_dcp->check_font_ids();
 +}
 +
++
+ BOOST_AUTO_TEST_CASE(cope_with_unloaded_font_id)
+ {
+       /* This file has a <Font> with an ID that corresponds to no <LoadFont> */
+       auto subs = content_factory("test/data/unloaded_font.xml")[0];
+       auto film = new_test_film2("cope_with_unloaded_font_id", { subs });
++
+       make_and_verify_dcp(
+               film,
+               {
+                       dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
++                      dcp::VerificationNote::Code::MISSING_CPL_METADATA
+               });
+ }