Basic (untested) ebur128 (#368).
[dcpomatic.git] / src / lib / screen.cc
index 347e1d655a76aae7fc954bb4d7b69e7ec344b488..159c4326bc5b08e7e4ad26af87cffd7f54391efe 100644 (file)
 
 #include "screen.h"
 #include <libxml++/libxml++.h>
+#include <boost/foreach.hpp>
 
 Screen::Screen (cxml::ConstNodePtr node)
        : name (node->string_child ("Name"))
 {
        if (node->optional_string_child ("Certificate")) {
-               certificate = dcp::Certificate (node->string_child ("Certificate"));
+               recipient = dcp::Certificate (node->string_child ("Certificate"));
+       } else if (node->optional_string_child ("Recipient")) {
+               recipient = dcp::Certificate (node->string_child ("Recipient"));
+       }
+
+       BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children ("TrustedDevice")) {
+               trusted_devices.push_back (dcp::Certificate (i->content ()));
        }
 }
 
@@ -32,7 +39,11 @@ void
 Screen::as_xml (xmlpp::Element* parent) const
 {
        parent->add_child("Name")->add_child_text (name);
-       if (certificate) {
-               parent->add_child("Certificate")->add_child_text (certificate->certificate (true));
+       if (recipient) {
+               parent->add_child("Recipient")->add_child_text (recipient->certificate (true));
+       }
+
+       BOOST_FOREACH (dcp::Certificate const & i, trusted_devices) {
+               parent->add_child("TrustedDevice")->add_child_text (i.certificate (true));
        }
 }