diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-08-20 00:17:46 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-08-20 00:17:46 +0100 |
| commit | 35e9a698ba3ca35fd488b3622e441956632261cf (patch) | |
| tree | 123624c4bc215943666c1c9cc24d0d08cd8ae336 /src/tools | |
| parent | 8f3743d18026b59b1ecd8e8f4d12cc59273eb1ed (diff) | |
Allow player to handle VF/OV and KDMs.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 2dd29c3ed..959b5709c 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -59,6 +59,8 @@ using boost::optional; enum { ID_file_open = 1, + ID_file_add_ov, + ID_file_add_kdm, ID_view_scale_appropriate, ID_view_scale_full, ID_view_scale_half, @@ -94,6 +96,8 @@ public: _config_changed_connection = Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this)); Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_open, this), ID_file_open); + Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_add_ov, this), ID_file_add_ov); + Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_add_kdm, this), ID_file_add_kdm); 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); @@ -160,6 +164,8 @@ private: { wxMenu* file = new wxMenu; file->Append (ID_file_open, _("&Open...\tCtrl-O")); + file->Append (ID_file_add_ov, _("&Add OV...")); + file->Append (ID_file_add_kdm, _("&Add KDM...")); #ifdef __WXOSX__ file->Append (wxID_EXIT, _("&Exit")); @@ -226,6 +232,58 @@ private: c->Destroy (); } + void file_add_ov () + { + wxDirDialog* c = new wxDirDialog ( + this, + _("Select DCP to open as OV"), + wxStandardPaths::Get().GetDocumentsDir(), + wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST + ); + + int r; + while (true) { + r = c->ShowModal (); + if (r == wxID_OK && c->GetPath() == wxStandardPaths::Get().GetDocumentsDir()) { + error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open.")); + } else { + break; + } + } + + if (r == wxID_OK) { + shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front()); + DCPOMATIC_ASSERT (dcp); + dcp->add_ov (wx_to_std(c->GetPath())); + dcp->examine (shared_ptr<Job>()); + } + + c->Destroy (); + _info->triggered_update (); + } + + void file_add_kdm () + { + wxFileDialog* d = new wxFileDialog (this, _("Select KDM")); + + if (d->ShowModal() == wxID_OK) { + shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front()); + DCPOMATIC_ASSERT (dcp); + try { + dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE))); + } catch (exception& e) { + error_dialog (this, wxString::Format (_("Could not load KDM (%s)"), e.what ())); + d->Destroy (); + return; + } + + dcp->examine (shared_ptr<Job>()); + } + + d->Destroy (); + _info->triggered_update (); + } + void file_exit () { Close (); |
