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 <sigc++/sigc++.h>
37 /** @brief Namespace for everything in libdcp */
47 /** @class DCP dcp.h libdcp/dcp.h
48 * @brief A class to create or read a DCP.
56 * This is for making a new DCP that you are going to add assets to.
58 * @param directory Directory to write files to.
60 * @param content_kind Content kind.
61 * @param fps Frames per second.
62 * @param length Length in frames.
64 DCP (std::string directory, std::string name, ContentKind content_kind, int fps, int length);
66 /** Construct a DCP object for an existing DCP.
68 * The DCP's XML metadata will be examined, and you can then look at the contents
71 * @param directory Existing DCP's directory.
72 * @param read_mxfs true to read MXF files; setting to false can be useful for testing, but
73 * normally it should be set to true.
75 DCP (std::string directory, bool read_mxfs = true);
77 void add_reel (boost::shared_ptr<const Reel> reel);
79 /** Write the required XML files to the directory that was
80 * passed into the constructor.
82 void write_xml () const;
84 /** @return the DCP's name, as will be presented on projector
85 * media servers and theatre management systems.
87 std::string name () const {
91 /** @return the type of the content, used by media servers
92 * to categorise things (e.g. feature, trailer, etc.)
94 ContentKind content_kind () const {
98 /** @return the number of frames per second */
99 int frames_per_second () const {
103 /** @return the length in frames */
104 int length () const {
108 std::list<boost::shared_ptr<const Reel> > reels () const {
112 /** Compare this DCP with another, according to various options.
113 * @param other DCP to compare this one to.
114 * @param options Options to define just what "equality" means.
115 * @return An empty list if the DCPs are equal; otherwise a list of messages
116 * which explain the ways in which they differ.
118 std::list<std::string> equals (DCP const & other, EqualityOptions options) const;
120 /** Emitted with a parameter between 0 and 1 to indicate progress
123 sigc::signal1<void, float> Progress;
127 /** Write the CPL file.
128 * @param cpl_uuid UUID to use.
129 * @return CPL pathname.
131 std::string write_cpl (std::string cpl_uuid) const;
133 /** Write the PKL file.
134 * @param pkl_uuid UUID to use.
135 * @param cpl_uuid UUID of the CPL file.
136 * @param cpl_digest SHA digest of the CPL file.
137 * @param cpl_length Length of the CPL file in bytes.
139 std::string write_pkl (std::string pkl_uuid, std::string cpl_uuid, std::string cpl_digest, int cpl_length) const;
141 /** Write the VOLINDEX file */
142 void write_volindex () const;
144 /** Write the ASSETMAP file.
145 * @param cpl_uuid UUID of our CPL.
146 * @param cpl_length Length of our CPL in bytes.
147 * @param pkl_uuid UUID of our PKL.
148 * @param pkl_length Length of our PKL in bytes.
150 void write_assetmap (std::string cpl_uuid, int cpl_length, std::string pkl_uuid, int pkl_length) const;
155 std::string asset_map;
156 std::list<std::string> subtitles;
159 void scan (Files& files, std::string directory) const;
161 /** the directory that we are writing to */
162 std::string _directory;
163 /** the name of the DCP */
165 /** the content kind of the DCP */
166 ContentKind _content_kind;
167 /** frames per second */
169 /** length in frames */
172 std::list<boost::shared_ptr<const Reel> > _reels;