2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
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.
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.
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.
29 class TextNode : public XMLNode
33 TextNode (xmlpp::Node const * node);
38 std::list<boost::shared_ptr<FontNode> > font_nodes;
41 class SubtitleNode : public XMLNode
45 SubtitleNode (xmlpp::Node const * node);
51 std::list<boost::shared_ptr<FontNode> > font_nodes;
52 std::list<boost::shared_ptr<TextNode> > text_nodes;
55 Time fade_time (std::string name);
58 class FontNode : public XMLNode
62 FontNode (xmlpp::Node const * node);
63 FontNode (std::list<boost::shared_ptr<FontNode> > const & font_nodes);
68 boost::optional<bool> italic;
69 boost::optional<Color> color;
70 boost::optional<Effect> effect;
71 boost::optional<Color> effect_color;
73 std::list<boost::shared_ptr<SubtitleNode> > subtitle_nodes;
74 std::list<boost::shared_ptr<FontNode> > font_nodes;
75 std::list<boost::shared_ptr<TextNode> > text_nodes;
78 class LoadFontNode : public XMLNode
82 LoadFontNode (xmlpp::Node const * node);
107 std::string font () const {
111 bool italic () const {
115 Color color () const {
127 std::string text () const {
131 float v_position () const {
135 VAlign v_align () const {
139 Effect effect () const {
143 Color effect_color () const {
144 return _effect_color;
147 Time fade_up_time () const {
148 return _fade_up_time;
151 Time fade_down_time () const {
152 return _fade_down_time;
159 int size_in_pixels (int screen_height) const;
174 Time _fade_down_time;
177 bool operator== (Subtitle const & a, Subtitle const & b);
178 std::ostream& operator<< (std::ostream& s, Subtitle const & sub);
180 class SubtitleAsset : public Asset, public XMLFile
183 SubtitleAsset (std::string directory, std::string xml);
185 void write_to_cpl (std::ostream&) const {}
186 virtual std::list<std::string> equals (boost::shared_ptr<const Asset>, EqualityOptions) const {
188 return std::list<std::string> ();
191 std::string language () const {
195 std::list<boost::shared_ptr<Subtitle> > subtitles_at (Time t) const;
196 std::list<boost::shared_ptr<Subtitle> > const & subtitles () const {
201 std::string font_id_to_name (std::string id) const;
204 std::list<boost::shared_ptr<FontNode> > font_nodes;
205 std::list<boost::shared_ptr<TextNode> > text_nodes;
206 std::list<boost::shared_ptr<SubtitleNode> > subtitle_nodes;
209 void maybe_add_subtitle (std::string text, ParseState const & parse_state);
211 void examine_font_nodes (
212 std::list<boost::shared_ptr<FontNode> > const & font_nodes,
213 ParseState& parse_state
216 void examine_text_nodes (
217 std::list<boost::shared_ptr<TextNode> > const & text_nodes,
218 ParseState& parse_state
221 std::string _subtitle_id;
222 std::string _movie_title;
223 /* strangely, this is sometimes a string */
224 std::string _reel_number;
225 std::string _language;
226 std::list<boost::shared_ptr<LoadFontNode> > _load_font_nodes;
228 std::list<boost::shared_ptr<Subtitle> > _subtitles;