summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-09 01:08:14 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commit2c3f7f03e50c6bb618b3f1b321b4ed27788152f9 (patch)
tree2a706a106d16277c7e597921c165812c643a2e27 /src
parent730952e63932bd50310cb20c61e78ae0c215e14b (diff)
Bv2.1 6.2.1: Check that subtitle reel <Language> conforms to RFC 5646.
Diffstat (limited to 'src')
-rw-r--r--src/reel_subtitle_asset.h4
-rw-r--r--src/verify.cc30
-rw-r--r--src/verify.h2
3 files changed, 34 insertions, 2 deletions
diff --git a/src/reel_subtitle_asset.h b/src/reel_subtitle_asset.h
index 13e72133..8c3b7d18 100644
--- a/src/reel_subtitle_asset.h
+++ b/src/reel_subtitle_asset.h
@@ -43,6 +43,8 @@
#include "reel_mxf.h"
#include "subtitle_asset.h"
+struct verify_test26;
+
namespace dcp {
class SubtitleAsset;
@@ -70,6 +72,8 @@ public:
}
private:
+ friend struct ::verify_test26;
+
std::string key_type () const;
std::string cpl_node_name (Standard standard) const;
diff --git a/src/verify.cc b/src/verify.cc
index f3ecb1f4..b4408946 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -394,6 +394,17 @@ verify_asset (shared_ptr<const DCP> dcp, shared_ptr<const ReelMXF> reel_mxf, fun
}
+void
+verify_language_tag (string tag, list<VerificationNote>& notes)
+{
+ try {
+ dcp::LanguageTag test (tag);
+ } catch (dcp::LanguageTagError &) {
+ notes.push_back (VerificationNote(VerificationNote::VERIFY_BV21_ERROR, VerificationNote::BAD_LANGUAGE, tag));
+ }
+}
+
+
enum VerifyPictureAssetResult
{
VERIFY_PICTURE_ASSET_RESULT_GOOD,
@@ -544,6 +555,16 @@ verify_main_sound_asset (
static void
+verify_main_subtitle_reel (shared_ptr<const ReelSubtitleAsset> reel_asset, list<VerificationNote>& notes)
+{
+ /* XXX: is Language compulsory? */
+ if (reel_asset->language()) {
+ verify_language_tag (*reel_asset->language(), notes);
+ }
+}
+
+
+static void
verify_main_subtitle_asset (
shared_ptr<const Reel> reel,
function<void (string, optional<boost::filesystem::path>)> stage,
@@ -642,8 +663,11 @@ dcp::verify (
verify_main_sound_asset (dcp, reel, stage, progress, notes);
}
- if (reel->main_subtitle() && reel->main_subtitle()->asset_ref().resolved()) {
- verify_main_subtitle_asset (reel, stage, xsd_dtd_directory, notes);
+ if (reel->main_subtitle()) {
+ verify_main_subtitle_reel (reel->main_subtitle(), notes);
+ if (reel->main_subtitle()->asset_ref().resolved()) {
+ verify_main_subtitle_asset (reel, stage, xsd_dtd_directory, notes);
+ }
}
}
}
@@ -704,6 +728,8 @@ dcp::note_to_string (dcp::VerificationNote note)
return String::compose("An asset that this DCP refers to is not included in the DCP. It may be a VF. Missing asset is %1.", note.note().get());
case dcp::VerificationNote::NOT_SMPTE:
return "This DCP does not use the SMPTE standard, which is required for Bv2.1 compliance.";
+ case dcp::VerificationNote::BAD_LANGUAGE:
+ return String::compose("The DCP specifies a language '%1' which does not conform to the RFC 5646 standard.", note.note().get());
}
return "";
diff --git a/src/verify.h b/src/verify.h
index 0140066e..8eb5aa12 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -92,6 +92,8 @@ public:
EXTERNAL_ASSET,
/** DCP is Interop, not SMPTE [Bv2.1_6.1] */
NOT_SMPTE,
+ /** A language or territory does not conform to RFC 5646 [Bv2.1_6.2.1] */
+ BAD_LANGUAGE,
};
VerificationNote (Type type, Code code)