diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-03-15 23:22:50 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-03-15 23:22:50 +0100 |
| commit | 3e3e8433842820ce6380e8f5c1917ae1a28e2e57 (patch) | |
| tree | 4b93fad5288eb161affe643b092cbb942ab2a43f /src | |
| parent | fbde12105a43cddb32ef2736cafd540cc5a70dda (diff) | |
Fix player stress testing with expanded controls.
Also correctly wait with a stress test until the DCP open
has completely finished.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 29 | ||||
| -rw-r--r-- | src/wx/playlist_controls.cc | 14 | ||||
| -rw-r--r-- | src/wx/playlist_controls.h | 5 |
3 files changed, 46 insertions, 2 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index cb81c5b89..bbbbe3a1d 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -199,6 +199,7 @@ public: , _view_dual_screen (0) #ifdef DCPOMATIC_PLAYER_STRESS_TEST , _timer (this) + , _stress_suspended (false) #endif { dcpomatic_log.reset (new NullLog()); @@ -319,6 +320,10 @@ public: void check_commands () { + if (_stress_suspended) { + return; + } + if (_current_command == _commands.end()) { _timer.Stop (); cout << "ST: finished.\n"; @@ -327,7 +332,6 @@ public: switch (_current_command->type) { case Command::OPEN: - cout << "ST: load " << _current_command->string_param << "\n"; load_dcp (_current_command->string_param); ++_current_command; break; @@ -504,8 +508,11 @@ public: reset_film (); try { + _stress_suspended = true; shared_ptr<DCPContent> dcp (new DCPContent(dir)); - _film->examine_and_add_content (dcp, true); + shared_ptr<Job> job (new ExamineContentJob(_film, dcp)); + _examine_job_connection = job->Finished.connect(bind(&DOMFrame::add_dcp_to_film, this, weak_ptr<Job>(job), weak_ptr<Content>(dcp))); + JobManager::instance()->add (job); bool const ok = display_progress (_("DCP-o-matic Player"), _("Loading content")); if (!ok || !report_errors_from_last_job(this)) { return; @@ -518,6 +525,22 @@ public: } } + void add_dcp_to_film (weak_ptr<Job> weak_job, weak_ptr<Content> weak_content) + { + shared_ptr<Job> job = weak_job.lock (); + if (!job || !job->finished_ok()) { + return; + } + + shared_ptr<Content> content = weak_content.lock (); + if (!content) { + return; + } + + _film->add_content (content); + _stress_suspended = false; + } + void reset_film_weak (weak_ptr<Film> weak_film) { shared_ptr<Film> film = weak_film.lock (); @@ -1131,6 +1154,7 @@ private: SystemInformationDialog* _system_information_dialog; boost::shared_ptr<Film> _film; boost::signals2::scoped_connection _config_changed_connection; + boost::signals2::scoped_connection _examine_job_connection; wxMenuItem* _file_add_ov; wxMenuItem* _file_add_kdm; wxMenuItem* _tools_verify; @@ -1142,6 +1166,7 @@ private: list<Command>::const_iterator _current_command; /** Remaining time that the script must wait, in milliseconds */ optional<int> _wait_remaining; + bool _stress_suspended; #endif }; diff --git a/src/wx/playlist_controls.cc b/src/wx/playlist_controls.cc index 844e15f04..edc4485e6 100644 --- a/src/wx/playlist_controls.cc +++ b/src/wx/playlist_controls.cc @@ -454,3 +454,17 @@ PlaylistControls::viewer_finished () _pause_button->Enable (false); } } + +#ifdef DCPOMATIC_PLAYER_STRESS_TEST +void +PlaylistControls::play () +{ + play_clicked (); +} + +void +PlaylistControls::stop () +{ + stop_clicked (); +} +#endif diff --git a/src/wx/playlist_controls.h b/src/wx/playlist_controls.h index dd6b77788..460924217 100644 --- a/src/wx/playlist_controls.h +++ b/src/wx/playlist_controls.h @@ -37,6 +37,11 @@ public: */ boost::signals2::signal<void (boost::weak_ptr<Film>)> ResetFilm; +#ifdef DCPOMATIC_PLAYER_STRESS_TEST + void play (); + void stop (); +#endif + private: void play_clicked (); void pause_clicked (); |
