X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Finterop_subtitle_asset.cc;h=9951122285b17d51b00808b61e0f54e26d247c9a;hb=refs%2Fheads%2F1.0-templates;hp=97aa1a2c60805fc1779ad57b1b8fea97623b5753;hpb=a641fdc912a3f0749015decdf9e23ff15186ef78;p=libdcp.git diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index 97aa1a2c..99511222 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -15,13 +15,26 @@ You should have received a copy of the GNU General Public License along with libdcp. If not, see . + + In addition, as a special exception, the copyright holders give + permission to link the code of portions of this program with the + OpenSSL library under certain conditions as described in each + individual source file, and distribute linked combinations + including the two. + + You must obey the GNU General Public License in all respects + for all of the code used other than OpenSSL. If you modify + file(s) with this exception, you may extend this exception to your + version of the file(s), but you are not obligated to do so. If you + do not wish to do so, delete this exception statement from your + version. If you delete this exception statement from all source + files in the program, then also delete it here. */ #include "interop_subtitle_asset.h" #include "interop_load_font_node.h" #include "xml.h" #include "raw_convert.h" -#include "font_node.h" #include "util.h" #include "font_asset.h" #include "dcp_assert.h" @@ -52,17 +65,16 @@ InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file) _movie_title = xml->string_child ("MovieTitle"); _load_font_nodes = type_children (xml, "LoadFont"); - list > font_nodes; - BOOST_FOREACH (cxml::NodePtr const & i, xml->node_children ("Font")) { - font_nodes.push_back (shared_ptr (new FontNode (i, 250, "Id"))); - } + /* Now we need to drop down to xmlpp */ - list > subtitle_nodes; - BOOST_FOREACH (cxml::NodePtr const & i, xml->node_children ("Subtitle")) { - subtitle_nodes.push_back (shared_ptr (new SubtitleNode (i, 250, "Id"))); + list ps; + xmlpp::Node::NodeList c = xml->node()->get_children (); + for (xmlpp::Node::NodeList::const_iterator i = c.begin(); i != c.end(); ++i) { + xmlpp::Element const * e = dynamic_cast (*i); + if (e && (e->get_name() == "Font" || e->get_name() == "Subtitle")) { + parse_subtitles (e, ps, optional(), INTEROP); + } } - - parse_subtitles (xml, font_nodes, subtitle_nodes); } InteropSubtitleAsset::InteropSubtitleAsset () @@ -190,8 +202,8 @@ InteropSubtitleAsset::resolve_fonts (list > assets) } BOOST_FOREACH (shared_ptr j, _load_font_nodes) { - if (j->uri == font->file().leaf().string ()) { - _fonts.push_back (Font (j->id, i->id(), font->file ())); + if (font->file() && j->uri == font->file()->leaf().string ()) { + _fonts.push_back (Font (j->id, i->id(), font->file().get())); } } }