diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-09-14 22:34:50 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-09-14 22:34:50 +0100 |
| commit | 18fbb7b578eb0626c269bbb90de205c2d8fc3326 (patch) | |
| tree | 298a7dad0db8c62268e22e2a9c345065362177b2 /src/tools/dcpomatic_player.cc | |
| parent | ddf2e8d432e7a4bbed576d72b28d77c3134cee14 (diff) | |
Very basic player logging.v2.13.49
Diffstat (limited to 'src/tools/dcpomatic_player.cc')
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index c6832772f..7a7e5ac16 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -163,6 +163,8 @@ public: _controls = new Controls (_overall_panel, _viewer); _viewer->set_dcp_decode_reduction (Config::instance()->decode_reduction ()); _viewer->PlaybackPermitted.connect (bind(&DOMFrame::playback_permitted, this)); + _viewer->Started.connect (bind(&DOMFrame::playback_started, this)); + _viewer->Stopped.connect (bind(&DOMFrame::playback_stopped, this)); _info = new PlayerInformation (_overall_panel, _viewer); wxSizer* main_sizer = new wxBoxSizer (wxVERTICAL); main_sizer->Add (_viewer->panel(), 1, wxEXPAND); @@ -219,6 +221,47 @@ public: return ok; } + void playback_started () + { + optional<boost::filesystem::path> log = Config::instance()->player_log_file(); + if (!log) { + return; + } + + shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front()); + DCPOMATIC_ASSERT (dcp); + DCPExaminer ex (dcp); + shared_ptr<dcp::CPL> playing_cpl; + BOOST_FOREACH (shared_ptr<dcp::CPL> i, ex.cpls()) { + if (!dcp->cpl() || i->id() == *dcp->cpl()) { + playing_cpl = i; + } + } + DCPOMATIC_ASSERT (playing_cpl) + + FILE* f = fopen_boost(*log, "a"); + fprintf ( + f, + "%s playback-started %s %s\n", + dcp::LocalTime().as_string().c_str(), + dcp->directories().front().string().c_str(), + playing_cpl->annotation_text().c_str() + ); + fclose (f); + } + + void playback_stopped () + { + optional<boost::filesystem::path> log = Config::instance()->player_log_file(); + if (!log) { + return; + } + + FILE* f = fopen_boost(*log, "a"); + fprintf (f, "%s playback-stopped\n", dcp::LocalTime().as_string().c_str()); + fclose (f); + } + void set_decode_reduction (optional<int> reduction) { _viewer->set_dcp_decode_reduction (reduction); |
