From 959f05190f52cab5c6d14abd486e8d754cbd9fe3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 15 Aug 2022 17:34:29 +0200 Subject: Tolerate missing FullContentTitleText (DoM bug #2295). --- src/cpl.cc | 10 ++++--- test/cpl_metadata_test.cc | 6 +++++ test/ref/cpl_metadata_test3.xml | 58 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 test/ref/cpl_metadata_test3.xml diff --git a/src/cpl.cc b/src/cpl.cc index 79726f7f..1c449f8f 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -243,9 +243,13 @@ CPL::read_composition_metadata_asset (cxml::ConstNodePtr node) { _cpl_metadata_id = remove_urn_uuid(node->string_child("Id")); - auto fctt = node->node_child("FullContentTitleText"); - _full_content_title_text = fctt->content(); - _full_content_title_text_language = fctt->optional_string_attribute("language"); + /* FullContentTitleText is compulsory but in DoM #2295 we saw a commercial tool which + * apparently didn't include it, so as usual we have to be defensive. + */ + if (auto fctt = node->optional_node_child("FullContentTitleText")) { + _full_content_title_text = fctt->content(); + _full_content_title_text_language = fctt->optional_string_attribute("language"); + } _release_territory = node->optional_string_child("ReleaseTerritory"); if (_release_territory) { diff --git a/test/cpl_metadata_test.cc b/test/cpl_metadata_test.cc index b141d271..e0abb81c 100644 --- a/test/cpl_metadata_test.cc +++ b/test/cpl_metadata_test.cc @@ -422,3 +422,9 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_roundtrip_test_2) ); } + +BOOST_AUTO_TEST_CASE(check_that_missing_full_content_title_text_is_tolerated) +{ + dcp::CPL cpl("test/ref/cpl_metadata_test3.xml"); +} + diff --git a/test/ref/cpl_metadata_test3.xml b/test/ref/cpl_metadata_test3.xml new file mode 100644 index 00000000..38d732a6 --- /dev/null +++ b/test/ref/cpl_metadata_test3.xml @@ -0,0 +1,58 @@ + + + urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b + + 2020-08-28T13:35:06+02:00 + libdcp1.6.4devel + libdcp1.6.4devel + + feature + + id + version + + + + + urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516 + + + urn:uuid:e98d059d-645f-4343-a30f-edc61d58b8e0 + 24 1 + 24 + 0 + 24 + JtPL3uT3jyKMLysaqgdBWQb/n2E= + 24 1 + 1998 1080 + + + urn:uuid:d36f4bb3-c4fa-4a95-9915-6fec3110cd71 + 24 1 + 24 + 71/L,R,C,LFE,-,-,-,-,-,-,-,-,-,FSKSync,-,- + 48000 1 + + 1998 + 1080 + + + 1440 + 1080 + + + + Application + + + DCP Constraints Profile + SMPTE-RDD-52:2020-Bv2.1 + + + + + + + + + -- cgit v1.2.3