diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-12-16 00:01:47 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-12-16 10:30:26 +0100 |
| commit | 70f08257122cabe3b25481e27efedfd4b79903a3 (patch) | |
| tree | 8d0ca1d4a587fc2e29d24890d4b9009e4f1a4fa7 /src | |
| parent | 9fed36f5ce0531ab7dc541829d959f4e040034f3 (diff) | |
Verify that main picture active area is valid (even, and not too big) (#2392).v1.8.40
Diffstat (limited to 'src')
| -rw-r--r-- | src/verify.cc | 39 | ||||
| -rw-r--r-- | src/verify.h | 7 |
2 files changed, 45 insertions, 1 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 ""; diff --git a/src/verify.h b/src/verify.h index baa36138..c7c4b6c8 100644 --- a/src/verify.h +++ b/src/verify.h @@ -398,7 +398,12 @@ public: /** Some <MainMarkers> asset has an <Duration> that should not be there */ UNEXPECTED_DURATION, /** A <ContentKind> has been specified with either no scope or the SMPTE 429-7 scope, but which is not one of those allowed */ - INVALID_CONTENT_KIND + INVALID_CONTENT_KIND, + /** Either the width or height of a <MainPictureActiveArea> in a CPL is either not an even number, or bigger than the corresponding asset dimension. + * note contains details of what is wrong + * file contains the CPL filename + */ + INVALID_MAIN_PICTURE_ACTIVE_AREA, }; VerificationNote (Type type, Code code) |
