diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-07-15 02:47:35 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-07-15 18:03:57 +0200 |
| commit | 0cfe03ee13d7659901211345e30ed78fe55e21ea (patch) | |
| tree | 213890d76954c3a51fecb731d35eccbf8906ba07 /src | |
| parent | de77e42f106342e1668e8948e28d6974ef44b61c (diff) | |
Change Film::add_content to take a vector of content.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/film.cc | 31 | ||||
| -rw-r--r-- | src/lib/film.h | 2 | ||||
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 2 | ||||
| -rw-r--r-- | src/wx/playlist_controls.cc | 3 |
4 files changed, 20 insertions, 18 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index ddb469f3a..4fb5f5f84 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1451,7 +1451,7 @@ Film::maybe_add_content(weak_ptr<Job> j, weak_ptr<Content> c, bool disable_audio return; } - add_content(content); + add_content(vector<shared_ptr<Content>>{content}); if (Config::instance()->automatic_audio_analysis() && content->audio && !disable_audio_analysis) { auto playlist = make_shared<Playlist>(); @@ -1465,26 +1465,27 @@ Film::maybe_add_content(weak_ptr<Job> j, weak_ptr<Content> c, bool disable_audio } void -Film::add_content(shared_ptr<Content> c) +Film::add_content(vector<shared_ptr<Content>> const& content) { - /* Add {video,subtitle} content after any existing {video,subtitle} content */ - if (c->video) { - c->set_position(shared_from_this(), _playlist->video_end(shared_from_this())); - } else if (!c->text.empty()) { - c->set_position(shared_from_this(), _playlist->text_end(shared_from_this())); - } + bool any_atmos = false; - if (_template_film) { - /* Take settings from the first piece of content of c's type in _template */ - for (auto i: _template_film->content()) { - c->take_settings_from(i); + for (auto c: content) { + if (_template_film) { + /* Take settings from the first piece of content of c's type in _template */ + for (auto i: _template_film->content()) { + c->take_settings_from(i); + } } - } - _playlist->add(shared_from_this(), c); + if (c->atmos) { + any_atmos = true; + } + } + _playlist->add_at_end(shared_from_this(), content); maybe_set_container_and_resolution(); - if (c->atmos) { + + if (any_atmos) { if (_audio_channels < 14) { set_audio_channels(14); } diff --git a/src/lib/film.h b/src/lib/film.h index b14f182ce..a938d0dbd 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -379,7 +379,7 @@ public: void set_name(std::string); void set_use_isdcf_name(bool); void examine_and_add_content(std::shared_ptr<Content> content, bool disable_audio_analysis = false); - void add_content(std::shared_ptr<Content>); + void add_content(std::vector<std::shared_ptr<Content>> const& content); void remove_content(std::shared_ptr<Content>); void remove_content(ContentList); void move_content_earlier(std::shared_ptr<Content>); diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 86467f0f7..2bf560811 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -432,7 +432,7 @@ public: return; } - film->add_content(content); + film->add_content({content}); _stress.set_suspended(false); reset_film(film); }; diff --git a/src/wx/playlist_controls.cc b/src/wx/playlist_controls.cc index bde065659..ef9dd2213 100644 --- a/src/wx/playlist_controls.cc +++ b/src/wx/playlist_controls.cc @@ -48,6 +48,7 @@ using std::exception; using std::shared_ptr; using std::sort; using std::string; +using std::vector; using boost::optional; using namespace dcpomatic; @@ -381,7 +382,7 @@ PlaylistControls::reset_film () DCPOMATIC_ASSERT (_selected_playlist); auto film = std::make_shared<Film>(optional<boost::filesystem::path>()); auto entry = _playlists[*_selected_playlist].get(_selected_playlist_position); - film->add_content(entry.content); + film->add_content(vector<shared_ptr<Content>>{entry.content}); ResetFilm(film, entry.crop_to_ratio); } |
