Rename TYPE_DEBUG_PLAYER to TYPE_DEBUG_VIDEO_VIEW.
[dcpomatic.git] / src / lib / subtitle_analysis.h
1 /*
2     Copyright (C) 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 #include "rect.h"
22 #include <boost/noncopyable.hpp>
23 #include <boost/filesystem.hpp>
24
25
26 /** @class SubtitleAnalysis
27  *  @brief Class to store the results of a SubtitleAnalysisJob.
28  */
29
30 class SubtitleAnalysis : public boost::noncopyable
31 {
32 public:
33         explicit SubtitleAnalysis (boost::filesystem::path path);
34
35         SubtitleAnalysis (
36                         boost::optional<dcpomatic::Rect<double> > bounding_box,
37                         double analysis_x_offset_,
38                         double analysis_y_offset_
39                         )
40                 : _bounding_box (bounding_box)
41                 , _analysis_x_offset (analysis_x_offset_)
42                 , _analysis_y_offset (analysis_y_offset_)
43         {}
44
45         void write (boost::filesystem::path path) const;
46
47         boost::optional<dcpomatic::Rect<double> > bounding_box () const {
48                 return _bounding_box;
49         }
50
51         double analysis_x_offset () const {
52                 return _analysis_x_offset;
53         }
54
55         double analysis_y_offset () const {
56                 return _analysis_y_offset;
57         }
58
59 private:
60         /** Smallest box which surrounds all subtitles in our content,
61          *  expressed as a proportion of screen size (i.e. 0 is left hand side/top,
62          *  1 is right hand side/bottom), or empty if no subtitles were found.
63          */
64         boost::optional<dcpomatic::Rect<double> > _bounding_box;
65         double _analysis_x_offset;
66         double _analysis_y_offset;
67
68         static int const _current_state_version;
69 };