Barely-functioning GL playback with new arrangement.
[dcpomatic.git] / src / tools / dcpomatic.cc
index 4ddedab41651e374a7f5b3f025ecbc759ca397c6..47851a21874249f67244ed168259c2c47d9ddbb6 100644 (file)
@@ -92,6 +92,9 @@
 #include <wx/preferences.h>
 #include <wx/splash.h>
 #include <wx/wxhtml.h>
+#ifdef __WXGTK__
+#include <X11/Xlib.h>
+#endif
 #ifdef __WXMSW__
 #include <shellapi.h>
 #endif
@@ -875,14 +878,19 @@ private:
                                )
                        );
 
+
+               dcp::LocalTime from (Config::instance()->decryption_chain()->leaf().not_before());
+               from.add_months (1);
+               dcp::LocalTime to (Config::instance()->decryption_chain()->leaf().not_after());
+               to.add_months (-1);
+
                optional<dcp::EncryptedKDM> kdm;
                try {
                        kdm = _film->make_kdm (
                                Config::instance()->decryption_chain()->leaf(),
                                vector<string>(),
                                d->cpl (),
-                               dcp::LocalTime ("2012-01-01T01:00:00+00:00"),
-                               dcp::LocalTime ("2112-01-01T01:00:00+00:00"),
+                               from, to,
                                dcp::MODIFIED_TRANSITIONAL_1,
                                true,
                                0
@@ -1482,6 +1490,8 @@ static const wxCmdLineEntryDesc command_line_description[] = {
        { wxCMD_LINE_SWITCH, "n", "new", "create new film", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_OPTION, "c", "content", "add content file / directory", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_OPTION, "d", "dcp", "add content DCP", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
+       { wxCMD_LINE_SWITCH, "v", "version", "show DCP-o-matic version", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
+       { wxCMD_LINE_OPTION, "", "config", "directory containing config.xml and cinemas.xml", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_PARAM, 0, 0, "film to load or create", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
 };
@@ -1496,7 +1506,11 @@ public:
                : wxApp ()
                , _frame (0)
                , _splash (0)
-       {}
+       {
+#ifdef DCPOMATIC_LINUX
+               XInitThreads ();
+#endif
+       }
 
 private:
 
@@ -1624,6 +1638,11 @@ private:
 
        bool OnCmdLineParsed (wxCmdLineParser& parser)
        {
+               if (parser.Found (wxT("version"))) {
+                       cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n";
+                       exit (EXIT_SUCCESS);
+               }
+
                if (parser.GetParamCount() > 0) {
                        if (parser.Found (wxT ("new"))) {
                                _film_to_create = wx_to_std (parser.GetParam (0));
@@ -1642,6 +1661,11 @@ private:
                        _dcp_to_add = wx_to_std (dcp);
                }
 
+               wxString config;
+               if (parser.Found (wxT("config"), &config)) {
+                       State::override_path = wx_to_std (config);
+               }
+
                return true;
        }