summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-13 22:23:07 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commit9a5db0824d48bac475abbb9ff4dc1c7b5f28edab (patch)
treee00a3fa53ca24532ecd28b04b3bc965da3370505 /src
parent588463ca317c588f0dfca046cc52dfe026654527 (diff)
Bv2.1 7.2.1: Check size of closed caption XML is not larger than 256KB.
Diffstat (limited to 'src')
-rw-r--r--src/verify.cc25
-rw-r--r--src/verify.h2
2 files changed, 25 insertions, 2 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 78c087da..9cfcd4b9 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -663,6 +663,26 @@ verify_subtitle_asset (
}
+static void
+verify_closed_caption_asset (
+ shared_ptr<const SubtitleAsset> asset,
+ function<void (string, optional<boost::filesystem::path>)> stage,
+ boost::filesystem::path xsd_dtd_directory,
+ list<VerificationNote>& notes
+ )
+{
+ verify_subtitle_asset (asset, stage, xsd_dtd_directory, notes);
+
+ if (asset->raw_xml().size() > 256 * 1024) {
+ notes.push_back (
+ VerificationNote(
+ VerificationNote::VERIFY_BV21_ERROR, VerificationNote::CLOSED_CAPTION_XML_TOO_LARGE_IN_BYTES, *asset->file()
+ )
+ );
+ }
+}
+
+
list<VerificationNote>
dcp::verify (
vector<boost::filesystem::path> directories,
@@ -763,7 +783,7 @@ dcp::verify (
BOOST_FOREACH (shared_ptr<dcp::ReelClosedCaptionAsset> i, reel->closed_captions()) {
verify_closed_caption_reel (i, notes);
if (i->asset_ref().resolved()) {
- verify_subtitle_asset (i->asset(), stage, xsd_dtd_directory, notes);
+ verify_closed_caption_asset (i->asset(), stage, xsd_dtd_directory, notes);
}
}
}
@@ -835,7 +855,8 @@ dcp::note_to_string (dcp::VerificationNote note)
return String::compose("A picture asset's frame rate (%1) is not 24fps as required for 4K DCPs by Bv2.1", note.note().get());
case dcp::VerificationNote::PICTURE_ASSET_4K_3D:
return "3D 4K DCPs are not allowed by Bv2.1";
-
+ case dcp::VerificationNote::CLOSED_CAPTION_XML_TOO_LARGE_IN_BYTES:
+ return String::compose("The XML for the closed caption asset %1 is longer than the 256KB maximum required by Bv2.1", note.file()->filename());
}
return "";
diff --git a/src/verify.h b/src/verify.h
index 500918de..24c19b2b 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -102,6 +102,8 @@ public:
PICTURE_ASSET_INVALID_FRAME_RATE_FOR_4K,
/** A picture asset is 4K but is 3D which is not allowed by Bv2.1 [Bv2.1_7.1] */
PICTURE_ASSET_4K_3D,
+ /** A closed caption's XML file is larger than 256KB [Bv2.1_7.2.1] */
+ CLOSED_CAPTION_XML_TOO_LARGE_IN_BYTES,
};
VerificationNote (Type type, Code code)