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/lib | |
| parent | de77e42f106342e1668e8948e28d6974ef44b61c (diff) | |
Change Film::add_content to take a vector of content.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 31 | ||||
| -rw-r--r-- | src/lib/film.h | 2 |
2 files changed, 17 insertions, 16 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>); |
