Merge master
[libdcp.git] / src / dcp.h
index c5734542a97e17cff311f199da3f1c2200c0b154..5a9150196c9b5088173a50b5575328f4c4024213 100644 (file)
--- a/src/dcp.h
+++ b/src/dcp.h
 #include <vector>
 #include <boost/shared_ptr.hpp>
 #include <boost/signals2.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
 #include "types.h"
+#include "certificates.h"
 
 namespace xmlpp {
-       class Node;
+       class Document;
+       class Element;
 }
 
 /** @brief Namespace for everything in libdcp */
@@ -45,6 +48,18 @@ class SubtitleAsset;
 class Reel;
 class AssetMap;
 
+class Encryption
+{
+public:
+       Encryption (CertificateChain c, std::string const & k)
+               : certificates (c)
+               , signer_key (k)
+       {}
+
+       CertificateChain certificates;
+       std::string signer_key;
+};
+
 /** @brief A CPL within a DCP */
 class CPL
 {
@@ -86,9 +101,17 @@ public:
        
        bool equals (CPL const & other, EqualityOptions options, std::list<std::string>& notes) const;
        
-       void write_xml () const;
+       void write_xml (boost::shared_ptr<Encryption>) const;
        void write_to_assetmap (std::ostream& s) const;
-       void write_to_pkl (std::ostream& s) const;
+       void write_to_pkl (xmlpp::Element* p) const;
+
+       boost::shared_ptr<xmlpp::Document> make_kdm (
+               CertificateChain const &,
+               std::string const &,
+               boost::shared_ptr<const Certificate>,
+               boost::posix_time::ptime from,
+               boost::posix_time::ptime until
+               ) const;
        
 private:
        std::string _directory;
@@ -137,7 +160,7 @@ public:
        /** Write the required XML files to the directory that was
         *  passed into the constructor.
         */
-       void write_xml () const;
+       void write_xml (boost::shared_ptr<Encryption> crypt = boost::shared_ptr<Encryption> ()) const;
 
        /** Compare this DCP with another, according to various options.
         *  @param other DCP to compare this one to.
@@ -167,7 +190,7 @@ private:
        /** Write the PKL file.
         *  @param pkl_uuid UUID to use.
         */
-       std::string write_pkl (std::string pkl_uuid) const;
+       std::string write_pkl (std::string pkl_uuid, boost::shared_ptr<Encryption>) const;
        
        /** Write the VOLINDEX file */
        void write_volindex () const;