diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-11-26 11:15:02 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-11-26 11:15:02 +0000 |
| commit | d645196b8d6fec1da6c69b28fa9ac2c445a58bd1 (patch) | |
| tree | d430b0a1d85309c28f46c384cbe8b08e9c3c123b | |
| parent | ea629ead13e819b4ff5d5b5eba7b57520e8107e3 (diff) | |
Allow <Subtitle> nodes as the root of subtitles, not just <Font>
| -rw-r--r-- | src/interop_subtitle_asset.cc | 8 | ||||
| -rw-r--r-- | src/smpte_subtitle_asset.cc | 8 | ||||
| -rw-r--r-- | src/subtitle_asset.cc | 7 | ||||
| -rw-r--r-- | src/subtitle_asset.h | 7 |
4 files changed, 26 insertions, 4 deletions
diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index 5777c31a..f450d360 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -58,7 +58,13 @@ InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file) font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, 250, "Id"))); } - parse_subtitles (xml, font_nodes); + f = xml->node_children ("Subtitle"); + list<shared_ptr<dcp::SubtitleNode> > subtitle_nodes; + BOOST_FOREACH (cxml::NodePtr& i, f) { + subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, 250, "Id"))); + } + + parse_subtitles (xml, font_nodes, subtitle_nodes); } InteropSubtitleAsset::InteropSubtitleAsset () diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index 070ade73..165e88e3 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -124,7 +124,13 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file) font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, _time_code_rate, "ID"))); } - parse_subtitles (xml, font_nodes); + f = subtitle_list->node_children ("Subtitle"); + list<shared_ptr<dcp::SubtitleNode> > subtitle_nodes; + BOOST_FOREACH (cxml::NodePtr& i, f) { + subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, _time_code_rate, "ID"))); + } + + parse_subtitles (xml, font_nodes, subtitle_nodes); if (reader) { ASDCP::TimedText::TimedTextDescriptor descriptor; diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index 414825a4..3dcc9ad6 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -59,11 +59,16 @@ SubtitleAsset::SubtitleAsset (boost::filesystem::path file) } void -SubtitleAsset::parse_subtitles (shared_ptr<cxml::Document> xml, list<shared_ptr<dcp::FontNode> > font_nodes) +SubtitleAsset::parse_subtitles ( + shared_ptr<cxml::Document> xml, + list<shared_ptr<dcp::FontNode> > font_nodes, + list<shared_ptr<dcp::SubtitleNode> > subtitle_nodes + ) { /* Make Subtitle objects to represent the raw XML nodes in a sane way */ ParseState parse_state; examine_font_nodes (xml, font_nodes, parse_state); + examine_subtitle_nodes (xml, subtitle_nodes, parse_state); } void diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 8532d6a3..ebd6b745 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -84,7 +84,12 @@ protected: friend struct ::interop_dcp_font_test; friend struct ::smpte_dcp_font_test; - void parse_subtitles (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<FontNode> > font_nodes); + void parse_subtitles ( + boost::shared_ptr<cxml::Document> xml, + std::list<boost::shared_ptr<FontNode> > font_nodes, + std::list<boost::shared_ptr<SubtitleNode> > subtitle_nodes + ); + void subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Standard standard) const; /** All our subtitles, in no particular order */ |
