X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fsmpte_subtitle_content.cc;h=4435fe23929c0f5ed4c2236b464e42a3e284d583;hb=edf35a7acb05289dc024733efd6e13205def5174;hp=d34c1dbe6b5f9702ae7f31625f913b55a66a466c;hpb=35d8cf6d0e45cb5fff078dd984b492b3c83fa4ee;p=libdcp.git diff --git a/src/smpte_subtitle_content.cc b/src/smpte_subtitle_content.cc index d34c1dbe..4435fe23 100644 --- a/src/smpte_subtitle_content.cc +++ b/src/smpte_subtitle_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,10 +24,12 @@ #include "xml.h" #include "AS_DCP.h" #include "KM_util.h" +#include using std::string; using std::list; using std::stringstream; +using std::cout; using boost::shared_ptr; using namespace dcp; @@ -62,8 +64,31 @@ SMPTESubtitleContent::SMPTESubtitleContent (boost::filesystem::path file, bool m _load_font_nodes = type_children (xml, "LoadFont"); + int tcr = xml->number_child ("TimeCodeRate"); + shared_ptr subtitle_list = xml->optional_node_child ("SubtitleList"); - list > font_nodes = type_children (subtitle_list, "Font"); + + list f = subtitle_list->node_children ("Font"); + list > font_nodes; + BOOST_FOREACH (cxml::NodePtr& i, f) { + font_nodes.push_back (shared_ptr (new Font (i, tcr))); + } parse_common (xml, font_nodes); } + +list > +SMPTESubtitleContent::load_font_nodes () const +{ + list > lf; + copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter (lf)); + return lf; +} + +bool +SMPTESubtitleContent::valid_mxf (boost::filesystem::path file) +{ + ASDCP::TimedText::MXFReader reader; + Kumu::Result_t r = reader.OpenRead (file.string().c_str ()); + return !ASDCP_FAILURE (r); +}