2 Copyright (C) 2020-2021 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/>.
23 #include <boost/filesystem.hpp>
26 /** @class SubtitleAnalysis
27 * @brief Class to store the results of a SubtitleAnalysisJob.
29 class SubtitleAnalysis
32 explicit SubtitleAnalysis (boost::filesystem::path path);
35 boost::optional<dcpomatic::Rect<double>> bounding_box,
36 double analysis_x_offset_,
37 double analysis_y_offset_
39 : _bounding_box (bounding_box)
40 , _analysis_x_offset (analysis_x_offset_)
41 , _analysis_y_offset (analysis_y_offset_)
44 SubtitleAnalysis (SubtitleAnalysis const&) = delete;
45 SubtitleAnalysis& operator= (SubtitleAnalysis const&) = delete;
47 void write (boost::filesystem::path path) const;
49 boost::optional<dcpomatic::Rect<double>> bounding_box () const {
53 double analysis_x_offset () const {
54 return _analysis_x_offset;
57 double analysis_y_offset () const {
58 return _analysis_y_offset;
62 /** Smallest box which surrounds all subtitles in our content,
63 * expressed as a proportion of screen size (i.e. 0 is left hand side/top,
64 * 1 is right hand side/bottom), or empty if no subtitles were found.
66 boost::optional<dcpomatic::Rect<double>> _bounding_box;
67 double _analysis_x_offset;
68 double _analysis_y_offset;
70 static int const _current_state_version;