From 9fed36f5ce0531ab7dc541829d959f4e040034f3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 16 Dec 2022 00:01:21 +0100 Subject: Throw exceptions when setting odd values for picture active area. --- src/cpl.cc | 16 ++++++++++++++++ src/cpl.h | 4 +--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/cpl.cc b/src/cpl.cc index ee1817fc..74f6f0bd 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -747,3 +747,19 @@ CPL::set_additional_subtitle_languages (vector const& langs) _additional_subtitle_languages.push_back (i.to_string()); } } + + +void +CPL::set_main_picture_active_area(dcp::Size area) +{ + if (area.width % 2) { + throw BadSettingError("Main picture active area width is not a multiple of 2"); + } + + if (area.height % 2) { + throw BadSettingError("Main picture active area height is not a multiple of 2"); + } + + _main_picture_active_area = area; +} + diff --git a/src/cpl.h b/src/cpl.h index c1489a2c..78e46c6a 100644 --- a/src/cpl.h +++ b/src/cpl.h @@ -307,9 +307,7 @@ public: return _main_picture_active_area; } - void set_main_picture_active_area (dcp::Size s) { - _main_picture_active_area = s; - } + void set_main_picture_active_area(dcp::Size area); std::vector additional_subtitle_languages () const { return _additional_subtitle_languages; -- cgit v1.2.3