diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-08-14 22:55:05 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-08-14 22:55:05 +0100 |
| commit | 0b7c380031db6aa2ce546a2a0c89926f40eae6b5 (patch) | |
| tree | 1dfc57348b80acd4f91e28c234bfd73333822b42 /src/wx | |
| parent | 2f7c57ed8650320ec25e981ff646820bf77e5793 (diff) | |
Primitive dropped frame count in display.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/film_viewer.cc | 3 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 6 | ||||
| -rw-r--r-- | src/wx/player_information.cc | 15 | ||||
| -rw-r--r-- | src/wx/player_information.h | 7 |
4 files changed, 28 insertions, 3 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 50e357b54..036646ba5 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -93,6 +93,7 @@ FilmViewer::FilmViewer (wxWindow* p, bool outline_content, bool jump_to_selected , _audio_block_size (1024) , _playing (false) , _latency_history_count (0) + , _dropped (0) { #ifndef __WXOSX__ _panel->SetDoubleBuffered (true); @@ -286,6 +287,7 @@ FilmViewer::get () part if this frame is J2K). */ _video_position = video.second; + ++_dropped; return; } @@ -473,6 +475,7 @@ FilmViewer::start () } _playing = true; + _dropped = 0; timer (); } diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index c08409529..419ee4c29 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -60,6 +60,10 @@ public: void refresh (); + int dropped () const { + return _dropped; + } + int audio_callback (void* out, unsigned int frames); boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged; @@ -142,5 +146,7 @@ private: mutable boost::mutex _latency_history_mutex; int _latency_history_count; + int _dropped; + boost::signals2::scoped_connection _config_changed_connection; }; diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc index baeae838c..0a2921227 100644 --- a/src/wx/player_information.cc +++ b/src/wx/player_information.cc @@ -50,16 +50,27 @@ PlayerInformation::PlayerInformation (wxWindow* parent, FilmViewer* viewer) { wxSizer* s = new wxBoxSizer (wxVERTICAL); add_label_to_sizer(s, this, _("Performance"), false, 0)->SetFont(title_font); + _dropped = add_label_to_sizer(s, this, wxT(""), false, 0); _sizer->Add (s, 1, wxEXPAND | wxALL, 6); } SetSizerAndFit (_sizer); - update (); + triggered_update (); + + Bind (wxEVT_TIMER, boost::bind (&PlayerInformation::periodic_update, this)); + _timer.reset (new wxTimer (this)); + _timer->Start (500); +} + +void +PlayerInformation::periodic_update () +{ + checked_set (_dropped, wxString::Format(_("Dropped frames: %d"), _viewer->dropped())); } void -PlayerInformation::update () +PlayerInformation::triggered_update () { shared_ptr<DCPContent> dcp; if (_viewer->film()) { diff --git a/src/wx/player_information.h b/src/wx/player_information.h index af18cfb76..7eafeb122 100644 --- a/src/wx/player_information.h +++ b/src/wx/player_information.h @@ -19,6 +19,7 @@ */ #include <wx/wx.h> +#include <boost/scoped_ptr.hpp> class FilmViewer; @@ -27,13 +28,17 @@ class PlayerInformation : public wxPanel public: PlayerInformation (wxWindow* parent, FilmViewer* viewer); - void update (); + void triggered_update (); private: + void periodic_update (); + FilmViewer* _viewer; wxSizer* _sizer; wxStaticText* _cpl_name; wxStaticText* _size; wxStaticText* _length; + wxStaticText* _dropped; + boost::scoped_ptr<wxTimer> _timer; }; |
