2 Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic 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 DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef DCPOMATIC_DCP_CONTENT_H
22 #define DCPOMATIC_DCP_CONTENT_H
24 /** @file src/lib/dcp_content.h
25 * @brief DCPContent class.
29 #include <libcxml/cxml.h>
30 #include <dcp/encrypted_kdm.h>
32 class DCPContentProperty
35 static int const NEEDS_KDM;
36 static int const NEEDS_ASSETS;
37 static int const REFERENCE_VIDEO;
38 static int const REFERENCE_AUDIO;
39 static int const REFERENCE_CAPTION;
40 static int const NAME;
41 static int const CAPTIONS;
47 * @brief An existing DCP used as input.
49 class DCPContent : public Content
52 DCPContent (boost::shared_ptr<const Film>, boost::filesystem::path p);
53 DCPContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version);
55 boost::shared_ptr<DCPContent> shared_from_this () {
56 return boost::dynamic_pointer_cast<DCPContent> (Content::shared_from_this ());
59 boost::shared_ptr<const DCPContent> shared_from_this () const {
60 return boost::dynamic_pointer_cast<const DCPContent> (Content::shared_from_this ());
63 DCPTime full_length () const;
65 void examine (boost::shared_ptr<Job>);
66 std::string summary () const;
67 std::string technical_summary () const;
68 void as_xml (xmlpp::Node *, bool with_paths) const;
69 std::string identifier () const;
70 void take_settings_from (boost::shared_ptr<const Content> c);
72 void set_default_colour_conversion ();
73 std::list<DCPTime> reel_split_points () const;
75 std::vector<boost::filesystem::path> directories () const;
77 bool encrypted () const {
78 boost::mutex::scoped_lock lm (_mutex);
82 void add_kdm (dcp::EncryptedKDM);
83 void add_ov (boost::filesystem::path ov);
85 boost::optional<dcp::EncryptedKDM> kdm () const {
89 bool can_be_played () const;
90 bool needs_kdm () const;
91 bool needs_assets () const;
93 void set_reference_video (bool r);
95 bool reference_video () const {
96 boost::mutex::scoped_lock lm (_mutex);
97 return _reference_video;
100 bool can_reference_video (std::string &) const;
102 void set_reference_audio (bool r);
104 bool reference_audio () const {
105 boost::mutex::scoped_lock lm (_mutex);
106 return _reference_audio;
109 bool can_reference_audio (std::string &) const;
111 void set_reference_caption (CaptionType type, bool r);
113 /** @param type Original type of captions in the DCP.
114 * @return true if these captions are to be referenced.
116 bool reference_caption (CaptionType type) const {
117 boost::mutex::scoped_lock lm (_mutex);
118 return _reference_caption[type];
121 bool can_reference_caption (CaptionType type, std::string &) const;
123 void set_cpl (std::string id);
125 boost::optional<std::string> cpl () const {
126 boost::mutex::scoped_lock lm (_mutex);
130 std::string name () const {
131 boost::mutex::scoped_lock lm (_mutex);
135 bool three_d () const {
136 boost::mutex::scoped_lock lm (_mutex);
141 friend class reels_test5;
143 void add_properties (std::list<UserProperty>& p) const;
145 void read_directory (boost::filesystem::path);
146 std::list<DCPTimePeriod> reels () const;
148 boost::function <bool (boost::shared_ptr<const Content>)>,
149 std::string overlapping,
154 /** true if our DCP is encrypted */
156 /** true if this DCP needs more assets before it can be played */
158 boost::optional<dcp::EncryptedKDM> _kdm;
159 /** true if _kdm successfully decrypts the first frame of our DCP */
161 /** true if the video in this DCP should be included in the output by reference
162 * rather than by rewrapping.
164 bool _reference_video;
165 /** true if the audio in this DCP should be included in the output by reference
166 * rather than by rewrapping.
168 bool _reference_audio;
169 /** true if the captions in this DCP should be included in the output by reference
170 * rather than by rewrapping. The types here are the original caption types,
171 * not what they are being used for.
173 bool _reference_caption[CAPTION_COUNT];
175 boost::optional<dcp::Standard> _standard;
177 /** ID of the CPL to use; older metadata might not specify this: in that case
178 * just use the only CPL.
180 boost::optional<std::string> _cpl;
181 /** List of the lengths of the reels in this DCP */
182 std::list<int64_t> _reel_lengths;