Rename SubRip -> TextSubtitle.
[dcpomatic.git] / src / lib / text_subtitle_content.h
1 /*
2     Copyright (C) 2014-2015 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 "subtitle_content.h"
21
22 class TextSubtitleContentProperty
23 {
24 public:
25         static int const TEXT_SUBTITLE_COLOUR;
26         static int const TEXT_SUBTITLE_OUTLINE;
27         static int const TEXT_SUBTITLE_OUTLINE_COLOUR;
28 };
29
30
31 class TextSubtitleContent : public SubtitleContent
32 {
33 public:
34         TextSubtitleContent (boost::shared_ptr<const Film>, boost::filesystem::path);
35         TextSubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
36
37         boost::shared_ptr<TextSubtitleContent> shared_from_this () {
38                 return boost::dynamic_pointer_cast<TextSubtitleContent> (Content::shared_from_this ());
39         }
40
41         /* Content */
42         void examine (boost::shared_ptr<Job>);
43         std::string summary () const;
44         std::string technical_summary () const;
45         void as_xml (xmlpp::Node *) const;
46         DCPTime full_length () const;
47
48         /* SubtitleContent */
49
50         bool has_text_subtitles () const {
51                 return true;
52         }
53
54         bool has_image_subtitles () const {
55                 return false;
56         }
57
58         double subtitle_video_frame_rate () const;
59         void set_subtitle_video_frame_rate (int r);
60
61         void set_colour (dcp::Colour);
62
63         dcp::Colour colour () const {
64                 boost::mutex::scoped_lock lm (_mutex);
65                 return _colour;
66         }
67
68         void set_outline (bool);
69
70         bool outline () const {
71                 boost::mutex::scoped_lock lm (_mutex);
72                 return _outline;
73         }
74
75         void set_outline_colour (dcp::Colour);
76
77         dcp::Colour outline_colour () const {
78                 boost::mutex::scoped_lock lm (_mutex);
79                 return _outline_colour;
80         }
81
82         static std::string const font_id;
83
84 private:
85         ContentTime _length;
86         /** Video frame rate that this content has been prepared for, if known */
87         boost::optional<double> _frame_rate;
88         dcp::Colour _colour;
89         bool _outline;
90         dcp::Colour _outline_colour;
91 };