summaryrefslogtreecommitdiff
path: root/src/lib/types.h
blob: cb6d46369d0578bd5d69ed5f9dd8330c4736b06a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
    Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>

    This file is part of DCP-o-matic.

    DCP-o-matic is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    DCP-o-matic is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.

*/


#ifndef DCPOMATIC_TYPES_H
#define DCPOMATIC_TYPES_H


#include "position.h"
#include "rect.h"
#include <dcp/util.h>
#include <vector>
#include <stdint.h>


class Content;
class VideoContent;
class AudioContent;
class TextContent;
class FFmpegContent;


/** The version number of the protocol used to communicate
 *  with servers.  Intended to be bumped when incompatibilities
 *  are introduced.  v2 uses 64+n
 *
 *  64 - first version used
 *  65 - v2.16.0 - checksums added to communication
 *  66 - v2.17.x - J2KBandwidth -> VideoBitRate in metadata
 */
#define SERVER_LINK_VERSION (64+2)

/** A film of F seconds at f FPS will be Ff frames;
    Consider some delta FPS d, so if we run the same
    film at (f + d) FPS it will last F(f + d) seconds.

    Hence the difference in length over the length of the film will
    be F(f + d) - Ff frames
    = Ff + Fd - Ff frames
    = Fd frames
    = Fd/f seconds

    So if we accept a difference of 1 frame, ie 1/f seconds, we can
    say that

    1/f = Fd/f
    ie 1 = Fd
    ie d = 1/F

    So for a 3hr film, ie F = 3 * 60 * 60 = 10800, the acceptable
    FPS error is 1/F ~= 0.0001 ~= 1e-4
*/
#define VIDEO_FRAME_RATE_EPSILON (1e-4)

/** Port on which EncodeServer listens for frame encoding requests */
#define ENCODE_FRAME_PORT (Config::instance()->server_port_base())
/** Port on which EncodeServer listens for DCPOMATIC_HELLO from masters */
#define HELLO_PORT (Config::instance()->server_port_base()+1)
/** Port on which EncodeServerFinder in the main DCP-o-matic listens for replies to DCPOMATIC_HELLO from servers */
#define MAIN_SERVER_PRESENCE_PORT (Config::instance()->server_port_base()+2)
/** Port on which EncodeServerFinder in the batch converter listens for replies to DCPOMATIC_HELLO from servers */
#define BATCH_SERVER_PRESENCE_PORT (Config::instance()->server_port_base()+3)
/** Port on which batch converter listens for job requests */
#define BATCH_JOB_PORT (Config::instance()->server_port_base()+4)
/** Port on which player listens for play requests */
#define PLAYER_PLAY_PORT (Config::instance()->server_port_base()+5)

typedef std::vector<std::shared_ptr<Content>> ContentList;
typedef std::vector<std::shared_ptr<FFmpegContent>> FFmpegContentList;

typedef int64_t Frame;

enum class Eyes
{
	BOTH,
	LEFT,
	RIGHT,
	COUNT
};

enum class Part
{
	LEFT_HALF,
	RIGHT_HALF,
	TOP_HALF,
	BOTTOM_HALF,
	WHOLE
};

enum class ReelType
{
	SINGLE,
	BY_VIDEO_CONTENT,
	BY_LENGTH,
	CUSTOM
};


std::string reel_type_to_string(ReelType type);
ReelType string_to_reel_type(std::string type);


enum class FileTransferProtocol {
	SCP,
	FTP
};

enum class EmailProtocol {
	AUTO,
	PLAIN,
	STARTTLS,
	SSL
};


#endif