diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-20 16:44:41 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-20 16:44:41 +0100 |
| commit | a7dc6ea9175883f439786bd6d15156a24390e109 (patch) | |
| tree | 00ce7249ae51d1878387645c874ac19a5f0e031b /src | |
| parent | 1327b93e61b4143a1209d67a7e9353fa96f58d23 (diff) | |
Reset player a bit better on new film (#182).
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/film_viewer.cc | 17 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 9d7225416..42654bde5 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -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 */ diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 1340f37fb..b45e53d31 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -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; |
