From cfbe9d2f44e380efed7a61b5b5c7a2fec7794915 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 11 Nov 2021 22:49:34 +0100 Subject: [PATCH] Remove player activity logging. Fixes #2122. If I remember right this was for swaroop and I suspect nobody else is really interested. --- src/lib/config.cc | 10 -------- src/lib/config.h | 20 --------------- src/tools/dcpomatic_player.cc | 47 ---------------------------------- src/wx/controls.cc | 26 ++++++++----------- src/wx/controls.h | 1 - src/wx/film_viewer.cc | 4 +-- src/wx/film_viewer.h | 4 +-- src/wx/player_config_dialog.cc | 15 ----------- src/wx/playlist_controls.cc | 24 ----------------- src/wx/playlist_controls.h | 1 - 10 files changed, 14 insertions(+), 138 deletions(-) diff --git a/src/lib/config.cc b/src/lib/config.cc index bfde74a75..419436995 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -168,7 +168,6 @@ Config::set_defaults () _image_display = 0; _video_view_type = VIDEO_VIEW_SIMPLE; _respect_kdm_validity_periods = true; - _player_activity_log_file = boost::none; _player_debug_log_file = boost::none; _player_content_directory = boost::none; _player_playlist_directory = boost::none; @@ -535,11 +534,6 @@ try _video_view_type = VIDEO_VIEW_SIMPLE; } _respect_kdm_validity_periods = f.optional_bool_child("RespectKDMValidityPeriods").get_value_or(true); - /* PlayerLogFile is old name */ - _player_activity_log_file = f.optional_string_child("PlayerLogFile"); - if (!_player_activity_log_file) { - _player_activity_log_file = f.optional_string_child("PlayerActivityLogFile"); - } _player_debug_log_file = f.optional_string_child("PlayerDebugLogFile"); _player_content_directory = f.optional_string_child("PlayerContentDirectory"); _player_playlist_directory = f.optional_string_child("PlayerPlaylistDirectory"); @@ -962,10 +956,6 @@ Config::write_config () const } /* [XML] RespectKDMValidityPeriods 1 to refuse to use KDMs that are out of date, 0 to ignore KDM dates. */ root->add_child("RespectKDMValidityPeriods")->add_child_text(_respect_kdm_validity_periods ? "1" : "0"); - if (_player_activity_log_file) { - /* [XML] PlayerLogFile Filename to use for player activity logs (e.g starting, stopping, playlist loads) */ - root->add_child("PlayerActivityLogFile")->add_child_text(_player_activity_log_file->string()); - } if (_player_debug_log_file) { /* [XML] PlayerLogFile Filename to use for player debug logs. */ root->add_child("PlayerDebugLogFile")->add_child_text(_player_debug_log_file->string()); diff --git a/src/lib/config.h b/src/lib/config.h index c9206b139..19e05608c 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -517,10 +517,6 @@ public: return _respect_kdm_validity_periods; } - boost::optional player_activity_log_file () const { - return _player_activity_log_file; - } - boost::optional player_debug_log_file () const { return _player_debug_log_file; } @@ -993,18 +989,6 @@ public: maybe_set (_respect_kdm_validity_periods, r); } - void set_player_activity_log_file (boost::filesystem::path p) { - maybe_set (_player_activity_log_file, p); - } - - void unset_player_activity_log_file () { - if (!_player_activity_log_file) { - return; - } - _player_activity_log_file = boost::none; - changed (); - } - void set_player_debug_log_file (boost::filesystem::path p) { maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG); } @@ -1263,10 +1247,6 @@ private: int _image_display; VideoViewType _video_view_type; bool _respect_kdm_validity_periods; - /** Log file containing things the player does (e.g. started, stopped, loaded - playlist etc.) Does not contain debugging information. - */ - boost::optional _player_activity_log_file; /** Log file containing debug information for the player */ boost::optional _player_debug_log_file; /** A directory containing DCPs whose contents are presented to the user diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index e409b9731..8c9f016d4 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -199,8 +199,6 @@ public: _viewer->set_dcp_decode_reduction (Config::instance()->decode_reduction ()); _viewer->set_optimise_for_j2k (true); _viewer->PlaybackPermitted.connect (bind(&DOMFrame::playback_permitted, this)); - _viewer->Started.connect (bind(&DOMFrame::playback_started, this, _1)); - _viewer->Stopped.connect (bind(&DOMFrame::playback_stopped, this, _1)); _viewer->TooManyDropped.connect (bind(&DOMFrame::too_many_frames_dropped, this)); _info = new PlayerInformation (_overall_panel, _viewer); setup_main_sizer (Config::instance()->player_mode()); @@ -294,51 +292,6 @@ public: return ok; } - void playback_started (DCPTime time) - { - /* XXX: this only logs the first piece of content; probably should be each piece? */ - if (_film->content().empty()) { - return; - } - - auto dcp = dynamic_pointer_cast(_film->content().front()); - if (dcp) { - DCPExaminer ex (dcp, true); - shared_ptr playing_cpl; - for (auto i: ex.cpls()) { - if (!dcp->cpl() || i->id() == *dcp->cpl()) { - playing_cpl = i; - } - } - DCPOMATIC_ASSERT (playing_cpl); - - _controls->log ( - wxString::Format( - "playback-started %s %s %s", - time.timecode(_film->video_frame_rate()).c_str(), - dcp->directories().front().string().c_str(), - playing_cpl->annotation_text().get_value_or("").c_str() - ) - ); - } - - auto ffmpeg = dynamic_pointer_cast(_film->content().front()); - if (ffmpeg) { - _controls->log ( - wxString::Format( - "playback-started %s %s", - time.timecode(_film->video_frame_rate()).c_str(), - ffmpeg->path(0).string().c_str() - ) - ); - } - } - - void playback_stopped (DCPTime time) - { - _controls->log (wxString::Format("playback-stopped %s", time.timecode(_film->video_frame_rate()).c_str())); - } - void too_many_frames_dropped () { diff --git a/src/wx/controls.cc b/src/wx/controls.cc index 29f4aeaa3..a90ac79b4 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -19,22 +19,22 @@ */ +#include "check_box.h" +#include "content_view.h" #include "controls.h" +#include "dcpomatic_button.h" #include "film_viewer.h" -#include "wx_util.h" -#include "playhead_to_timecode_dialog.h" #include "playhead_to_frame_dialog.h" -#include "content_view.h" +#include "playhead_to_timecode_dialog.h" #include "static_text.h" -#include "check_box.h" -#include "dcpomatic_button.h" -#include "lib/job_manager.h" -#include "lib/player_video.h" -#include "lib/dcp_content.h" -#include "lib/job.h" -#include "lib/examine_content_job.h" +#include "wx_util.h" #include "lib/content_factory.h" #include "lib/cross.h" +#include "lib/dcp_content.h" +#include "lib/examine_content_job.h" +#include "lib/job.h" +#include "lib/job_manager.h" +#include "lib/player_video.h" #include #include #include @@ -249,12 +249,6 @@ Controls::slider_moved (bool page) } viewer->seek (t, accurate); update_position_label (); - - log ( - wxString::Format( - "playback-seeked %s", t.timecode(_film->video_frame_rate()).c_str() - ) - ); } diff --git a/src/wx/controls.h b/src/wx/controls.h index 377960425..ca9c20087 100644 --- a/src/wx/controls.h +++ b/src/wx/controls.h @@ -57,7 +57,6 @@ public: bool editor_controls = true ); - virtual void log (wxString) {} virtual void set_film (std::shared_ptr film); virtual void play () {}; diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index e678c6aa3..2c90b8609 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -371,7 +371,7 @@ FilmViewer::start () /* Calling start() below may directly result in Stopped being emitted, and if that * happens we want it to come after the Started signal, so do that first. */ - Started (position()); + Started (); _video_view->start (); } @@ -390,7 +390,7 @@ FilmViewer::stop () _playing = false; _video_view->stop (); - Stopped (position()); + Stopped (); _video_view->rethrow (); return true; diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 5e5bb7916..0291b660f 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -139,8 +139,8 @@ public: } boost::signals2::signal)> ImageChanged; - boost::signals2::signal Started; - boost::signals2::signal Stopped; + boost::signals2::signal Started; + boost::signals2::signal Stopped; /** While playing back we reached the end of the film (emitted from GUI thread) */ boost::signals2::signal Finished; /** Emitted from the GUI thread when a lot of frames are being dropped */ diff --git a/src/wx/player_config_dialog.cc b/src/wx/player_config_dialog.cc index 802ab6b3b..91434beae 100644 --- a/src/wx/player_config_dialog.cc +++ b/src/wx/player_config_dialog.cc @@ -120,11 +120,6 @@ private: table->Add (_respect_kdm, wxGBPosition(r, 0), wxGBSpan(1, 2)); ++r; - add_label_to_sizer (table, _panel, _("Activity log file"), true, wxGBPosition (r, 0)); - _activity_log_file = new FilePickerCtrl (_panel, _("Select activity log file"), "*", false, true); - table->Add (_activity_log_file, wxGBPosition(r, 1)); - ++r; - add_label_to_sizer (table, _panel, _("Debug log file"), true, wxGBPosition (r, 0)); _debug_log_file = new FilePickerCtrl (_panel, _("Select debug log file"), "*", false, true); table->Add (_debug_log_file, wxGBPosition(r, 1)); @@ -134,7 +129,6 @@ private: _image_display->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::image_display_changed, this)); _video_display_mode->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::video_display_mode_changed, this)); _respect_kdm->Bind (wxEVT_CHECKBOX, bind(&PlayerGeneralPage::respect_kdm_changed, this)); - _activity_log_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::activity_log_file_changed, this)); _debug_log_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::debug_log_file_changed, this)); } @@ -167,9 +161,6 @@ private: checked_set (_image_display, config->image_display()); checked_set (_respect_kdm, config->respect_kdm_validity_periods()); - if (config->player_activity_log_file()) { - checked_set (_activity_log_file, *config->player_activity_log_file()); - } if (config->player_debug_log_file()) { checked_set (_debug_log_file, *config->player_debug_log_file()); } @@ -210,11 +201,6 @@ private: Config::instance()->set_respect_kdm_validity_periods(_respect_kdm->GetValue()); } - void activity_log_file_changed () - { - Config::instance()->set_player_activity_log_file(wx_to_std(_activity_log_file->GetPath())); - } - void debug_log_file_changed () { Config::instance()->set_player_debug_log_file(wx_to_std(_debug_log_file->GetPath())); @@ -224,7 +210,6 @@ private: wxChoice* _image_display; wxChoice* _video_display_mode; wxCheckBox* _respect_kdm; - FilePickerCtrl* _activity_log_file; FilePickerCtrl* _debug_log_file; }; diff --git a/src/wx/playlist_controls.cc b/src/wx/playlist_controls.cc index 129e0ceca..3be47ad97 100644 --- a/src/wx/playlist_controls.cc +++ b/src/wx/playlist_controls.cc @@ -232,28 +232,6 @@ PlaylistControls::next_clicked () update_current_content (); } -void -PlaylistControls::log (wxString s) -{ - optional log = Config::instance()->player_activity_log_file(); - if (!log) { - return; - } - - struct timeval time; - gettimeofday (&time, 0); - char buffer[64]; - time_t const sec = time.tv_sec; - struct tm* t = localtime (&sec); - strftime (buffer, 64, "%c", t); - wxString ts = std_to_wx(string(buffer)) + N_(": "); - FILE* f = fopen_boost (*log, "a"); - if (!f) { - return; - } - fprintf (f, "%s%s\n", wx_to_std(ts).c_str(), wx_to_std(s).c_str()); - fclose (f); -} void PlaylistControls::add_playlist_to_list (SPL spl) @@ -361,8 +339,6 @@ PlaylistControls::spl_selection_changed () void PlaylistControls::select_playlist (int selected, int position) { - log (wxString::Format("load-playlist %s", std_to_wx(_playlists[selected].name()).data())); - wxProgressDialog dialog (_("DCP-o-matic"), "Loading playlist and KDMs"); for (auto const& i: _playlists[selected].get()) { diff --git a/src/wx/playlist_controls.h b/src/wx/playlist_controls.h index b0d04f4cb..8375f952e 100644 --- a/src/wx/playlist_controls.h +++ b/src/wx/playlist_controls.h @@ -28,7 +28,6 @@ class PlaylistControls : public Controls public: PlaylistControls (wxWindow* parent, std::shared_ptr viewer); - void log (wxString s); void set_film (std::shared_ptr film); /** This is so that we can tell our parent player to reset the film -- 2.30.2