X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fsubtitle_asset.h;h=4ef0794e7677a8cf245f4d6b5536caa51ef3274c;hb=127c14300f1d2df9fc2b9dd4ffb5218ea6a717c3;hp=1b834522abff14126c6597143e19208b4d677c55;hpb=af9b2212f0d8f8c1f53aaf29e520b812dfdc321c;p=libdcp.git diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 1b834522..4ef0794e 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -17,73 +17,20 @@ */ +#include #include "asset.h" -#include "xml.h" #include "dcp_time.h" namespace libdcp { -class FontNode; - -class TextNode : public XMLNode -{ -public: - TextNode () {} - TextNode (xmlpp::Node const * node); - - float v_position; - VAlign v_align; - std::string text; - std::list > font_nodes; -}; - -class SubtitleNode : public XMLNode -{ -public: - SubtitleNode () {} - SubtitleNode (xmlpp::Node const * node); - - Time in; - Time out; - Time fade_up_time; - Time fade_down_time; - std::list > font_nodes; - std::list > text_nodes; - -private: - Time fade_time (std::string name); -}; - -class FontNode : public XMLNode +namespace parse { -public: - FontNode () {} - FontNode (xmlpp::Node const * node); - FontNode (std::list > const & font_nodes); - - std::string text; - std::string id; - int size; - boost::optional italic; - boost::optional color; - boost::optional effect; - boost::optional effect_color; - - std::list > subtitle_nodes; - std::list > font_nodes; - std::list > text_nodes; -}; - -class LoadFontNode : public XMLNode -{ -public: - LoadFontNode () {} - LoadFontNode (xmlpp::Node const * node); - - std::string id; - std::string uri; -}; + class Font; + class Text; + class Subtitle; + class LoadFont; +} class Subtitle { @@ -183,10 +130,10 @@ public: SubtitleAsset (std::string directory, std::string xml_file); SubtitleAsset (std::string directory, std::string movie_title, std::string language); - void write_to_cpl (std::ostream&) const; - virtual bool equals (boost::shared_ptr, EqualityOptions, std::list& notes) const { + void write_to_cpl (xmlpp::Element *, bool) const; + virtual bool equals (boost::shared_ptr, EqualityOptions, boost::function note) const { /* XXX */ - notes.push_back ("subtitle assets not compared yet"); + note (ERROR, "subtitle assets not compared yet"); return true; } @@ -201,28 +148,30 @@ public: void add (boost::shared_ptr); - void write_xml (); + void read_xml (std::string); + void write_xml () const; + void write_xml (std::ostream &) const; private: std::string font_id_to_name (std::string id) const; struct ParseState { - std::list > font_nodes; - std::list > text_nodes; - std::list > subtitle_nodes; + std::list > font_nodes; + std::list > text_nodes; + std::list > subtitle_nodes; }; void maybe_add_subtitle (std::string text, ParseState const & parse_state); void examine_font_nodes ( - boost::shared_ptr xml, - std::list > const & font_nodes, + boost::shared_ptr xml, + std::list > const & font_nodes, ParseState& parse_state ); void examine_text_nodes ( - boost::shared_ptr xml, - std::list > const & text_nodes, + boost::shared_ptr xml, + std::list > const & text_nodes, ParseState& parse_state ); @@ -230,9 +179,10 @@ private: /* strangely, this is sometimes a string */ std::string _reel_number; std::string _language; - std::list > _load_font_nodes; + std::list > _load_font_nodes; std::list > _subtitles; + bool _need_sort; }; }