summaryrefslogtreecommitdiff
path: root/src/wx/player_information.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-09-11 01:25:16 +0100
committerCarl Hetherington <cth@carlh.net>2018-09-11 11:58:15 +0100
commitc370a1f38215f6461cf4366e6885757e7aa2b96a (patch)
tree6d660895988652297260c2434115b903032bc60d /src/wx/player_information.cc
parent23b60bec13fa8f0b88c34922a169aa0084d99476 (diff)
Separate out management of controls.
Diffstat (limited to 'src/wx/player_information.cc')
-rw-r--r--src/wx/player_information.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc
index c66c6c1e9..c0821510c 100644
--- a/src/wx/player_information.cc
+++ b/src/wx/player_information.cc
@@ -20,7 +20,7 @@
#include "player_information.h"
#include "wx_util.h"
-#include "control_film_viewer.h"
+#include "film_viewer.h"
#include "lib/playlist.h"
#include "lib/compose.hpp"
#include "lib/video_content.h"
@@ -31,13 +31,14 @@
using std::cout;
using std::string;
using boost::shared_ptr;
+using boost::weak_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
/* This should be even */
static int const dcp_lines = 6;
-PlayerInformation::PlayerInformation (wxWindow* parent, ControlFilmViewer* viewer)
+PlayerInformation::PlayerInformation (wxWindow* parent, weak_ptr<FilmViewer> viewer)
: wxPanel (parent)
, _viewer (viewer)
, _sizer (new wxBoxSizer (wxHORIZONTAL))
@@ -87,15 +88,23 @@ PlayerInformation::PlayerInformation (wxWindow* parent, ControlFilmViewer* viewe
void
PlayerInformation::periodic_update ()
{
- checked_set (_dropped, wxString::Format(_("Dropped frames: %d"), _viewer->dropped()));
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (fv) {
+ checked_set (_dropped, wxString::Format(_("Dropped frames: %d"), fv->dropped()));
+ }
}
void
PlayerInformation::triggered_update ()
{
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (!fv) {
+ return;
+ }
+
shared_ptr<DCPContent> dcp;
- if (_viewer->film()) {
- ContentList content = _viewer->film()->content();
+ if (fv->film()) {
+ ContentList content = fv->film()->content();
if (content.size() == 1) {
dcp = dynamic_pointer_cast<DCPContent>(content.front());
}
@@ -151,7 +160,7 @@ PlayerInformation::triggered_update ()
checked_set (_dcp[r++], std_to_wx(len));
dcp::Size decode = dcp->video->size();
- optional<int> reduction = _viewer->dcp_decode_reduction();
+ optional<int> reduction = fv->dcp_decode_reduction();
if (reduction) {
decode.width /= pow(2, *reduction);
decode.height /= pow(2, *reduction);