X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fplayer_information.cc;h=f0eaa59bbea8e643ce7900f332fc3836e824061e;hb=23aa3071850761144798112a5aaea61304de8586;hp=9c5684e74015ab534f65fe8014fe55f40abb81c8;hpb=e41c40521367885d1433ba53bc57c265237c7480;p=dcpomatic.git diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc index 9c5684e74..f0eaa59bb 100644 --- a/src/wx/player_information.cc +++ b/src/wx/player_information.cc @@ -26,17 +26,19 @@ #include "lib/video_content.h" #include "lib/audio_content.h" #include "lib/dcp_content.h" +#include "lib/film.h" using std::cout; using std::string; -using boost::shared_ptr; -using boost::dynamic_pointer_cast; +using std::shared_ptr; +using std::weak_ptr; +using std::dynamic_pointer_cast; using boost::optional; /* This should be even */ static int const dcp_lines = 6; -PlayerInformation::PlayerInformation (wxWindow* parent, FilmViewer* viewer) +PlayerInformation::PlayerInformation (wxWindow* parent, weak_ptr viewer) : wxPanel (parent) , _viewer (viewer) , _sizer (new wxBoxSizer (wxHORIZONTAL)) @@ -86,15 +88,29 @@ PlayerInformation::PlayerInformation (wxWindow* parent, FilmViewer* viewer) void PlayerInformation::periodic_update () { - checked_set (_dropped, wxString::Format(_("Dropped frames: %d"), _viewer->dropped())); + shared_ptr fv = _viewer.lock (); + if (fv) { + wxString s = wxString::Format(_("Dropped frames: %d"), fv->dropped() + fv->errored()); + if (fv->errored() == 1) { + s += wxString::Format(_(" (%d error)"), fv->errored()); + } else if (fv->errored() > 1) { + s += wxString::Format(_(" (%d errors)"), fv->errored()); + } + checked_set (_dropped, s); + } } void PlayerInformation::triggered_update () { + shared_ptr fv = _viewer.lock (); + if (!fv) { + return; + } + shared_ptr 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(content.front()); } @@ -131,7 +147,7 @@ PlayerInformation::triggered_update () if (dcp->audio && !dcp->audio->streams().empty()) { checked_set (_dcp[r++], wxString::Format(_("Audio channels: %d"), dcp->audio->streams().front()->channels())); } - if (dcp->subtitle) { + if (!dcp->text.empty()) { checked_set (_dcp[r++], _("Subtitles: yes")); } else { checked_set (_dcp[r++], _("Subtitles: no")); @@ -143,14 +159,14 @@ PlayerInformation::triggered_update () 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(); - optional reduction = _viewer->dcp_decode_reduction(); + optional reduction = fv->dcp_decode_reduction(); if (reduction) { decode.width /= pow(2, *reduction); decode.height /= pow(2, *reduction);