Throw exceptions when setting odd values for picture active area.
authorCarl Hetherington <cth@carlh.net>
Thu, 15 Dec 2022 23:01:21 +0000 (00:01 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 15 Dec 2022 23:01:21 +0000 (00:01 +0100)
src/cpl.cc
src/cpl.h

index ee1817fc57571025f8692a5b25fc0bc2a8644bc7..74f6f0bd0abed9e8d75355a30c378e2c18d7400c 100644 (file)
@@ -747,3 +747,19 @@ CPL::set_additional_subtitle_languages (vector<dcp::LanguageTag> 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;
+}
+
index c1489a2c0e8efbffa58f31e020205b63bef607a2..78e46c6aac7facdb0e2a57fd82187b93dbb5e2d5 100644 (file)
--- 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<std::string> additional_subtitle_languages () const {
                return _additional_subtitle_languages;