Tidy-up/fix Atmos frame rate checks.
authorCarl Hetherington <cth@carlh.net>
Fri, 29 Nov 2024 22:18:48 +0000 (23:18 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 29 Nov 2024 22:33:52 +0000 (23:33 +0100)
src/lib/film.cc

index b624b234b4ca3cb428ff47d881f38b2ada750953..5b845d8b497be982e71de4359b6aaa3d505906d6 100644 (file)
@@ -1616,21 +1616,24 @@ Film::playlist_change (ChangeType type)
 void
 Film::check_settings_consistency ()
 {
-       optional<int> atmos_rate;
+       std::set<int> atmos_rates;
        for (auto i: content()) {
-
                if (i->atmos) {
-                       int rate = lrintf (i->atmos->edit_rate().as_float());
-                       if (atmos_rate && *atmos_rate != rate) {
-                               Message (_("You have more than one piece of Atmos content, and they do not have the same frame rate.  You must remove some Atmos content."));
-                       } else if (!atmos_rate && rate != video_frame_rate()) {
-                               atmos_rate = rate;
-                               set_video_frame_rate (rate, false);
-                               Message(variant::insert_dcpomatic(_("%1 had to change your settings so that the film's frame rate is the same as that of your Atmos content.")));
-                       }
+                       atmos_rates.insert(lrintf(i->atmos->edit_rate().as_float()));
                }
        }
 
+       if (atmos_rates.size() > 1) {
+               Message(_("You have more than one piece of Atmos content, and they do not have the same frame rate.  You must remove some Atmos content."));
+       } else if (atmos_rates.size() == 1 && *atmos_rates.begin() != video_frame_rate()) {
+               set_video_frame_rate(*atmos_rates.begin(), false);
+               Message(variant::insert_dcpomatic(_("%1 had to change your settings so that the film's frame rate is the same as that of your Atmos content.")));
+       }
+
+       if (!atmos_rates.empty()) {
+               check_reel_boundaries_for_atmos();
+       }
+
        bool change_made = false;
        for (auto i: content()) {
                auto d = dynamic_pointer_cast<DCPContent>(i);