+2017-08-20 Carl Hetherington <cth@carlh.net>
+
+ * Add VF/OV and KDM support to player.
+
2017-08-19 Carl Hetherington <cth@carlh.net>
* Deal with newly-invalid configured default container ratios
string const old_name = name ();
bool had_subtitles = static_cast<bool> (subtitle);
- job->set_progress_unknown ();
+ if (job) {
+ job->set_progress_unknown ();
+ }
Content::examine (job);
shared_ptr<DCPExaminer> examiner (new DCPExaminer (shared_from_this ()));
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,
_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);
{
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"));
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 ();
using boost::dynamic_pointer_cast;
using boost::optional;
+static int const dcp_lines = 4;
+
PlayerInformation::PlayerInformation (wxWindow* parent, FilmViewer* viewer)
: wxPanel (parent)
, _viewer (viewer)
wxFont title_font (*wxNORMAL_FONT);
title_font.SetWeight (wxFONTWEIGHT_BOLD);
+ _dcp = new wxStaticText*[dcp_lines];
+
{
wxSizer* s = new wxBoxSizer (wxVERTICAL);
add_label_to_sizer(s, this, _("DCP"), false, 0)->SetFont(title_font);
- _cpl_name = add_label_to_sizer(s, this, wxT(""), false, 0);
- _size = add_label_to_sizer(s, this, wxT(""), false, 0);
- _length = add_label_to_sizer(s, this, wxT(""), false, 0);
+ for (int i = 0; i < dcp_lines; ++i) {
+ _dcp[i] = add_label_to_sizer(s, this, wxT(""), false, 0);
+ }
_sizer->Add (s, 1, wxEXPAND | wxALL, 6);
}
}
if (!dcp) {
- checked_set (_cpl_name, _("No DCP loaded."));
- checked_set (_size, wxT(""));
- checked_set (_length, wxT(""));
+ checked_set (_dcp[0], _("No DCP loaded."));
+ for (int r = 1; r < dcp_lines; ++r) {
+ checked_set (_dcp[r], wxT(""));
+ }
+ return;
+ }
+
+ int r = 0;
+ checked_set (_dcp[r++], std_to_wx(dcp->name()));
+
+ if (dcp->needs_assets()) {
+ checked_set (_dcp[r], _("Needs OV"));
+ return;
+ }
+
+ if (dcp->needs_kdm()) {
+ checked_set (_dcp[r], _("Needs KDM"));
return;
}
DCPOMATIC_ASSERT (dcp->video);
- checked_set (_cpl_name, std_to_wx(dcp->name()));
- checked_set (_size, wxString::Format(_("Size: %dx%d"), dcp->video->size().width, dcp->video->size().height));
+ checked_set (_dcp[r++], wxString::Format(_("Size: %dx%d"), dcp->video->size().width, dcp->video->size().height));
optional<double> vfr;
vfr = dcp->video_frame_rate ();
DCPOMATIC_ASSERT (vfr);
checked_set (
- _length,
+ _dcp[r++],
wxString::Format(
_("Length: %s (%ld frames)"),
std_to_wx(time_to_hmsf(dcp->full_length(), lrint(*vfr))).data(),
FilmViewer* _viewer;
wxSizer* _sizer;
- wxStaticText* _cpl_name;
- wxStaticText* _size;
- wxStaticText* _length;
+ wxStaticText** _dcp;
wxStaticText* _dropped;
boost::scoped_ptr<wxTimer> _timer;
};