summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-08-14 22:55:05 +0100
committerCarl Hetherington <cth@carlh.net>2017-08-14 22:55:05 +0100
commit0b7c380031db6aa2ce546a2a0c89926f40eae6b5 (patch)
tree1dfc57348b80acd4f91e28c234bfd73333822b42 /src
parent2f7c57ed8650320ec25e981ff646820bf77e5793 (diff)
Primitive dropped frame count in display.
Diffstat (limited to 'src')
-rw-r--r--src/tools/dcpomatic_player.cc17
-rw-r--r--src/wx/film_viewer.cc3
-rw-r--r--src/wx/film_viewer.h6
-rw-r--r--src/wx/player_information.cc15
-rw-r--r--src/wx/player_information.h7
5 files changed, 44 insertions, 4 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index 567440f88..5ea341fe9 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -35,10 +35,12 @@
#include "wx/film_viewer.h"
#include "wx/player_information.h"
#include "wx/update_dialog.h"
+#include "wx/config_dialog.h"
#include <wx/wx.h>
#include <wx/stdpaths.h>
#include <wx/splash.h>
#include <wx/cmdline.h>
+#include <wx/preferences.h>
#include <boost/bind.hpp>
#include <iostream>
@@ -64,6 +66,9 @@ public:
DOMFrame ()
: wxFrame (0, -1, _("DCP-o-matic Player"))
, _update_news_requested (false)
+ , _info (0)
+ , _config_dialog (0)
+ , _viewer (0)
{
#if defined(DCPOMATIC_WINDOWS)
@@ -81,6 +86,7 @@ public:
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_open, this), ID_file_open);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT);
+ Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::set_decode_reduction, this, optional<int>()), ID_view_scale_appropriate);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::set_decode_reduction, this, optional<int>(0)), ID_view_scale_full);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::set_decode_reduction, this, optional<int>(1)), ID_view_scale_half);
@@ -136,7 +142,7 @@ public:
}
_viewer->set_film (_film);
- _info->update ();
+ _info->triggered_update ();
}
private:
@@ -216,6 +222,14 @@ private:
Close ();
}
+ void edit_preferences ()
+ {
+ if (!_config_dialog) {
+ _config_dialog = create_config_dialog ();
+ }
+ _config_dialog->Show (this);
+ }
+
void tools_check_for_updates ()
{
UpdateChecker::instance()->run ();
@@ -268,6 +282,7 @@ private:
bool _update_news_requested;
PlayerInformation* _info;
+ wxPreferencesEditor* _config_dialog;
FilmViewer* _viewer;
boost::shared_ptr<Film> _film;
};
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;
};