From 052abf06a9fed23f61eaa934ac0e8662bbe142ce Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 29 Nov 2024 23:18:48 +0100 Subject: Tidy-up/fix Atmos frame rate checks. --- src/lib/film.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/lib/film.cc b/src/lib/film.cc index b624b234b..5b845d8b4 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1616,21 +1616,24 @@ Film::playlist_change (ChangeType type) void Film::check_settings_consistency () { - optional atmos_rate; + std::set 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(i); -- cgit v1.2.3