Add playback seek logging.
[dcpomatic.git] / src / tools / dcpomatic_player.cc
index ee6ec60af2ade48d9c0578f01b70a6ddc27b8c59..3be947cc623bcdec3637ed5488733ba12f7c628c 100644 (file)
@@ -115,6 +115,8 @@ public:
                , _history_items (0)
                , _history_position (0)
                , _history_separator (0)
+               , _view_full_screen (0)
+               , _view_dual_screen (0)
        {
 
 #if defined(DCPOMATIC_WINDOWS)
@@ -159,11 +161,12 @@ public:
                _overall_panel = new wxPanel (this, wxID_ANY);
 
                _viewer.reset (new FilmViewer (_overall_panel));
-               _controls = new Controls (_overall_panel, _viewer);
+               _controls = new Controls (_overall_panel, _viewer, false, false, false);
                _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));
+               _viewer->Started.connect (bind(&DOMFrame::playback_started, this, _1));
+               _viewer->Seeked.connect (bind(&DOMFrame::playback_seeked, this, _1));
+               _viewer->Stopped.connect (bind(&DOMFrame::playback_stopped, this, _1));
                _info = new PlayerInformation (_overall_panel, _viewer);
                setup_main_sizer (true);
 #ifdef __WXOSX__
@@ -225,7 +228,7 @@ public:
                return ok;
        }
 
-       void playback_started ()
+       void playback_started (DCPTime time)
        {
                optional<boost::filesystem::path> log = Config::instance()->player_log_file();
                if (!log) {
@@ -246,15 +249,16 @@ public:
                FILE* f = fopen_boost(*log, "a");
                fprintf (
                        f,
-                       "%s playback-started %s %s\n",
+                       "%s playback-started %s %s %s\n",
                        dcp::LocalTime().as_string().c_str(),
+                       time.timecode(_film->video_frame_rate()).c_str(),
                        dcp->directories().front().string().c_str(),
                        playing_cpl->annotation_text().c_str()
                        );
                fclose (f);
        }
 
-       void playback_stopped ()
+       void playback_seeked (DCPTime time)
        {
                optional<boost::filesystem::path> log = Config::instance()->player_log_file();
                if (!log) {
@@ -262,7 +266,19 @@ public:
                }
 
                FILE* f = fopen_boost(*log, "a");
-               fprintf (f, "%s playback-stopped\n", dcp::LocalTime().as_string().c_str());
+               fprintf (f, "%s playback-seeked %s\n", dcp::LocalTime().as_string().c_str(), time.timecode(_film->video_frame_rate()).c_str());
+               fclose (f);
+       }
+
+       void playback_stopped (DCPTime time)
+       {
+               optional<boost::filesystem::path> log = Config::instance()->player_log_file();
+               if (!log) {
+                       return;
+               }
+
+               FILE* f = fopen_boost(*log, "a");
+               fprintf (f, "%s playback-stopped %s\n", dcp::LocalTime().as_string().c_str(), time.timecode(_film->video_frame_rate()).c_str());
                fclose (f);
        }
 
@@ -355,8 +371,10 @@ private:
                optional<int> c = Config::instance()->decode_reduction();
                _view_cpl = view->Append(ID_view_cpl, _("CPL"), _cpl_menu);
                view->AppendSeparator();
+#ifndef DCPOMATIC_VARIANT_SWAROOP
                _view_full_screen = view->AppendCheckItem(ID_view_full_screen, _("Full screen\tF11"));
                _view_dual_screen = view->AppendCheckItem(ID_view_dual_screen, _("Dual screen\tShift+F11"));
+#endif
                setup_menu ();
                view->AppendSeparator();
                view->Append(ID_view_closed_captions, _("Closed captions..."));
@@ -547,8 +565,12 @@ private:
 
        void setup_menu ()
        {
-               _view_full_screen->Check (_mode == Config::PLAYER_MODE_FULL);
-               _view_dual_screen->Check (_mode == Config::PLAYER_MODE_DUAL);
+               if (_view_full_screen) {
+                       _view_full_screen->Check (_mode == Config::PLAYER_MODE_FULL);
+               }
+               if (_view_dual_screen) {
+                       _view_dual_screen->Check (_mode == Config::PLAYER_MODE_DUAL);
+               }
        }
 
        void setup_screen ()