summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc45
-rw-r--r--src/lib/film.h1
2 files changed, 46 insertions, 0 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 5b845d8b4..a4734d4c3 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -1610,6 +1610,51 @@ Film::playlist_change (ChangeType type)
set_dirty (true);
}
+
+void
+Film::check_reel_boundaries_for_atmos()
+{
+ /* Find Atmos boundaries */
+ std::set<dcpomatic::DCPTime> atmos_boundaries;
+ for (auto i: content()) {
+ if (i->atmos) {
+ atmos_boundaries.insert(i->position());
+ atmos_boundaries.insert(i->end(shared_from_this()));
+ }
+ }
+
+ /* Find reel boundaries */
+ vector<dcpomatic::DCPTime> reel_boundaries;
+ bool first = true;
+ for (auto period: reels()) {
+ if (first) {
+ reel_boundaries.push_back(period.from);
+ first = false;
+ }
+ reel_boundaries.push_back(period.to);
+ }
+
+ /* There must be a reel boundary at all the Atmos boundaries */
+ auto remake_boundaries = std::any_of(atmos_boundaries.begin(), atmos_boundaries.end(), [&reel_boundaries](dcpomatic::DCPTime time) {
+ return std::find(reel_boundaries.begin(), reel_boundaries.end(), time) == reel_boundaries.end();
+ });
+
+ if (remake_boundaries) {
+ vector<dcpomatic::DCPTime> required_boundaries;
+ std::copy_if(atmos_boundaries.begin(), atmos_boundaries.end(), std::back_inserter(required_boundaries), [this](dcpomatic::DCPTime time) {
+ return time.get() != 0 && time != length();
+ });
+ if (!required_boundaries.empty()) {
+ set_reel_type(ReelType::CUSTOM);
+ set_custom_reel_boundaries(required_boundaries);
+ } else {
+ set_reel_type(ReelType::SINGLE);
+ }
+ Message(variant::insert_dcpomatic("%1 had to change your reel settings to accomodate the Atmos content"));
+ }
+}
+
+
/** Check for (and if necessary fix) impossible settings combinations, like
* video set to being referenced when it can't be.
*/
diff --git a/src/lib/film.h b/src/lib/film.h
index 815c6ae74..8718e8f7d 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -502,6 +502,7 @@ private:
void maybe_set_container_and_resolution ();
void set_dirty (bool dirty);
void write_ui_state() const;
+ void check_reel_boundaries_for_atmos();
/** Log to write to */
std::shared_ptr<Log> _log;