2 Copyright (C) 2012 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.
21 * @brief A class to create a DCP.
29 #include <boost/shared_ptr.hpp>
30 #include <boost/signals2.hpp>
32 #include "certificates.h"
39 /** @brief Namespace for everything in libdcp */
53 * @brief A class to create or read a DCP.
59 /** Construct a DCP. You can pass an existing DCP's directory
60 * as the parameter, or a non-existant folder to create a new
63 * @param directory Directory containing the DCP's files.
65 DCP (std::string directory);
67 /** Read an existing DCP's data.
69 * The DCP's XML metadata will be examined, and you can then look at the contents
72 * @param require_mxfs true to throw an exception if MXF files are missing; setting to false
73 * can be useful for testing, but normally it should be set to true.
75 void read (bool require_mxfs = true);
77 /** Write the required XML files to the directory that was
78 * passed into the constructor.
80 void write_xml (XMLMetadata const &, boost::shared_ptr<Encryption> crypt = boost::shared_ptr<Encryption> ()) const;
82 /** Compare this DCP with another, according to various options.
83 * @param other DCP to compare this one to.
84 * @param options Options to define what "equality" means.
85 * @return true if the DCPs are equal according to EqualityOptions, otherwise false.
87 bool equals (DCP const & other, EqualityOptions options, boost::function<void (NoteType, std::string)> note) const;
89 /** Add a CPL to this DCP.
90 * @param cpl CPL to add.
92 void add_cpl (boost::shared_ptr<CPL> cpl);
94 /** @return The list of CPLs in this DCP */
95 std::list<boost::shared_ptr<const CPL> > cpls () const {
99 /** Emitted with a parameter between 0 and 1 to indicate progress
102 boost::signals2::signal<void (float)> Progress;
106 /** Write the PKL file.
107 * @param pkl_uuid UUID to use.
109 std::string write_pkl (std::string pkl_uuid, XMLMetadata const &, boost::shared_ptr<Encryption>) const;
111 /** Write the VOLINDEX file */
112 void write_volindex () const;
114 /** Write the ASSETMAP file.
115 * @param pkl_uuid UUID of our PKL.
116 * @param pkl_length Length of our PKL in bytes.
118 void write_assetmap (std::string pkl_uuid, int pkl_length, XMLMetadata const &) const;
120 /** @return Assets in all this CPLs in this DCP */
121 std::list<boost::shared_ptr<const Asset> > assets () const;
124 std::list<std::string> cpls;
126 std::string asset_map;
129 /** the directory that we are writing to */
130 std::string _directory;
132 std::list<boost::shared_ptr<const CPL> > _cpls;