2 Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of libdcp.
6 libdcp is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 libdcp is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with libdcp. If not, see <http://www.gnu.org/licenses/>.
19 In addition, as a special exception, the copyright holders give
20 permission to link the code of portions of this program with the
21 OpenSSL library under certain conditions as described in each
22 individual source file, and distribute linked combinations
25 You must obey the GNU General Public License in all respects
26 for all of the code used other than OpenSSL. If you modify
27 file(s) with this exception, you may extend this exception to your
28 version of the file(s), but you are not obligated to do so. If you
29 do not wish to do so, delete this exception statement from your
30 version. If you delete this exception statement from all source
31 files in the program, then also delete it here.
45 #include "certificate.h"
47 #include "language_tag.h"
49 #include <boost/filesystem.hpp>
50 #include <boost/function.hpp>
51 #include <boost/optional.hpp>
56 struct verify_various_invalid_languages;
65 class CertificateChain;
70 * @brief A Composition Playlist.
72 class CPL : public Asset
75 CPL (std::string annotation_text, ContentKind content_kind);
76 explicit CPL (boost::filesystem::path file);
79 std::shared_ptr<const Asset> other,
80 EqualityOptions options,
84 void add (std::shared_ptr<Reel> reel);
85 void add (DecryptedKDM const &);
87 /** @return the reels in this CPL */
88 std::vector<std::shared_ptr<Reel>> reels () const {
92 /** @return the ReelMXFs in this CPL in all reels */
93 std::vector<std::shared_ptr<const ReelMXF>> reel_mxfs () const;
94 std::vector<std::shared_ptr<ReelMXF>> reel_mxfs ();
96 bool encrypted () const;
99 boost::filesystem::path file,
101 std::shared_ptr<const CertificateChain>
104 void resolve_refs (std::vector<std::shared_ptr<Asset>>);
106 int64_t duration () const;
108 void set_issuer (std::string issuer) {
112 void set_creator (std::string creator) {
116 void set_issue_date (std::string issue_date) {
117 _issue_date = issue_date;
120 /** @return contents of the <AnnotationText> node, if present */
121 boost::optional<std::string> annotation_text () const {
122 return _annotation_text;
125 void set_annotation_text (std::string at) {
126 _annotation_text = at;
129 /** @return contents of the <ContentTitleText> node */
130 std::string content_title_text () const {
131 return _content_title_text;
134 void set_content_title_text (std::string ct) {
135 _content_title_text = ct;
138 void set_content_kind (dcp::ContentKind k) {
142 /** @return the type of the content, used by media servers
143 * to categorise things (e.g. feature, trailer, etc.)
145 ContentKind content_kind () const {
146 return _content_kind;
149 boost::optional<ContentVersion> content_version () const;
151 std::vector<ContentVersion> content_versions () const {
152 return _content_versions;
155 void set_content_version (ContentVersion v) {
156 _content_versions.clear ();
157 _content_versions.push_back (v);
160 void set_content_versions (std::vector<ContentVersion> v);
162 std::vector<Rating> ratings () const {
166 void set_ratings (std::vector<Rating> r) {
170 boost::optional<std::string> full_content_title_text () const {
171 return _full_content_title_text;
174 void set_full_content_title_text (std::string t) {
175 _full_content_title_text = t;
178 boost::optional<std::string> full_content_title_text_language () const {
179 return _full_content_title_text_language;
182 void set_full_content_title_text_language (dcp::LanguageTag l) {
183 _full_content_title_text_language = l.to_string();
186 boost::optional<std::string> release_territory () const {
187 return _release_territory;
190 void set_release_territory (dcp::LanguageTag::RegionSubtag t) {
191 _release_territory = t.subtag();
194 boost::optional<std::string> release_territory_scope () const {
195 return _release_territory_scope;
198 boost::optional<int> version_number () const {
199 return _version_number;
202 void set_version_number (int v);
204 void unset_version_number ();
206 boost::optional<Status> status () const {
210 void set_status (Status s) {
214 boost::optional<std::string> chain () const {
218 void set_chain (std::string c) {
222 boost::optional<std::string> distributor () const {
226 void set_distributor (std::string d) {
230 boost::optional<std::string> facility () const {
234 void set_facility (std::string f) {
238 boost::optional<Luminance> luminance () const {
242 void set_luminance (Luminance l) {
246 boost::optional<std::string> main_sound_configuration () const {
247 return _main_sound_configuration;
250 void set_main_sound_configuration (std::string c) {
251 _main_sound_configuration = c;
254 boost::optional<int> main_sound_sample_rate () const {
255 return _main_sound_sample_rate;
258 void set_main_sound_sample_rate (int r) {
259 _main_sound_sample_rate = r;
262 boost::optional<dcp::Size> main_picture_stored_area () const {
263 return _main_picture_stored_area;
266 void set_main_picture_stored_area (dcp::Size s) {
267 _main_picture_stored_area = s;
270 boost::optional<dcp::Size> main_picture_active_area () const {
271 return _main_picture_active_area;
274 void set_main_picture_active_area (dcp::Size s) {
275 _main_picture_active_area = s;
278 std::vector<std::string> additional_subtitle_languages () const {
279 return _additional_subtitle_languages;
282 void set_additional_subtitle_languages (std::vector<dcp::LanguageTag> const& lang);
284 boost::optional<Standard> standard () const {
288 static std::string static_pkl_type (Standard standard);
291 /** @return type string for PKLs for this asset */
292 std::string pkl_type (Standard standard) const;
295 friend struct ::verify_various_invalid_languages;
297 void maybe_write_composition_metadata_asset (xmlpp::Element* node) const;
298 void read_composition_metadata_asset (cxml::ConstNodePtr node);
301 std::string _creator;
302 std::string _issue_date;
303 boost::optional<std::string> _annotation_text;
304 std::string _content_title_text; ///< <ContentTitleText>
305 ContentKind _content_kind; ///< <ContentKind>
306 std::vector<ContentVersion> _content_versions;
307 std::vector<Rating> _ratings;
308 /** Human-readable name of the composition, without any metadata (i.e. no -FTR-EN-XX- etc.) */
309 boost::optional<std::string> _full_content_title_text;
310 boost::optional<std::string> _full_content_title_text_language;
311 /** This is stored and returned as a string so that we can tolerate non-RFC-5646 strings,
312 * but must be set as a dcp::LanguageTag to try to ensure that we create compliant output.
314 boost::optional<std::string> _release_territory;
315 boost::optional<std::string> _release_territory_scope;
316 boost::optional<int> _version_number;
317 boost::optional<Status> _status;
318 boost::optional<std::string> _chain;
319 boost::optional<std::string> _distributor;
320 boost::optional<std::string> _facility;
321 boost::optional<Luminance> _luminance;
322 boost::optional<std::string> _main_sound_configuration;
323 boost::optional<int> _main_sound_sample_rate;
324 boost::optional<dcp::Size> _main_picture_stored_area;
325 boost::optional<dcp::Size> _main_picture_active_area;
326 /* See note for _release_territory above */
327 std::vector<std::string> _additional_subtitle_languages;
329 std::vector<std::shared_ptr<Reel>> _reels;
331 /** Standard of CPL that was read in */
332 boost::optional<Standard> _standard;