Take DCP-o-matic's version of Data class.
[libdcp.git] / src / interop_subtitle_asset.cc
index c64796126724609cd403dbbb088a6325f7d5faba..4ba24a19595ef45a14e2fdfec0293e9e7fb5ecb0 100644 (file)
@@ -52,13 +52,17 @@ InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file)
        _movie_title = xml->string_child ("MovieTitle");
        _load_font_nodes = type_children<dcp::InteropLoadFontNode> (xml, "LoadFont");
 
-       list<cxml::NodePtr> f = xml->node_children ("Font");
        list<shared_ptr<dcp::FontNode> > font_nodes;
-       BOOST_FOREACH (cxml::NodePtr& i, f) {
-               font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, 250)));
+       BOOST_FOREACH (cxml::NodePtr const & i, xml->node_children ("Font")) {
+               font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, 250, "Id")));
        }
 
-       parse_subtitles (xml, font_nodes);
+       list<shared_ptr<dcp::SubtitleNode> > subtitle_nodes;
+       BOOST_FOREACH (cxml::NodePtr const & i, xml->node_children ("Subtitle")) {
+               subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, 250, "Id")));
+       }
+
+       parse_subtitles (xml, font_nodes, subtitle_nodes);
 }
 
 InteropSubtitleAsset::InteropSubtitleAsset ()
@@ -66,7 +70,7 @@ InteropSubtitleAsset::InteropSubtitleAsset ()
 
 }
 
-Glib::ustring
+string
 InteropSubtitleAsset::xml_as_string () const
 {
        xmlpp::Document doc;
@@ -151,8 +155,9 @@ InteropSubtitleAsset::write (boost::filesystem::path p) const
                throw FileError ("Could not open file for writing", p, -1);
        }
 
-       Glib::ustring const s = xml_as_string ();
-       fwrite (s.c_str(), 1, s.bytes(), f);
+       string const s = xml_as_string ();
+       /* length() here gives bytes not characters */
+       fwrite (s.c_str(), 1, s.length(), f);
        fclose (f);
 
        _file = p;
@@ -168,7 +173,7 @@ InteropSubtitleAsset::write (boost::filesystem::path p) const
                        ++j;
                }
                if (j != _fonts.end ()) {
-                       fwrite (j->data.data.get(), 1, j->data.size, f);
+                       fwrite (j->data.data().get(), 1, j->data.size(), f);
                        j->file = file;
                }
                fclose (f);