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 "subtitle_string.h"
26 #include <libcxml/cxml.h>
36 /** @class SubtitleContent
37 * @brief A parent for classes representing a file containing subtitles.
39 class SubtitleContent : public Content
43 SubtitleContent (boost::filesystem::path file);
46 boost::shared_ptr<const Asset>,
48 boost::function<void (NoteType, std::string)> note
51 std::string language () const {
55 std::list<SubtitleString> subtitles_at (Time t) const;
56 std::list<SubtitleString> const & subtitles () const {
60 void add (SubtitleString);
62 void write_xml (boost::filesystem::path) const;
63 virtual Glib::ustring xml_as_string () const {
64 /* XXX: this should be pure virtual when SMPTE writing is implemented */
68 Time latest_subtitle_out () const;
71 void parse_common (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<dcp::Font> > font_nodes);
73 std::string pkl_type (Standard) const {
77 std::string asdcp_kind () const {
81 /* strangely, this is sometimes a string */
82 std::string _reel_number;
83 std::string _language;
85 std::list<SubtitleString> _subtitles;
89 std::list<boost::shared_ptr<Font> > font_nodes;
90 std::list<boost::shared_ptr<Text> > text_nodes;
91 std::list<boost::shared_ptr<Subtitle> > subtitle_nodes;
94 void maybe_add_subtitle (std::string text, ParseState const & parse_state);
96 void examine_font_nodes (
97 boost::shared_ptr<const cxml::Node> xml,
98 std::list<boost::shared_ptr<Font> > const & font_nodes,
99 ParseState& parse_state
102 void examine_text_nodes (
103 boost::shared_ptr<const cxml::Node> xml,
104 std::list<boost::shared_ptr<Text> > const & text_nodes,
105 ParseState& parse_state