summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-12 20:21:28 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commit621b82e1a5dfeb34602f336d645c670618d6db7e (patch)
treec1ddb818231af715c6125168a51aab9fe796a2e8
parentf5bd0937a730e9dbb58f955c11df41abc56e89b5 (diff)
Bv2.1 6.2.1: Check that additional subtitle languages conform to RFC 5646.
-rw-r--r--BRANCH10
-rw-r--r--src/cpl.h5
-rw-r--r--src/verify.cc4
-rw-r--r--test/verify_test.cc28
4 files changed, 37 insertions, 10 deletions
diff --git a/BRANCH b/BRANCH
index fb9fc2b7..abeaa5e3 100644
--- a/BRANCH
+++ b/BRANCH
@@ -8,11 +8,11 @@ Mark things with [Bv2.1_paragraph]
6.1 must be smpte [/]
immersive audio DCPs must comply with 429-18, 429-19 [*] don't have these standards
6.2 Language and Territory must comply with RFC 5646
- - subtitle reel <Language> /
- - subtitle XML <Language> /
- - sound MXF Language /
- - ccap reel <Language> /
- - MainSubtitleLanguageList
+ - subtitle reel <Language> [/]
+ - subtitle XML <Language> [/]
+ - sound MXF Language [/]
+ - ccap reel <Language> [/]
+ - MainSubtitleLanguageList [/]
- RFC5646SpokenLanguage
- CPL metadata ReleaseTerritory
diff --git a/src/cpl.h b/src/cpl.h
index 316a5504..8d7c76e4 100644
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -54,6 +54,9 @@
#include <vector>
+struct verify_invalid_sound_reel_and_additional_language;
+
+
namespace dcp {
@@ -280,6 +283,8 @@ protected:
std::string pkl_type (Standard standard) const;
private:
+ friend struct ::verify_invalid_sound_reel_and_additional_language;
+
void maybe_write_composition_metadata_asset (xmlpp::Element* node) const;
void read_composition_metadata_asset (cxml::ConstNodePtr node);
diff --git a/src/verify.cc b/src/verify.cc
index e5deb789..16233021 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -643,6 +643,10 @@ dcp::verify (
stage ("Checking CPL", cpl->file());
validate_xml (cpl->file().get(), xsd_dtd_directory, notes);
+ BOOST_FOREACH (string const& i, cpl->additional_subtitle_languages()) {
+ verify_language_tag (i, notes);
+ }
+
/* Check that the CPL's hash corresponds to the PKL */
BOOST_FOREACH (shared_ptr<PKL> i, dcp->pkls()) {
optional<string> h = i->hash(cpl->id());
diff --git a/test/verify_test.cc b/test/verify_test.cc
index b2c4b542..91d4a8e1 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -951,18 +951,27 @@ BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_languages)
}
-/* SMPTE DCP with invalid <Language> in the MainSound reel */
-BOOST_AUTO_TEST_CASE (verify_invalid_sound_reel_language)
+/* SMPTE DCP with invalid <Language> in the MainSound reel and in the CPL additional subtitles languages */
+BOOST_AUTO_TEST_CASE (verify_invalid_sound_reel_and_additional_language)
{
- boost::filesystem::path const dir("build/test/verify_invalid_sound_reel_language");
+ boost::filesystem::path const dir("build/test/verify_invalid_sound_reel_and_additional_language");
prepare_directory (dir);
+ shared_ptr<dcp::MonoPictureAsset> picture = simple_picture (dir, "foo");
+ shared_ptr<dcp::ReelPictureAsset> reel_picture(new dcp::ReelMonoPictureAsset(picture, 0));
+ shared_ptr<dcp::Reel> reel(new dcp::Reel());
+ reel->add (reel_picture);
shared_ptr<dcp::SoundAsset> sound = simple_sound (dir, "foo", dcp::MXFMetadata(), "frobozz");
shared_ptr<dcp::ReelSoundAsset> reel_sound(new dcp::ReelSoundAsset(sound, 0));
- shared_ptr<dcp::Reel> reel(new dcp::Reel());
reel->add (reel_sound);
shared_ptr<dcp::CPL> cpl(new dcp::CPL("hello", dcp::FEATURE));
cpl->add (reel);
+ cpl->_additional_subtitle_languages.push_back("this-is-wrong");
+ cpl->_additional_subtitle_languages.push_back("andso-is-this");
+ cpl->set_main_sound_configuration ("L,C,R,Lfe,-,-");
+ cpl->set_main_sound_sample_rate (48000);
+ cpl->set_main_picture_stored_area (dcp::Size(1998, 1080));
+ cpl->set_main_picture_active_area (dcp::Size(1440, 1080));
shared_ptr<dcp::DCP> dcp(new dcp::DCP(dir));
dcp->add (cpl);
dcp->write_xml (dcp::SMPTE);
@@ -970,10 +979,19 @@ BOOST_AUTO_TEST_CASE (verify_invalid_sound_reel_language)
vector<boost::filesystem::path> dirs;
dirs.push_back (dir);
list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test);
- BOOST_REQUIRE_EQUAL (notes.size(), 1U);
+ BOOST_REQUIRE_EQUAL (notes.size(), 3U);
list<dcp::VerificationNote>::const_iterator i = notes.begin ();
BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::BAD_LANGUAGE);
BOOST_REQUIRE (i->note());
+ BOOST_CHECK_EQUAL (*i->note(), "this-is-wrong");
+ ++i;
+ BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::BAD_LANGUAGE);
+ BOOST_REQUIRE (i->note());
+ BOOST_CHECK_EQUAL (*i->note(), "andso-is-this");
+ ++i;
+ BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::BAD_LANGUAGE);
+ BOOST_REQUIRE (i->note());
BOOST_CHECK_EQUAL (*i->note(), "frobozz");
+ ++i;
}