summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-01-31 20:54:13 +0000
committerCarl Hetherington <cth@carlh.net>2017-05-24 12:23:37 +0100
commitc94d763e07d9e7b029091e1ea64ba4f7758b3d5b (patch)
tree1555280c1c566b0933e5525061335cd4168755d8 /src/lib
parentb9fa952cb97a61b7977c28f089c0b41f7d8a5d24 (diff)
Basic implementation of a tree view for DKDMs (#1012).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc22
-rw-r--r--src/lib/config.h7
-rw-r--r--src/lib/wscript1
3 files changed, 19 insertions, 11 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 1baba956e..c2c6592cb 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -30,6 +30,7 @@
#include "util.h"
#include "cross.h"
#include "film.h"
+#include "dkdm_wrapper.h"
#include <dcp/raw_convert.h>
#include <dcp/name_format.h>
#include <dcp/certificate_chain.h>
@@ -57,6 +58,7 @@ using std::exception;
using std::cerr;
using boost::shared_ptr;
using boost::optional;
+using boost::dynamic_pointer_cast;
using boost::algorithm::trim;
using dcp::raw_convert;
@@ -65,6 +67,8 @@ boost::signals2::signal<void ()> Config::FailedToLoad;
/** Construct default configuration */
Config::Config ()
+ /* DKDMs are not considered a thing to reset on set_defaults() */
+ : _dkdms (new DKDMGroup ("root"))
{
set_defaults ();
}
@@ -315,11 +319,16 @@ try
_decryption_chain = create_certificate_chain ();
}
- list<cxml::NodePtr> dkdm = f.node_children ("DKDM");
- BOOST_FOREACH (cxml::NodePtr i, f.node_children ("DKDM")) {
- _dkdms.push_back (dcp::EncryptedKDM (i->content ()));
+ if (f.optional_node_child("DKDMGroup")) {
+ /* New-style: all DKDMs in a group */
+ _dkdms = dynamic_pointer_cast<DKDMGroup> (DKDMBase::read (f.node_child("DKDMGroup")));
+ } else {
+ /* Old-style: one or more DKDM nodes */
+ _dkdms.reset (new DKDMGroup ("root"));
+ BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("DKDM")) {
+ _dkdms->add (DKDMBase::read (i));
+ }
}
-
_cinemas_file = f.optional_string_child("CinemasFile").get_value_or (path ("cinemas.xml").string ());
_show_hints_before_make_dcp = f.optional_bool_child("ShowHintsBeforeMakeDCP").get_value_or (true);
_confirm_kdm_email = f.optional_bool_child("ConfirmKDMEmail").get_value_or (true);
@@ -367,7 +376,6 @@ catch (...) {
write ();
}
-
/** @return Filename to write configuration to */
boost::filesystem::path
Config::path (string file, bool create_directories)
@@ -506,9 +514,7 @@ Config::write_config () const
root->add_child("History")->add_child_text (i->string ());
}
- BOOST_FOREACH (dcp::EncryptedKDM i, _dkdms) {
- root->add_child("DKDM")->add_child_text (i.as_xml ());
- }
+ _dkdms->as_xml (root);
root->add_child("CinemasFile")->add_child_text (_cinemas_file.string());
root->add_child("ShowHintsBeforeMakeDCP")->add_child_text (_show_hints_before_make_dcp ? "1" : "0");
diff --git a/src/lib/config.h b/src/lib/config.h
index 4406f1649..44708a24f 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -40,6 +40,7 @@ class DCPContentType;
class Ratio;
class Cinema;
class Film;
+class DKDMGroup;
/** @class Config
* @brief A singleton class holding configuration.
@@ -281,7 +282,7 @@ public:
return _history;
}
- std::vector<dcp::EncryptedKDM> dkdms () const {
+ boost::shared_ptr<DKDMGroup> dkdms () const {
return _dkdms;
}
@@ -546,7 +547,7 @@ public:
}
#endif
- void set_dkdms (std::vector<dcp::EncryptedKDM> dkdms) {
+ void set_dkdms (boost::shared_ptr<DKDMGroup> dkdms) {
_dkdms = dkdms;
changed ();
}
@@ -744,7 +745,7 @@ private:
bool _win32_console;
#endif
std::vector<boost::filesystem::path> _history;
- std::vector<dcp::EncryptedKDM> _dkdms;
+ boost::shared_ptr<DKDMGroup> _dkdms;
boost::filesystem::path _cinemas_file;
bool _show_hints_before_make_dcp;
bool _confirm_kdm_email;
diff --git a/src/lib/wscript b/src/lib/wscript
index dc6e1017a..cbb01730f 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -64,6 +64,7 @@ sources = """
decoder_factory.cc
decoder_part.cc
digester.cc
+ dkdm_wrapper.cc
dolby_cp750.cc
emailer.cc
encoder.cc