2 Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include "certificates.h"
30 #include <boost/shared_ptr.hpp>
31 #include <boost/signals2.hpp>
40 /** @brief Namespace for everything in libdcp */
58 * @brief A class to create or read a DCP.
61 class DCP : public boost::noncopyable
64 /** Construct a DCP. You can pass an existing DCP's directory
65 * as the parameter, or a non-existant folder to create a new
68 * @param directory Directory containing the DCP's files.
70 DCP (boost::filesystem::path directory);
72 /** Read the DCP's structure into this object.
73 * @param keep_going true to try to keep going in the face of (some) errors.
74 * @param errors List of errors that will be added to if keep_going is true.
76 void read (bool keep_going = false, std::list<boost::shared_ptr<DCPReadError> >* errors = 0);
78 /** Compare this DCP with another, according to various options.
79 * @param other DCP to compare this one to.
80 * @param options Options to define what "equality" means.
81 * @param note Functor to handle notes made by the equality operation.
82 * @return true if the DCPs are equal according to EqualityOptions, otherwise false.
84 bool equals (DCP const & other, EqualityOptions options, boost::function<void (NoteType, std::string)> note) const;
86 void add (boost::shared_ptr<Asset> asset);
88 std::list<boost::shared_ptr<CPL> > cpls () const;
90 /** @return All this DCP's assets (note that CPLs are assets) */
91 std::list<boost::shared_ptr<Asset> > assets () const {
95 bool encrypted () const;
97 void add (DecryptedKDM const &);
101 XMLMetadata metadata = XMLMetadata (),
102 boost::shared_ptr<const Signer> signer = boost::shared_ptr<const Signer> ()
107 /** Write the PKL file.
108 * @param pkl_uuid UUID to use.
110 boost::filesystem::path write_pkl (
112 std::string pkl_uuid,
113 XMLMetadata metadata,
114 boost::shared_ptr<const Signer> signer
117 void write_volindex (Standard standard) const;
119 /** Write the ASSETMAP file.
120 * @param pkl_uuid UUID of our PKL.
121 * @param pkl_length Length of our PKL in bytes.
123 void write_assetmap (Standard standard, std::string pkl_uuid, int pkl_length, XMLMetadata metadata) const;
125 /** the directory that we are writing to */
126 boost::filesystem::path _directory;
127 /** the assets that make up this DCP */
128 std::list<boost::shared_ptr<Asset> > _assets;