diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-04-19 22:10:10 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-04-19 22:10:10 +0100 |
| commit | f2989966b2871ac5fc5f78c2a3ce7867f344b7cd (patch) | |
| tree | fd54cb33a19a1cd8b8b4c0831e2ab9bc2ea84515 /src | |
| parent | c9375d572f6e508f4d6a3c039d3827ef44407c1a (diff) | |
Basic frame index and timecode (part of #68).
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/film_viewer.cc | 24 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 40b74ac39..00f895285 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -51,6 +51,8 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p) : wxPanel (p) , _panel (new wxPanel (this)) , _slider (new wxSlider (this, wxID_ANY, 0, 0, 4096)) + , _frame (new wxStaticText (this, wxID_ANY, wxT(""))) + , _timecode (new wxStaticText (this, wxID_ANY, wxT(""))) , _play_button (new wxToggleButton (this, wxID_ANY, _("Play"))) , _display_frame_x (0) , _got_frame (false) @@ -66,11 +68,19 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p) _v_sizer->Add (_panel, 1, wxEXPAND); wxBoxSizer* h_sizer = new wxBoxSizer (wxHORIZONTAL); + + wxBoxSizer* time_sizer = new wxBoxSizer (wxVERTICAL); + time_sizer->Add (_frame, 0, wxEXPAND); + time_sizer->Add (_timecode, 0, wxEXPAND); + + h_sizer->Add (time_sizer, 0, wxEXPAND); h_sizer->Add (_play_button, 0, wxEXPAND); h_sizer->Add (_slider, 1, wxEXPAND); _v_sizer->Add (h_sizer, 0, wxEXPAND | wxALL, 6); + _frame->SetMinSize (wxSize (84, -1)); + _panel->Connect (wxID_ANY, wxEVT_PAINT, wxPaintEventHandler (FilmViewer::paint_panel), 0, this); _panel->Connect (wxID_ANY, wxEVT_SIZE, wxSizeEventHandler (FilmViewer::panel_sized), 0, this); _slider->Connect (wxID_ANY, wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler (FilmViewer::slider_moved), 0, this); @@ -390,6 +400,20 @@ FilmViewer::process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle> s raw_to_display (); _got_frame = true; + + double const t = _decoders.video->last_source_time (); + double const fps = _decoders.video->frames_per_second (); + _frame->SetLabel (wxString::Format ("%d", int (rint (t * fps)))); + + double w = t; + int const h = (w / 3600); + w -= h * 3600; + int const m = (w / 60); + w -= m * 60; + int const s = floor (w); + w -= s; + int const f = rint (w * fps); + _timecode->SetLabel (wxString::Format ("%02d:%02d:%02d:%02d", h, m, s, f)); } void diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 784434f6b..859bf7ede 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -62,6 +62,8 @@ private: wxSizer* _v_sizer; wxPanel* _panel; wxSlider* _slider; + wxStaticText* _frame; + wxStaticText* _timecode; wxToggleButton* _play_button; wxTimer _timer; |
