Rename TYPE_DEBUG_PLAYER to TYPE_DEBUG_VIDEO_VIEW.
[dcpomatic.git] / src / lib / dcp_examiner.h
1 /*
2     Copyright (C) 2014-2020 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 /** @file  src/lib/dcp_examiner.h
22  *  @brief DCPExaminer class.
23  */
24
25 #include "video_examiner.h"
26 #include "audio_examiner.h"
27 #include "dcp.h"
28 #include <dcp/dcp_time.h>
29
30 class DCPContent;
31
32 class DCPExaminer : public DCP, public VideoExaminer, public AudioExaminer
33 {
34 public:
35         explicit DCPExaminer (boost::shared_ptr<const DCPContent>, bool tolerant);
36
37         bool has_video () const {
38                 return _has_video;
39         }
40
41         boost::optional<double> video_frame_rate () const {
42                 return _video_frame_rate;
43         }
44
45         dcp::Size video_size () const {
46                 DCPOMATIC_ASSERT (_has_video);
47                 DCPOMATIC_ASSERT (_video_size);
48                 return *_video_size;
49         }
50
51         Frame video_length () const {
52                 return _video_length;
53         }
54
55         bool yuv () const {
56                 return false;
57         }
58
59         VideoRange range () const {
60                 return VIDEO_RANGE_FULL;
61         }
62
63         std::string name () const {
64                 return _name;
65         }
66
67         bool encrypted () const {
68                 return _encrypted;
69         }
70
71         bool needs_assets () const {
72                 return _needs_assets;
73         }
74
75         bool has_audio () const {
76                 return _has_audio;
77         }
78
79         int audio_channels () const {
80                 return _audio_channels.get_value_or (0);
81         }
82
83         Frame audio_length () const {
84                 return _audio_length;
85         }
86
87         int audio_frame_rate () const {
88                 return _audio_frame_rate.get_value_or (48000);
89         }
90
91         /** @param type TEXT_OPEN_SUBTITLE or TEXT_CLOSED_CAPTION.
92          *  @return Number of assets of this type in this DCP.
93          */
94         int text_count (TextType type) const {
95                 return _text_count[type];
96         }
97
98         bool kdm_valid () const {
99                 return _kdm_valid;
100         }
101
102         boost::optional<dcp::Standard> standard () const {
103                 return _standard;
104         }
105
106         bool three_d () const {
107                 return _three_d;
108         }
109
110         dcp::ContentKind content_kind () const {
111                 return _content_kind;
112         }
113
114         std::string cpl () const {
115                 return _cpl;
116         }
117
118         std::list<int64_t> reel_lengths () const {
119                 return _reel_lengths;
120         }
121
122         std::map<dcp::Marker, dcp::Time> markers () const {
123                 return _markers;
124         }
125
126         std::vector<dcp::Rating> ratings () const {
127                 return _ratings;
128         }
129
130         std::string content_version () const {
131                 return _content_version;
132         }
133
134 private:
135         boost::optional<double> _video_frame_rate;
136         boost::optional<dcp::Size> _video_size;
137         Frame _video_length;
138         boost::optional<int> _audio_channels;
139         boost::optional<int> _audio_frame_rate;
140         Frame _audio_length;
141         std::string _name;
142         /** true if this DCP has video content (but false if it has unresolved references to video content) */
143         bool _has_video;
144         /** true if this DCP has audio content (but false if it has unresolved references to audio content) */
145         bool _has_audio;
146         /** number of different assets of each type (OCAP/CCAP) */
147         int _text_count[TEXT_COUNT];
148         bool _encrypted;
149         bool _needs_assets;
150         bool _kdm_valid;
151         boost::optional<dcp::Standard> _standard;
152         bool _three_d;
153         dcp::ContentKind _content_kind;
154         std::string _cpl;
155         std::list<int64_t> _reel_lengths;
156         std::map<dcp::Marker, dcp::Time> _markers;
157         std::vector<dcp::Rating> _ratings;
158         std::string _content_version;
159 };