Comments.
[libdcp.git] / src / subtitle_asset.cc
index 5decc1e37a7ae485657543a1968be8ae54c42c1e..866a6d253706401f96746527bf9eec329782ccc0 100644 (file)
@@ -20,7 +20,9 @@
 #include <fstream>
 #include <boost/lexical_cast.hpp>
 #include <boost/algorithm/string.hpp>
+#include <libxml++/nodes/element.h>
 #include "subtitle_asset.h"
+#include "parse/subtitle.h"
 #include "util.h"
 #include "xml.h"
 
@@ -54,7 +56,8 @@ SubtitleAsset::SubtitleAsset (string directory, string movie_title, string langu
 void
 SubtitleAsset::read_xml (string xml_file)
 {
-       shared_ptr<cxml::File> xml (new cxml::File (xml_file, "DCSubtitle"));
+       shared_ptr<cxml::Document> xml (new cxml::Document ("DCSubtitle"));
+       xml->read_file (xml_file);
        
        _uuid = xml->string_child ("SubtitleID");
        _movie_title = xml->string_child ("MovieTitle");
@@ -276,7 +279,7 @@ SubtitleAsset::add (shared_ptr<Subtitle> s)
 }
 
 void
-SubtitleAsset::write_to_cpl (xmlpp::Node* node) const
+SubtitleAsset::write_to_cpl (xmlpp::Element* node, bool) const
 {
        /* XXX: should EditRate, Duration and IntrinsicDuration be in here? */
 
@@ -386,7 +389,7 @@ SubtitleAsset::write_xml (ostream& s) const
                        font->set_attribute ("Weight", "normal");
                }
 
-               if (!subtitle ||
+               if (!subtitle || font_changed ||
                    (last_in != (*i)->in() ||
                     last_out != (*i)->out() ||
                     last_fade_up_time != (*i)->fade_up_time() ||
@@ -412,6 +415,6 @@ SubtitleAsset::write_xml (ostream& s) const
                text->add_child_text ((*i)->text());
        }
 
-       doc.write_to_stream_formatted (s);
+       doc.write_to_stream_formatted (s, "UTF-8");
 }