2 Copyright (C) 2020 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/>.
22 #include <boost/noncopyable.hpp>
23 #include <boost/filesystem.hpp>
26 /** @class SubtitleAnalysis
27 * @brief Class to store the results of a SubtitleAnalysisJob.
30 class SubtitleAnalysis : public boost::noncopyable
33 explicit SubtitleAnalysis (boost::filesystem::path path);
36 boost::optional<dcpomatic::Rect<double> > bounding_box,
37 double analysis_x_offset_,
38 double analysis_y_offset_
40 : _bounding_box (bounding_box)
41 , _analysis_x_offset (analysis_x_offset_)
42 , _analysis_y_offset (analysis_y_offset_)
45 void write (boost::filesystem::path path) const;
47 boost::optional<dcpomatic::Rect<double> > bounding_box () const {
51 double analysis_x_offset () const {
52 return _analysis_x_offset;
55 double analysis_y_offset () const {
56 return _analysis_y_offset;
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.
64 boost::optional<dcpomatic::Rect<double> > _bounding_box;
65 double _analysis_x_offset;
66 double _analysis_y_offset;
68 static int const _current_state_version;