diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-11-29 21:04:45 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-11-30 22:18:51 +0100 |
| commit | 5db5da477ce02166481d79df322bbfb7abc8f24c (patch) | |
| tree | f2858f605a05d87a0e4a2e4bea77d6d66d6d4f7f /src | |
| parent | 052abf06a9fed23f61eaa934ac0e8662bbe142ce (diff) | |
Fix mis-handling of reels with Atmos content (#2901).v2.17.26
We must have reel boundaries at least on Atmos content boundaries as I
don't know for sure how to insert silence into an Atmos stream.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/film.cc | 45 | ||||
| -rw-r--r-- | src/lib/film.h | 1 |
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; |
