X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fsubtitle_asset.cc;h=866a6d253706401f96746527bf9eec329782ccc0;hb=afeea0415dd56a3106a4c71df2e4a6ccc2d72e74;hp=5decc1e37a7ae485657543a1968be8ae54c42c1e;hpb=8526058d24faec5f83ffd66758fef8d8c8159f73;p=libdcp.git diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index 5decc1e3..866a6d25 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -20,7 +20,9 @@ #include #include #include +#include #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 xml (new cxml::File (xml_file, "DCSubtitle")); + shared_ptr 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 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"); }