swaroop: various logging fixes.
authorCarl Hetherington <cth@carlh.net>
Sun, 23 Dec 2018 22:54:36 +0000 (22:54 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 23 Dec 2018 22:54:36 +0000 (22:54 +0000)
src/tools/dcpomatic_player.cc
src/wx/controls.cc
src/wx/controls.h
src/wx/film_viewer.cc
src/wx/film_viewer.h
src/wx/swaroop_controls.cc

index 32e5b16d691bcefeb331e16a50f5a66a991accd7..793600001145b96bf87f5d22734fa0e24b0e0916 100644 (file)
@@ -184,7 +184,6 @@ public:
                _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, _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 (Config::instance()->player_mode());
@@ -288,13 +287,6 @@ public:
 
        void playback_started (DCPTime time)
        {
-               optional<boost::filesystem::path> log = Config::instance()->player_log_file();
-               if (!log) {
-                       return;
-               }
-
-               FILE* f = fopen_boost(*log, "a");
-
                /* XXX: this only logs the first piece of content; probably should be each piece? */
 
                shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(_film->content().front());
@@ -308,40 +300,26 @@ public:
                        }
                        DCPOMATIC_ASSERT (playing_cpl);
 
-                       fprintf (
-                               f,
-                               "%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()
+                       _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().c_str()
+                                       )
                                );
                }
 
                shared_ptr<FFmpegContent> ffmpeg = dynamic_pointer_cast<FFmpegContent>(_film->content().front());
                if (ffmpeg) {
-                       fprintf (
-                               f,
-                               "%s playback-started %s %s\n",
-                               dcp::LocalTime().as_string().c_str(),
-                               time.timecode(_film->video_frame_rate()).c_str(),
-                               ffmpeg->path(0).string().c_str()
+                       _controls->log (
+                               wxString::Format(
+                                       "playback-started %s %s",
+                                       time.timecode(_film->video_frame_rate()).c_str(),
+                                       ffmpeg->path(0).string().c_str()
+                                       )
                                );
                }
-
-               fclose (f);
-       }
-
-       void playback_seeked (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-seeked %s\n", dcp::LocalTime().as_string().c_str(), time.timecode(_film->video_frame_rate()).c_str());
-               fclose (f);
        }
 
        void playback_stopped (DCPTime time)
@@ -354,14 +332,7 @@ public:
                }
 #endif
 
-               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);
+               _controls->log (wxString::Format("playback-stopped %s", time.timecode(_film->video_frame_rate()).c_str()));
        }
 
        void set_decode_reduction (optional<int> reduction)
index 3df62fd31dd193bb8ee89f1cd0d587d6a0368bca..01b689c9ec4db4f5b766a7d08b2d8e6a1bb487f4 100644 (file)
@@ -207,6 +207,12 @@ Controls::slider_moved (bool page)
        }
        _viewer->seek (t, false);
        update_position_label ();
+
+       log (
+               wxString::Format(
+                       "playback-seeked %s", t.timecode(_film->video_frame_rate()).c_str()
+                       )
+               );
 }
 
 void
index fd6181d91d193ada92c17d10d9c6657f5808eb3a..7ffe0c4ea5b1c8ebeaabc0c17a4e78230b7de64c 100644 (file)
@@ -51,6 +51,7 @@ public:
                bool editor_controls = true
                );
 
+       virtual void log (wxString) {}
        virtual void set_film (boost::shared_ptr<Film> film);
        boost::shared_ptr<Film> film () const;
        void back_frame ();
index 90f8c9fd2d885c20c974c13eb96835ade8b6866f..5c1b59ad6a89efd87cdbb38b266dfb2b1ee452f2 100644 (file)
@@ -603,7 +603,6 @@ FilmViewer::seek (DCPTime t, bool accurate)
        }
 
        PositionChanged ();
-       Seeked (position());
 }
 
 void
index 73c923c26c03b2de156bd6b064cc08787c6422e1..123172ad24de0e18f60fcb7ff041a1a864999e4b 100644 (file)
@@ -92,7 +92,6 @@ public:
        boost::signals2::signal<void ()> PositionChanged;
        boost::signals2::signal<void (DCPTime)> Started;
        boost::signals2::signal<void (DCPTime)> Stopped;
-       boost::signals2::signal<void (DCPTime)> Seeked;
        /** While playing back we reached the end of the film (emitted from GUI thread) */
        boost::signals2::signal<void ()> Finished;
 
index 62d9d03005e7713fbedc1c055ff0b937b43f8eb7..f93cc66f1eefe76f14ac6a057b11c4cb0cd0e8ff 100644 (file)
@@ -262,6 +262,15 @@ SwaroopControls::log (wxString s)
        strftime (buffer, 64, "%c", t);
        wxString ts = std_to_wx(string(buffer)) + N_(": ");
        _log->SetValue(_log->GetValue() + ts + s + "\n");
+
+       optional<boost::filesystem::path> log = Config::instance()->player_log_file();
+       if (!log) {
+               return;
+       }
+
+       FILE* f = fopen_boost (*log, "a");
+       fprintf (f, "%s%s\n", wx_to_std(ts).c_str(), wx_to_std(s).c_str());
+       fclose (f);
 }
 
 void
@@ -385,6 +394,8 @@ SwaroopControls::spl_selection_changed ()
                return;
        }
 
+       log (wxString::Format("load-playlist %s", std_to_wx(_playlists[selected].name()).data()));
+
        wxProgressDialog dialog (_("DCP-o-matic"), "Loading playlist and KDMs");
 
        BOOST_FOREACH (SPLEntry const & i, _playlists[selected].get()) {