projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Take Film pointer out of Content.
[dcpomatic.git]
/
src
/
wx
/
player_information.cc
diff --git
a/src/wx/player_information.cc
b/src/wx/player_information.cc
index c66c6c1e937fc19c8a29f72184ab7c46eb016d59..5f480d5b4902832b14886a3aeb726c1d154fb7e8 100644
(file)
--- 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 "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"
#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 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;
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))
: wxPanel (parent)
, _viewer (viewer)
, _sizer (new wxBoxSizer (wxHORIZONTAL))
@@
-87,15
+88,23
@@
PlayerInformation::PlayerInformation (wxWindow* parent, ControlFilmViewer* viewe
void
PlayerInformation::periodic_update ()
{
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 ()
{
}
void
PlayerInformation::triggered_update ()
{
+ shared_ptr<FilmViewer> fv = _viewer.lock ();
+ if (!fv) {
+ return;
+ }
+
shared_ptr<DCPContent> dcp;
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());
}
if (content.size() == 1) {
dcp = dynamic_pointer_cast<DCPContent>(content.front());
}
@@
-144,14
+153,14
@@
PlayerInformation::triggered_update ()
string const len = String::compose(
wx_to_std(_("Length: %1 (%2 frames)")),
string const len = String::compose(
wx_to_std(_("Length: %1 (%2 frames)")),
- time_to_hmsf(dcp->full_length(), lrint(*vfr)),
- dcp->full_length().frames_round(*vfr)
+ time_to_hmsf(dcp->full_length(
fv->film()
), lrint(*vfr)),
+ dcp->full_length(
fv->film()
).frames_round(*vfr)
);
checked_set (_dcp[r++], std_to_wx(len));
dcp::Size decode = dcp->video->size();
);
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);
if (reduction) {
decode.width /= pow(2, *reduction);
decode.height /= pow(2, *reduction);