Reset player a bit better on new film (#182).
authorCarl Hetherington <cth@carlh.net>
Sat, 20 Jul 2013 15:44:41 +0000 (16:44 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 20 Jul 2013 15:44:41 +0000 (16:44 +0100)
src/wx/film_viewer.cc
src/wx/film_viewer.h

index 9d72254167857b4b8d284006e8307c5065b2585d..42654bde5acea733548b60aac9ecf24bde3becf1 100644 (file)
@@ -122,6 +122,9 @@ FilmViewer::set_film (shared_ptr<Film> f)
        _frame.reset ();
        _queue.clear ();
 
+       _slider->SetValue (0);
+       set_position_text (0);
+       
        if (!_film) {
                return;
        }
@@ -288,6 +291,18 @@ FilmViewer::process_video (shared_ptr<const Image> image, Time t)
        _frame = image;
        _got_frame = true;
 
+       set_position_text (t);
+}
+
+void
+FilmViewer::set_position_text (Time t)
+{
+       if (!_film) {
+               _frame_number->SetLabel ("0");
+               _timecode->SetLabel ("0:0:0.0");
+               return;
+       }
+               
        double const fps = _film->dcp_video_frame_rate ();
        /* Count frame number from 1 ... not sure if this is the best idea */
        _frame_number->SetLabel (wxString::Format (wxT("%d"), int (rint (t * fps / TIME_HZ)) + 1));
@@ -300,7 +315,7 @@ FilmViewer::process_video (shared_ptr<const Image> image, Time t)
        int const s = floor (w);
        w -= s;
        int const f = rint (w * fps);
-       _timecode->SetLabel (wxString::Format (wxT("%02d:%02d:%02d:%02d"), h, m, s, f));
+       _timecode->SetLabel (wxString::Format (wxT("%02d:%02d:%02d.%02d"), h, m, s, f));
 }
 
 /** Ask the player to emit its next frame, then update our display */
index 1340f37fba81d41858c3b123af0ef4caa5e965bf..b45e53d319911c0525768a20a4464fa5a1f57622 100644 (file)
@@ -67,6 +67,7 @@ private:
        void back_clicked (wxCommandEvent &);
        void forward_clicked (wxCommandEvent &);
        void player_changed (bool);
+       void set_position_text (Time);
 
        boost::shared_ptr<Film> _film;
        boost::shared_ptr<Player> _player;