Supporters update.
[dcpomatic.git] / src / lib / types.h
1 /*
2     Copyright (C) 2013-2021 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
22 #ifndef DCPOMATIC_TYPES_H
23 #define DCPOMATIC_TYPES_H
24
25
26 #include "position.h"
27 #include "rect.h"
28 #include <dcp/util.h>
29 #include <vector>
30 #include <stdint.h>
31
32
33 class Content;
34 class VideoContent;
35 class AudioContent;
36 class TextContent;
37 class FFmpegContent;
38
39
40 /** The version number of the protocol used to communicate
41  *  with servers.  Intended to be bumped when incompatibilities
42  *  are introduced.  v2 uses 64+n
43  *
44  *  64 - first version used
45  *  65 - v2.16.0 - checksums added to communication
46  */
47 #define SERVER_LINK_VERSION (64+1)
48
49 /** A film of F seconds at f FPS will be Ff frames;
50     Consider some delta FPS d, so if we run the same
51     film at (f + d) FPS it will last F(f + d) seconds.
52
53     Hence the difference in length over the length of the film will
54     be F(f + d) - Ff frames
55     = Ff + Fd - Ff frames
56     = Fd frames
57     = Fd/f seconds
58
59     So if we accept a difference of 1 frame, ie 1/f seconds, we can
60     say that
61
62     1/f = Fd/f
63     ie 1 = Fd
64     ie d = 1/F
65
66     So for a 3hr film, ie F = 3 * 60 * 60 = 10800, the acceptable
67     FPS error is 1/F ~= 0.0001 ~= 1e-4
68 */
69 #define VIDEO_FRAME_RATE_EPSILON (1e-4)
70
71 /** Port on which EncodeServer listens for frame encoding requests */
72 #define ENCODE_FRAME_PORT (Config::instance()->server_port_base())
73 /** Port on which EncodeServer listens for DCPOMATIC_HELLO from masters */
74 #define HELLO_PORT (Config::instance()->server_port_base()+1)
75 /** Port on which EncodeServerFinder in the main DCP-o-matic listens for replies to DCPOMATIC_HELLO from servers */
76 #define MAIN_SERVER_PRESENCE_PORT (Config::instance()->server_port_base()+2)
77 /** Port on which EncodeServerFinder in the batch converter listens for replies to DCPOMATIC_HELLO from servers */
78 #define BATCH_SERVER_PRESENCE_PORT (Config::instance()->server_port_base()+3)
79 /** Port on which batch converter listens for job requests */
80 #define BATCH_JOB_PORT (Config::instance()->server_port_base()+4)
81 /** Port on which player listens for play requests */
82 #define PLAYER_PLAY_PORT (Config::instance()->server_port_base()+5)
83
84 typedef std::vector<std::shared_ptr<Content>> ContentList;
85 typedef std::vector<std::shared_ptr<FFmpegContent>> FFmpegContentList;
86
87 typedef int64_t Frame;
88
89 enum class Eyes
90 {
91         BOTH,
92         LEFT,
93         RIGHT,
94         COUNT
95 };
96
97 enum class Part
98 {
99         LEFT_HALF,
100         RIGHT_HALF,
101         TOP_HALF,
102         BOTTOM_HALF,
103         WHOLE
104 };
105
106 enum class ReelType
107 {
108         SINGLE,
109         BY_VIDEO_CONTENT,
110         BY_LENGTH
111 };
112
113
114 struct CPLSummary
115 {
116         CPLSummary (boost::filesystem::path p);
117
118         CPLSummary (std::string d, std::string i, std::string a, boost::filesystem::path f, bool e, time_t t)
119                 : dcp_directory (d)
120                 , cpl_id (i)
121                 , cpl_annotation_text (a)
122                 , cpl_file (f)
123                 , encrypted (e)
124                 , last_write_time (t)
125         {}
126
127         std::string dcp_directory;
128         std::string cpl_id;
129         boost::optional<std::string> cpl_annotation_text;
130         boost::filesystem::path cpl_file;
131         /** true if this CPL has any encrypted assets */
132         bool encrypted;
133         time_t last_write_time;
134 };
135
136 enum class FileTransferProtocol {
137         SCP,
138         FTP
139 };
140
141 enum class EmailProtocol {
142         AUTO,
143         PLAIN,
144         STARTTLS,
145         SSL
146 };
147
148
149 #endif