summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-13 23:49:48 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commit9592b7f0e6cb6d9bc88afe11c64665c45b5bbeed (patch)
tree40d0886d22d3c25cbc987fd0cbe75fab0257ae40 /src
parentf423e80a1832644be0a4ccb5ea999be324cb344f (diff)
Bv2.1 7.2.1: Check total size of all timed text fonts is not larger than 10MB.
I'm not sure if this is what Bv2.1 means, but hopefully it's close enough.
Diffstat (limited to 'src')
-rw-r--r--src/verify.cc17
-rw-r--r--src/verify.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 3c36e8f6..428c737f 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -666,6 +666,21 @@ verify_subtitle_asset (
)
);
}
+ /* XXX: I'm not sure what Bv2.1_7.2.1 means when it says "the font resource shall not be larger than 10MB"
+ * but I'm hoping that checking for the total size of all fonts being <= 10MB will do.
+ */
+ map<string, ArrayData> fonts = asset->font_data ();
+ int total_size = 0;
+ for (map<string, ArrayData>::const_iterator i = fonts.begin(); i != fonts.end(); ++i) {
+ total_size += i->second.size();
+ }
+ if (total_size > 10 * 1024 * 1024) {
+ notes.push_back (
+ VerificationNote(
+ VerificationNote::VERIFY_BV21_ERROR, VerificationNote::TIMED_TEXT_FONTS_TOO_LARGE_IN_BYTES, *asset->file()
+ )
+ );
+ }
}
}
@@ -866,6 +881,8 @@ dcp::note_to_string (dcp::VerificationNote note)
return String::compose("The XML for the closed caption asset %1 is longer than the 256KB maximum required by Bv2.1", note.file()->filename());
case dcp::VerificationNote::TIMED_TEXT_ASSET_TOO_LARGE_IN_BYTES:
return String::compose("The total size of the timed text asset %1 is larger than the 115MB maximum required by Bv2.1", note.file()->filename());
+ case dcp::VerificationNote::TIMED_TEXT_FONTS_TOO_LARGE_IN_BYTES:
+ return String::compose("The total size of the fonts in timed text asset %1 is larger than the 10MB maximum required by Bv2.1", note.file()->filename());
}
return "";
diff --git a/src/verify.h b/src/verify.h
index 3b5dafac..c30718eb 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -106,6 +106,8 @@ public:
CLOSED_CAPTION_XML_TOO_LARGE_IN_BYTES,
/** Any timed text asset's total files is larger than 115MB [Bv2.1_7.2.1] */
TIMED_TEXT_ASSET_TOO_LARGE_IN_BYTES,
+ /** The total size of all a timed text asset's fonts is larger than 10MB [Bv2.1_7.2.1] */
+ TIMED_TEXT_FONTS_TOO_LARGE_IN_BYTES,
};
VerificationNote (Type type, Code code)