Basics of subtitle split.
[dcpomatic.git] / src / lib / text_subtitle_content.h
1 /*
2     Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "content.h"
21
22 class Job;
23
24 class TextSubtitleContentProperty
25 {
26 public:
27         static int const TEXT_SUBTITLE_COLOUR;
28         static int const TEXT_SUBTITLE_OUTLINE;
29         static int const TEXT_SUBTITLE_OUTLINE_COLOUR;
30 };
31
32 /** @class TextSubtitleContent
33  *  @brief SubRip or SSA subtitles.
34  */
35 class TextSubtitleContent : public Content
36 {
37 public:
38         TextSubtitleContent (boost::shared_ptr<const Film>, boost::filesystem::path);
39         TextSubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
40
41         boost::shared_ptr<TextSubtitleContent> shared_from_this () {
42                 return boost::dynamic_pointer_cast<TextSubtitleContent> (Content::shared_from_this ());
43         }
44
45         /* Content */
46         void examine (boost::shared_ptr<Job>);
47         std::string summary () const;
48         std::string technical_summary () const;
49         void as_xml (xmlpp::Node *) const;
50         DCPTime full_length () const;
51
52         /* SubtitleContent */
53
54         bool has_text_subtitles () const {
55                 return true;
56         }
57
58         bool has_image_subtitles () const {
59                 return false;
60         }
61
62         double subtitle_video_frame_rate () const;
63         void set_subtitle_video_frame_rate (double r);
64
65         void set_colour (dcp::Colour);
66
67         dcp::Colour colour () const {
68                 boost::mutex::scoped_lock lm (_mutex);
69                 return _colour;
70         }
71
72         void set_outline (bool);
73
74         bool outline () const {
75                 boost::mutex::scoped_lock lm (_mutex);
76                 return _outline;
77         }
78
79         void set_outline_colour (dcp::Colour);
80
81         dcp::Colour outline_colour () const {
82                 boost::mutex::scoped_lock lm (_mutex);
83                 return _outline_colour;
84         }
85
86         static std::string const font_id;
87
88 private:
89         ContentTime _length;
90         /** Video frame rate that this content has been prepared for, if known */
91         boost::optional<double> _frame_rate;
92         dcp::Colour _colour;
93         bool _outline;
94         dcp::Colour _outline_colour;
95 };