summaryrefslogtreecommitdiff
path: root/src/verify.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-12-16 00:01:47 +0100
committerCarl Hetherington <cth@carlh.net>2022-12-16 10:30:26 +0100
commit70f08257122cabe3b25481e27efedfd4b79903a3 (patch)
tree8d0ca1d4a587fc2e29d24890d4b9009e4f1a4fa7 /src/verify.cc
parent9fed36f5ce0531ab7dc541829d959f4e040034f3 (diff)
Verify that main picture active area is valid (even, and not too big) (#2392).v1.8.40
Diffstat (limited to 'src/verify.cc')
-rw-r--r--src/verify.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/verify.cc b/src/verify.cc
index d4d63902..197e5183 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -1389,6 +1389,24 @@ dcp::verify (
size_t most_closed_captions = 0;
map<Marker, Time> markers_seen;
+ auto const main_picture_active_area = cpl->main_picture_active_area();
+ if (main_picture_active_area && (main_picture_active_area->width % 2)) {
+ notes.push_back({
+ VerificationNote::Type::ERROR,
+ VerificationNote::Code::INVALID_MAIN_PICTURE_ACTIVE_AREA,
+ String::compose("width %1 is not a multiple of 2", main_picture_active_area->width),
+ cpl->file().get()
+ });
+ }
+ if (main_picture_active_area && (main_picture_active_area->height % 2)) {
+ notes.push_back({
+ VerificationNote::Type::ERROR,
+ VerificationNote::Code::INVALID_MAIN_PICTURE_ACTIVE_AREA,
+ String::compose("height %1 is not a multiple of 2", main_picture_active_area->height),
+ cpl->file().get()
+ });
+ }
+
for (auto reel: cpl->reels()) {
stage ("Checking reel", optional<boost::filesystem::path>());
@@ -1437,6 +1455,25 @@ dcp::verify (
/* Check asset */
if (reel->main_picture()->asset_ref().resolved()) {
verify_main_picture_asset (dcp, reel->main_picture(), stage, progress, notes);
+ auto const asset_size = reel->main_picture()->asset()->size();
+ if (main_picture_active_area) {
+ if (main_picture_active_area->width > asset_size.width) {
+ notes.push_back({
+ VerificationNote::Type::ERROR,
+ VerificationNote::Code::INVALID_MAIN_PICTURE_ACTIVE_AREA,
+ String::compose("width %1 is bigger than the asset width %2", main_picture_active_area->width, asset_size.width),
+ cpl->file().get()
+ });
+ }
+ if (main_picture_active_area->height > asset_size.height) {
+ notes.push_back({
+ VerificationNote::Type::ERROR,
+ VerificationNote::Code::INVALID_MAIN_PICTURE_ACTIVE_AREA,
+ String::compose("height %1 is bigger than the asset height %2", main_picture_active_area->height, asset_size.height),
+ cpl->file().get()
+ });
+ }
+ }
}
}
@@ -1785,6 +1822,8 @@ dcp::note_to_string (VerificationNote note)
return "There is an <Duration> node inside a <MainMarkers>.";
case VerificationNote::Code::INVALID_CONTENT_KIND:
return String::compose("<ContentKind> has an invalid value %1.", note.note().get());
+ case VerificationNote::Code::INVALID_MAIN_PICTURE_ACTIVE_AREA:
+ return String::compose("<MainPictureActiveaArea> has an invalid value: %1", note.note().get());
}
return "";