2 Copyright (C) 2013-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_TYPES_H
22 #define DCPOMATIC_TYPES_H
27 #include <boost/shared_ptr.hpp>
34 class SubtitleContent;
45 /** The version number of the protocol used to communicate
46 * with servers. Intended to be bumped when incompatibilities
47 * are introduced. v2 uses 64+n
49 #define SERVER_LINK_VERSION (64+0)
51 /** A film of F seconds at f FPS will be Ff frames;
52 Consider some delta FPS d, so if we run the same
53 film at (f + d) FPS it will last F(f + d) seconds.
55 Hence the difference in length over the length of the film will
56 be F(f + d) - Ff frames
61 So if we accept a difference of 1 frame, ie 1/f seconds, we can
68 So for a 3hr film, ie F = 3 * 60 * 60 = 10800, the acceptable
69 FPS error is 1/F ~= 0.0001 ~= 1e-4
71 #define VIDEO_FRAME_RATE_EPSILON (1e-4)
73 typedef std::vector<boost::shared_ptr<Content> > ContentList;
74 typedef std::vector<boost::shared_ptr<FFmpegContent> > FFmpegContentList;
76 typedef int64_t Frame;
81 VIDEO_FRAME_TYPE_3D_LEFT_RIGHT,
82 VIDEO_FRAME_TYPE_3D_TOP_BOTTOM,
83 VIDEO_FRAME_TYPE_3D_ALTERNATE,
84 /** This content is all the left frames of some 3D */
85 VIDEO_FRAME_TYPE_3D_LEFT,
86 /** This content is all the right frames of some 3D */
87 VIDEO_FRAME_TYPE_3D_RIGHT
110 REELTYPE_BY_VIDEO_CONTENT,
115 * @brief A description of the crop of an image or video.
119 Crop () : left (0), right (0), top (0), bottom (0) {}
120 Crop (int l, int r, int t, int b) : left (l), right (r), top (t), bottom (b) {}
121 Crop (boost::shared_ptr<cxml::Node>);
123 /** Number of pixels to remove from the left-hand side */
125 /** Number of pixels to remove from the right-hand side */
127 /** Number of pixels to remove from the top */
129 /** Number of pixels to remove from the bottom */
132 dcp::Size apply (dcp::Size s, int minimum = 4) const {
133 s.width -= left + right;
134 s.height -= top + bottom;
136 if (s.width < minimum) {
140 if (s.height < minimum) {
147 void as_xml (xmlpp::Node *) const;
152 CPLSummary (std::string d, std::string i, std::string a, boost::filesystem::path f)
155 , cpl_annotation_text (a)
159 std::string dcp_directory;
161 std::string cpl_annotation_text;
162 boost::filesystem::path cpl_file;
165 extern bool operator== (Crop const & a, Crop const & b);
166 extern bool operator!= (Crop const & a, Crop const & b);
173 std::string resolution_to_string (Resolution);
174 Resolution string_to_resolution (std::string);