Missed update to private test repo version.
[dcpomatic.git] / src / lib / frame_rate_change.h
1 /*
2     Copyright (C) 2012-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_FRAME_RATE_CHANGE_H
23 #define DCPOMATIC_FRAME_RATE_CHANGE_H
24
25
26 #include <memory>
27 #include <string>
28
29
30 class Film;
31 class Content;
32
33
34 class FrameRateChange
35 {
36 public:
37         FrameRateChange ();
38         FrameRateChange (double, int);
39         FrameRateChange (std::shared_ptr<const Film> film, std::shared_ptr<const Content> content);
40         FrameRateChange (std::shared_ptr<const Film> film, Content const * content);
41
42         /** @return factor by which to multiply a source frame rate
43             to get the effective rate after any skip or repeat has happened.
44         */
45         double factor () const {
46                 if (skip) {
47                         return 0.5;
48                 }
49
50                 return repeat;
51         }
52
53         double source = 24;
54         int dcp = 24;
55
56         /** true to skip every other frame */
57         bool skip = false;
58         /** number of times to use each frame (e.g. 1 is normal, 2 means repeat each frame once, and so on) */
59         int repeat = 1;
60         /** true if this DCP will run its video faster or slower than the source
61          *  without taking into account `repeat' nor `skip'.
62          *  (e.g. change_speed will be true if
63          *          source is 29.97fps, DCP is 30fps
64          *          source is 14.50fps, DCP is 30fps
65          *  but not if
66          *          source is 15.00fps, DCP is 30fps
67          *          source is 12.50fps, DCP is 25fps)
68          */
69         bool change_speed = false;
70
71         /** Amount by which the video is being sped-up in the DCP; e.g. for a
72          *  24fps source in a 25fps DCP this would be 25/24.
73          */
74         double speed_up = 1.0;
75
76         std::string description () const;
77 };
78
79
80 #endif