X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_player.cc;h=cd941e93557deab2cc53344204f5022fdc88dcd5;hb=6980066a05f020e3b8c6d0db06ccbb18e01391e3;hp=1cc53dafba2f6cf9aa95c52e39208f8576dab7dd;hpb=8f7fdb9fdcd4ffd076f07de9f49801fe01991776;p=dcpomatic.git diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 1cc53dafb..cd941e935 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2017-2018 Carl Hetherington + Copyright (C) 2017-2019 Carl Hetherington This file is part of DCP-o-matic. @@ -29,6 +29,7 @@ #include "wx/verify_dcp_dialog.h" #include "wx/standard_controls.h" #include "wx/swaroop_controls.h" +#include "wx/timer_display.h" #include "lib/cross.h" #include "lib/config.h" #include "lib/util.h" @@ -88,6 +89,7 @@ using boost::optional; using boost::dynamic_pointer_cast; using boost::thread; using boost::bind; +using namespace dcpomatic; enum { ID_file_open = 1, @@ -108,6 +110,7 @@ enum { ID_help_report_a_problem, ID_tools_verify, ID_tools_check_for_updates, + ID_tools_timing, /* IDs for shortcuts (with no associated menu item) */ ID_start_stop, ID_back_frame, @@ -168,6 +171,7 @@ public: Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_report_a_problem, this), ID_help_report_a_problem); Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_verify, this), ID_tools_verify); Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_check_for_updates, this), ID_tools_check_for_updates); + Bind (wxEVT_MENU, boost::bind (&DOMFrame::tools_timing, this), ID_tools_timing); /* Use a panel as the only child of the Frame so that we avoid the dark-grey background on Windows. @@ -289,6 +293,9 @@ public: void playback_started (DCPTime time) { /* XXX: this only logs the first piece of content; probably should be each piece? */ + if (_film->content().empty()) { + return; + } shared_ptr dcp = dynamic_pointer_cast(_film->content().front()); if (dcp) { @@ -495,6 +502,7 @@ private: _tools_verify = tools->Append (ID_tools_verify, _("Verify DCP")); tools->AppendSeparator (); tools->Append (ID_tools_check_for_updates, _("Check for updates")); + tools->Append (ID_tools_timing, _("Timing...")); wxMenu* help = new wxMenu; #ifdef __WXOSX__ @@ -591,11 +599,27 @@ private: if (d->ShowModal() == wxID_OK) { DCPOMATIC_ASSERT (_film); +#ifdef DCPOMATIC_VARIANT_SWAROOP + shared_ptr ffmpeg = boost::dynamic_pointer_cast(_film->content().front()); + if (ffmpeg) { + try { + ffmpeg->add_kdm (EncryptedECinemaKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE))); + } catch (exception& e) { + error_dialog (this, wxString::Format(_("Could not load KDM.")), std_to_wx(e.what())); + d->Destroy(); + return; + } + } +#endif shared_ptr dcp = boost::dynamic_pointer_cast(_film->content().front()); +#ifndef DCPOMATIC_VARIANT_SWAROOP DCPOMATIC_ASSERT (dcp); +#endif try { - dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE))); - dcp->examine (_film, shared_ptr()); + if (dcp) { + dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE))); + dcp->examine (_film, shared_ptr()); + } } catch (exception& e) { error_dialog (this, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what())); d->Destroy (); @@ -612,7 +636,11 @@ private: vector history = Config::instance()->player_history (); int n = event.GetId() - ID_file_history; if (n >= 0 && n < static_cast (history.size ())) { - load_dcp (history[n]); + try { + load_dcp (history[n]); + } catch (exception& e) { + error_dialog (0, std_to_wx(String::compose(wx_to_std(_("Could not load DCP %1.")), history[n])), std_to_wx(e.what())); + } } } @@ -761,6 +789,13 @@ private: _update_news_requested = true; } + void tools_timing () + { + TimerDisplay* d = new TimerDisplay (this, _viewer->state_timer(), _viewer->gets()); + d->ShowModal (); + d->Destroy (); + } + void help_about () { AboutDialog* d = new AboutDialog (this); @@ -844,6 +879,8 @@ private: int pos = _history_position; + /* Clear out non-existant history items before we re-build the menu */ + Config::instance()->clean_player_history (); vector history = Config::instance()->player_history (); if (!history.empty ()) { @@ -869,7 +906,7 @@ private: } else { dcpomatic_log.reset (new NullLog()); } - dcpomatic_log->set_types (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR); + dcpomatic_log->set_types (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR | LogEntry::TYPE_DEBUG_PLAYER); } }