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>
33 /** @brief Namespace for everything in libdcp */
39 /** @class DCP dcp.h libdcp/dcp.h
40 * @brief A class to create a DCP.
56 PUBLIC_SERVICE_ANNOUNCEMENT,
61 * @param directory Directory to write files to.
63 * @param content_type Content type.
64 * @param fps Frames per second.
65 * @param length Length in frames.
67 DCP (std::string directory, std::string name, ContentType content_type, int fps, int length);
69 /** Add a sound asset.
70 * @param files Pathnames of WAV files to use in the order Left, Right,
71 * Centre, Lfe (sub), Left surround, Right surround; not all files need
74 void add_sound_asset (std::vector<std::string> const & files);
76 /** Add a sound asset.
77 * @param get_path Functor to get the path to the WAV for a given channel.
78 * @param channels Number of channels.
80 void add_sound_asset (sigc::slot<std::string, Channel> get_path, int channels);
82 /** Add a picture asset.
83 * @param files Pathnames of JPEG2000 files, in frame order.
84 * @param width Width of images in pixels.
85 * @param height Height of images in pixels.
87 void add_picture_asset (std::vector<std::string> const & files, int width, int height);
89 /** Add a picture asset.
90 * @param get_path Functor to get path to the JPEG2000 for a given frame.
91 * @param width Width of images in pixels.
92 * @param height Height of images in pixels.
94 void add_picture_asset (sigc::slot<std::string, int> get_path, int width, int height);
96 /** Write the required XML files to the directory that was
97 * passed into the constructor.
99 void write_xml () const;
101 /** Emitted with a parameter between 0 and 1 to indicate progress
104 sigc::signal1<void, float> Progress;
108 /** Write the CPL file.
109 * @param cpl_uuid UUID to use.
110 * @return CPL pathname.
112 std::string write_cpl (std::string cpl_uuid) const;
114 /** Write the PKL file.
115 * @param pkl_uuid UUID to use.
116 * @param cpl_uuid UUID of the CPL file.
117 * @param cpl_digest SHA digest of the CPL file.
118 * @param cpl_length Length of the CPL file in bytes.
120 std::string write_pkl (std::string pkl_uuid, std::string cpl_uuid, std::string cpl_digest, int cpl_length) const;
122 /** Write the VOLINDEX file */
123 void write_volindex () const;
125 /** Write the ASSETMAP file.
126 * @param cpl_uuid UUID of our CPL.
127 * @param cpl_length Length of our CPL in bytes.
128 * @param pkl_uuid UUID of our PKL.
129 * @param pkl_length Length of our PKL in bytes.
131 void write_assetmap (std::string cpl_uuid, int cpl_length, std::string pkl_uuid, int pkl_length) const;
133 /** @param type A content type.
134 * @return A string representation suitable for use in a CPL.
136 static std::string content_type_string (ContentType type);
138 /** the directory that we are writing to */
139 std::string _directory;
140 /** the name of the DCP */
142 /** the content type of the DCP */
143 ContentType _content_type;
144 /** frames per second */
146 /** length in frames */
149 std::list<boost::shared_ptr<Asset> > _assets;