Support new libdcp with subtitle direction.
[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 /** @class TextSubtitleContent
31  *  @brief SubRip or SSA subtitles.
32  */
33 class TextSubtitleContent : public SubtitleContent
34 {
35 public:
36         TextSubtitleContent (boost::shared_ptr<const Film>, boost::filesystem::path);
37         TextSubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
38
39         boost::shared_ptr<TextSubtitleContent> shared_from_this () {
40                 return boost::dynamic_pointer_cast<TextSubtitleContent> (Content::shared_from_this ());
41         }
42
43         /* Content */
44         void examine (boost::shared_ptr<Job>);
45         std::string summary () const;
46         std::string technical_summary () const;
47         void as_xml (xmlpp::Node *) const;
48         DCPTime full_length () const;
49
50         /* SubtitleContent */
51
52         bool has_text_subtitles () const {
53                 return true;
54         }
55
56         bool has_image_subtitles () const {
57                 return false;
58         }
59
60         double subtitle_video_frame_rate () const;
61         void set_subtitle_video_frame_rate (int r);
62
63         void set_colour (dcp::Colour);
64
65         dcp::Colour colour () const {
66                 boost::mutex::scoped_lock lm (_mutex);
67                 return _colour;
68         }
69
70         void set_outline (bool);
71
72         bool outline () const {
73                 boost::mutex::scoped_lock lm (_mutex);
74                 return _outline;
75         }
76
77         void set_outline_colour (dcp::Colour);
78
79         dcp::Colour outline_colour () const {
80                 boost::mutex::scoped_lock lm (_mutex);
81                 return _outline_colour;
82         }
83
84         static std::string const font_id;
85
86 private:
87         ContentTime _length;
88         /** Video frame rate that this content has been prepared for, if known */
89         boost::optional<double> _frame_rate;
90         dcp::Colour _colour;
91         bool _outline;
92         dcp::Colour _outline_colour;
93 };