diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-07-15 03:36:59 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-07-15 18:03:57 +0200 |
| commit | 21415bdb69a99c4fc36cf4b5e5160a171bb1cad4 (patch) | |
| tree | 46265de6587585d292ac4c97267327af0c359c1c /src | |
| parent | 6207d271effad4e691a5155ccdad083e03b010bc (diff) | |
Change Film::examine_and_add_content to take a vector of content.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/create_cli.cc | 4 | ||||
| -rw-r--r-- | src/lib/film.cc | 19 | ||||
| -rw-r--r-- | src/lib/film.h | 2 | ||||
| -rw-r--r-- | src/tools/dcpomatic.cc | 6 | ||||
| -rw-r--r-- | src/wx/content_menu.cc | 2 | ||||
| -rw-r--r-- | src/wx/content_panel.cc | 9 |
6 files changed, 23 insertions, 19 deletions
diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index df040e134..af2e90745 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -514,9 +514,7 @@ CreateCLI::make_film(function<void (string)> error) const film_content_list = content_factory(can); } - for (auto film_content: film_content_list) { - film->examine_and_add_content(film_content); - } + film->examine_and_add_content(film_content_list); while (jm->work_to_do()) { dcpomatic_sleep_seconds(1); diff --git a/src/lib/film.cc b/src/lib/film.cc index 7401d1eac..a1ab3ccf3 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1423,16 +1423,25 @@ Film::content() const * @param disable_audio_analysis true to never do automatic audio analysis, even if it is enabled in configuration. */ void -Film::examine_and_add_content(shared_ptr<Content> content, bool disable_audio_analysis) +Film::examine_and_add_content(vector<shared_ptr<Content>> const& content, bool disable_audio_analysis) { - if (dynamic_pointer_cast<FFmpegContent>(content) && _directory) { - run_ffprobe(content->path(0), file("ffprobe.log")); + if (content.empty()) { + return; + } + + if (dynamic_pointer_cast<FFmpegContent>(content[0]) && _directory) { + run_ffprobe(content[0]->path(0), file("ffprobe.log")); } - auto j = make_shared<ExamineContentJob>(shared_from_this(), vector<shared_ptr<Content>>{content}, false); + auto j = make_shared<ExamineContentJob>(shared_from_this(), content, false); + + vector<weak_ptr<Content>> weak_content; + for (auto i: content) { + weak_content.push_back(i); + } _job_connections.push_back( - j->Finished.connect(bind(&Film::maybe_add_content, this, weak_ptr<Job>(j), vector<weak_ptr<Content>>{weak_ptr<Content>(content)}, disable_audio_analysis)) + j->Finished.connect(bind(&Film::maybe_add_content, this, weak_ptr<Job>(j), weak_content, disable_audio_analysis)) ); JobManager::instance()->add(j); diff --git a/src/lib/film.h b/src/lib/film.h index e1a8e88a3..c4c55a12a 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -378,7 +378,7 @@ public: void set_directory(boost::filesystem::path); 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 examine_and_add_content(std::vector<std::shared_ptr<Content>> const& content, bool disable_audio_analysis = false); void add_content(std::vector<std::shared_ptr<Content>> const& content); void remove_content(std::shared_ptr<Content>); void remove_content(ContentList); diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index e7011fba1..8f8cf3df0 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -1738,12 +1738,10 @@ private: if (!_film_to_create.empty ()) { _frame->new_film (_film_to_create, optional<string>()); if (!_content_to_add.empty()) { - for (auto i: content_factory(_content_to_add)) { - _frame->film()->examine_and_add_content(i); - } + _frame->film()->examine_and_add_content(content_factory(_content_to_add)); } if (!_dcp_to_add.empty ()) { - _frame->film()->examine_and_add_content(make_shared<DCPContent>(_dcp_to_add)); + _frame->film()->examine_and_add_content({make_shared<DCPContent>(_dcp_to_add)}); } } diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index 75326158d..32c5edb01 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -288,7 +288,7 @@ ContentMenu::join () try { auto joined = make_shared<FFmpegContent>(fc); film->remove_content (_content); - film->examine_and_add_content (joined); + film->examine_and_add_content({joined}); } catch (JoinError& e) { error_dialog (_parent, std_to_wx (e.what ())); } diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 06a257dbb..5803c3257 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -665,8 +665,9 @@ ContentPanel::add_folder(boost::filesystem::path folder) ic->set_video_frame_rate(_film, dialog.frame_rate()); } - _film->examine_and_add_content(i); } + + _film->examine_and_add_content(content); } @@ -684,7 +685,7 @@ void ContentPanel::add_dcp(boost::filesystem::path dcp) { try { - _film->examine_and_add_content(make_shared<DCPContent>(dcp)); + _film->examine_and_add_content({make_shared<DCPContent>(dcp)}); } catch (ProjectFolderError &) { error_dialog( _parent, @@ -963,9 +964,7 @@ ContentPanel::add_files(vector<boost::filesystem::path> paths) try { for (auto i: paths) { - for (auto j: content_factory(i)) { - _film->examine_and_add_content(j); - } + _film->examine_and_add_content(content_factory(i)); } } catch (exception& e) { error_dialog(_parent, std_to_wx(e.what())); |
