2 Copyright (C) 2014-2016 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_SUBTITLE;
45 * @brief An existing DCP used as input.
47 class DCPContent : public Content
50 DCPContent (boost::shared_ptr<const Film>, boost::filesystem::path p);
51 DCPContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version);
53 boost::shared_ptr<DCPContent> shared_from_this () {
54 return boost::dynamic_pointer_cast<DCPContent> (Content::shared_from_this ());
57 boost::shared_ptr<const DCPContent> shared_from_this () const {
58 return boost::dynamic_pointer_cast<const DCPContent> (Content::shared_from_this ());
61 DCPTime full_length () const;
63 void examine (boost::shared_ptr<Job>);
64 std::string summary () const;
65 std::string technical_summary () const;
66 void as_xml (xmlpp::Node *, bool with_paths) const;
67 std::string identifier () const;
68 void use_template (boost::shared_ptr<const Content> c);
70 void set_default_colour_conversion ();
71 std::list<DCPTime> reel_split_points () const;
73 std::vector<boost::filesystem::path> directories () const;
75 bool encrypted () const {
76 boost::mutex::scoped_lock lm (_mutex);
80 void add_kdm (dcp::EncryptedKDM);
81 void add_ov (boost::filesystem::path ov);
83 boost::optional<dcp::EncryptedKDM> kdm () const {
87 bool can_be_played () const;
88 bool needs_kdm () const;
89 bool needs_assets () const;
91 void set_reference_video (bool r);
93 bool reference_video () const {
94 boost::mutex::scoped_lock lm (_mutex);
95 return _reference_video;
98 bool can_reference_video (std::list<std::string> &) const;
100 void set_reference_audio (bool r);
102 bool reference_audio () const {
103 boost::mutex::scoped_lock lm (_mutex);
104 return _reference_audio;
107 bool can_reference_audio (std::list<std::string> &) const;
109 void set_reference_subtitle (bool r);
111 bool reference_subtitle () const {
112 boost::mutex::scoped_lock lm (_mutex);
113 return _reference_subtitle;
116 bool can_reference_subtitle (std::list<std::string> &) const;
118 boost::optional<std::string> cpl () const {
119 boost::mutex::scoped_lock lm (_mutex);
124 friend class reels_test5;
126 void add_properties (std::list<UserProperty>& p) const;
128 void read_directory (boost::filesystem::path);
129 std::list<DCPTimePeriod> reels () const;
131 boost::function <boost::shared_ptr<ContentPart> (boost::shared_ptr<const Content>)>,
132 std::string overlapping,
133 std::list<std::string>& why_not
137 /** true if our DCP is encrypted */
139 /** true if this DCP needs more assets before it can be played */
141 boost::optional<dcp::EncryptedKDM> _kdm;
142 /** true if _kdm successfully decrypts the first frame of our DCP */
144 /** true if the video in this DCP should be included in the output by reference
145 * rather than by rewrapping.
147 bool _reference_video;
148 /** true if the audio in this DCP should be included in the output by reference
149 * rather than by rewrapping.
151 bool _reference_audio;
152 /** true if the subtitle in this DCP should be included in the output by reference
153 * rather than by rewrapping.
155 bool _reference_subtitle;
157 boost::optional<dcp::Standard> _standard;
159 /** ID of the CPL to use; older metadata might not specify this: in that case
160 * just use the only CPL.
162 boost::optional<std::string> _cpl;