2 Copyright (C) 2012-2014 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.
20 #ifndef LIBDCP_SUBTITLE_CONTENT_H
21 #define LIBDCP_SUBTITLE_CONTENT_H
25 #include <libcxml/cxml.h>
36 /** @class SubtitleContent
37 * @brief A representation of an XML file containing subtitles.
39 class SubtitleContent : public Content
42 SubtitleContent (boost::filesystem::path file);
43 SubtitleContent (Fraction edit_rate, std::string movie_title, std::string language);
46 boost::shared_ptr<const Content>,
48 boost::function<void (NoteType, std::string)> note
51 note (ERROR, "subtitle content not compared yet");
55 std::string language () const {
59 std::list<boost::shared_ptr<SubtitleString> > subtitles_at (Time t) const;
60 std::list<boost::shared_ptr<SubtitleString> > const & subtitles () const {
64 void add (boost::shared_ptr<SubtitleString>);
66 void write_xml () const;
67 Glib::ustring xml_as_string () const;
70 std::string pkl_type () const {
75 std::string font_id_to_name (std::string id) const;
78 std::list<boost::shared_ptr<Font> > font_nodes;
79 std::list<boost::shared_ptr<Text> > text_nodes;
80 std::list<boost::shared_ptr<Subtitle> > subtitle_nodes;
83 void maybe_add_subtitle (std::string text, ParseState const & parse_state);
85 void examine_font_nodes (
86 boost::shared_ptr<const cxml::Node> xml,
87 std::list<boost::shared_ptr<Font> > const & font_nodes,
88 ParseState& parse_state
91 void examine_text_nodes (
92 boost::shared_ptr<const cxml::Node> xml,
93 std::list<boost::shared_ptr<Text> > const & text_nodes,
94 ParseState& parse_state
97 std::string _movie_title;
98 /* strangely, this is sometimes a string */
99 std::string _reel_number;
100 std::string _language;
101 std::list<boost::shared_ptr<LoadFont> > _load_font_nodes;
103 std::list<boost::shared_ptr<SubtitleString> > _subtitles;