summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-03-14 00:59:58 +0000
committerCarl Hetherington <cth@carlh.net>2018-03-14 00:59:58 +0000
commitccde188f3b560730d14933af5caa11b413c2e623 (patch)
tree6beaf2c94cb239c596d7dc25abbaf86aac6616d2 /src
parentbbfdca5381b2c4ba53e79a616c21e539ffe8237e (diff)
Very basic DCP verification in the player (#1238).
Diffstat (limited to 'src')
-rw-r--r--src/lib/wscript1
-rw-r--r--src/tools/dcpomatic_player.cc35
-rw-r--r--src/wx/wscript1
3 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/wscript b/src/lib/wscript
index ae8ab30cb..9e7d83903 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -146,6 +146,7 @@ sources = """
upmixer_a.cc
upmixer_b.cc
util.cc
+ verify_dcp_job.cc
video_content.cc
video_content_scale.cc
video_decoder.cc
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index d42320bfd..89bff5cae 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -29,6 +29,7 @@
#include "lib/video_content.h"
#include "lib/subtitle_content.h"
#include "lib/ratio.h"
+#include "lib/verify_dcp_job.h"
#include "wx/wx_signal_manager.h"
#include "wx/wx_util.h"
#include "wx/about_dialog.h"
@@ -37,6 +38,7 @@
#include "wx/player_information.h"
#include "wx/update_dialog.h"
#include "wx/player_config_dialog.h"
+#include "wx/verify_dcp_dialog.h"
#include <wx/wx.h>
#include <wx/stdpaths.h>
#include <wx/splash.h>
@@ -59,6 +61,7 @@ using std::exception;
using std::vector;
using boost::shared_ptr;
using boost::optional;
+using boost::dynamic_pointer_cast;
enum {
ID_file_open = 1,
@@ -72,6 +75,7 @@ enum {
ID_view_scale_half,
ID_view_scale_quarter,
ID_help_report_a_problem,
+ ID_tools_verify,
ID_tools_check_for_updates,
};
@@ -120,6 +124,7 @@ public:
Bind (wxEVT_MENU, boost::bind (&DOMFrame::set_decode_reduction, this, optional<int>(2)), ID_view_scale_quarter);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_about, this), wxID_ABOUT);
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);
/* Use a panel as the only child of the Frame so that we avoid
@@ -239,6 +244,8 @@ private:
view->AppendRadioItem(ID_view_scale_quarter, _("Decode at quarter resolution"))->Check(c && c.get() == 2);
wxMenu* tools = new wxMenu;
+ _tools_verify = tools->Append (ID_tools_verify, _("Verify DCP"));
+ tools->AppendSeparator ();
tools->Append (ID_tools_check_for_updates, _("Check for updates"));
wxMenu* help = new wxMenu;
@@ -373,6 +380,32 @@ private:
_config_dialog->Show (this);
}
+ void tools_verify ()
+ {
+ shared_ptr<DCPContent> dcp = boost::dynamic_pointer_cast<DCPContent>(_film->content().front());
+ DCPOMATIC_ASSERT (dcp);
+
+ JobManager* jm = JobManager::instance ();
+ jm->add (shared_ptr<Job> (new VerifyDCPJob (dcp->directories())));
+
+ wxProgressDialog* progress = new wxProgressDialog (_("DCP-o-matic Player"), _("Verifying DCP"));
+
+ while (jm->work_to_do() || signal_manager->ui_idle()) {
+ dcpomatic_sleep (1);
+ progress->Pulse ();
+ }
+
+ progress->Destroy ();
+
+ DCPOMATIC_ASSERT (!jm->get().empty());
+ shared_ptr<VerifyDCPJob> last = dynamic_pointer_cast<VerifyDCPJob> (jm->get().back());
+ DCPOMATIC_ASSERT (last);
+
+ VerifyDCPDialog* d = new VerifyDCPDialog (this, last->notes ());
+ d->ShowModal ();
+ d->Destroy ();
+ }
+
void tools_check_for_updates ()
{
UpdateChecker::instance()->run ();
@@ -471,6 +504,7 @@ private:
void set_menu_sensitivity ()
{
+ _tools_verify->Enable (static_cast<bool>(_film));
_file_add_ov->Enable (static_cast<bool>(_film));
_file_add_kdm->Enable (static_cast<bool>(_film));
}
@@ -487,6 +521,7 @@ private:
boost::signals2::scoped_connection _config_changed_connection;
wxMenuItem* _file_add_ov;
wxMenuItem* _file_add_kdm;
+ wxMenuItem* _tools_verify;
};
static const wxCmdLineEntryDesc command_line_description[] = {
diff --git a/src/wx/wscript b/src/wx/wscript
index 227691be1..476cd468a 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -114,6 +114,7 @@ sources = """
timeline_view.cc
timing_panel.cc
update_dialog.cc
+ verify_dcp_dialog.cc
video_panel.cc
video_waveform_dialog.cc
video_waveform_plot.cc