No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / lib / dcp_content.h
1 /*
2     Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21 #ifndef DCPOMATIC_DCP_CONTENT_H
22 #define DCPOMATIC_DCP_CONTENT_H
23
24 /** @file  src/lib/dcp_content.h
25  *  @brief DCPContent class.
26  */
27
28 #include "content.h"
29 #include <libcxml/cxml.h>
30 #include <dcp/encrypted_kdm.h>
31
32 class DCPContentProperty
33 {
34 public:
35         static int const CAN_BE_PLAYED;
36         static int const REFERENCE_VIDEO;
37         static int const REFERENCE_AUDIO;
38         static int const REFERENCE_SUBTITLE;
39 };
40
41 class ContentPart;
42
43 /** @class DCPContent
44  *  @brief An existing DCP used as input.
45  */
46 class DCPContent : public Content
47 {
48 public:
49         DCPContent (boost::shared_ptr<const Film>, boost::filesystem::path p);
50         DCPContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version);
51
52         boost::shared_ptr<DCPContent> shared_from_this () {
53                 return boost::dynamic_pointer_cast<DCPContent> (Content::shared_from_this ());
54         }
55
56         boost::shared_ptr<const DCPContent> shared_from_this () const {
57                 return boost::dynamic_pointer_cast<const DCPContent> (Content::shared_from_this ());
58         }
59
60         DCPTime full_length () const;
61
62         void examine (boost::shared_ptr<Job>);
63         std::string summary () const;
64         std::string technical_summary () const;
65         void as_xml (xmlpp::Node *) const;
66         std::string identifier () const;
67
68         void set_default_colour_conversion ();
69         std::list<DCPTime> reel_split_points () const;
70
71         boost::filesystem::path directory () const;
72
73         bool encrypted () const {
74                 boost::mutex::scoped_lock lm (_mutex);
75                 return _encrypted;
76         }
77
78         void add_kdm (dcp::EncryptedKDM);
79
80         boost::optional<dcp::EncryptedKDM> kdm () const {
81                 return _kdm;
82         }
83
84         bool can_be_played () const;
85
86         void set_reference_video (bool r);
87
88         bool reference_video () const {
89                 boost::mutex::scoped_lock lm (_mutex);
90                 return _reference_video;
91         }
92
93         bool can_reference_video (std::list<std::string> &) const;
94
95         void set_reference_audio (bool r);
96
97         bool reference_audio () const {
98                 boost::mutex::scoped_lock lm (_mutex);
99                 return _reference_audio;
100         }
101
102         bool can_reference_audio (std::list<std::string> &) const;
103
104         void set_reference_subtitle (bool r);
105
106         bool reference_subtitle () const {
107                 boost::mutex::scoped_lock lm (_mutex);
108                 return _reference_subtitle;
109         }
110
111         bool can_reference_subtitle (std::list<std::string> &) const;
112
113 private:
114         void add_properties (std::list<UserProperty>& p) const;
115
116         void read_directory (boost::filesystem::path);
117         std::list<DCPTimePeriod> reels () const;
118         bool can_reference (
119                 boost::function <boost::shared_ptr<ContentPart> (boost::shared_ptr<const Content>)>,
120                 std::string overlapping,
121                 std::list<std::string>& why_not
122                 ) const;
123
124         std::string _name;
125         /** true if our DCP is encrypted */
126         bool _encrypted;
127         boost::optional<dcp::EncryptedKDM> _kdm;
128         /** true if _kdm successfully decrypts the first frame of our DCP */
129         bool _kdm_valid;
130         /** true if the video in this DCP should be included in the output by reference
131          *  rather than by rewrapping.
132          */
133         bool _reference_video;
134         /** true if the audio in this DCP should be included in the output by reference
135          *  rather than by rewrapping.
136          */
137         bool _reference_audio;
138         /** true if the subtitle in this DCP should be included in the output by reference
139          *  rather than by rewrapping.
140          */
141         bool _reference_subtitle;
142
143         boost::optional<dcp::Standard> _standard;
144 };
145
146 #endif