From 9592b7f0e6cb6d9bc88afe11c64665c45b5bbeed Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 13 Dec 2020 23:49:48 +0100 Subject: 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. --- src/verify.cc | 17 +++++++++++++++++ src/verify.h | 2 ++ 2 files changed, 19 insertions(+) (limited to 'src') 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 fonts = asset->font_data (); + int total_size = 0; + for (map::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) -- cgit v1.2.3