From d645196b8d6fec1da6c69b28fa9ac2c445a58bd1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 26 Nov 2015 11:15:02 +0000 Subject: Allow nodes as the root of subtitles, not just --- src/interop_subtitle_asset.cc | 8 +++++++- src/smpte_subtitle_asset.cc | 8 +++++++- src/subtitle_asset.cc | 7 ++++++- 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 (new FontNode (i, 250, "Id"))); } - parse_subtitles (xml, font_nodes); + f = xml->node_children ("Subtitle"); + list > subtitle_nodes; + BOOST_FOREACH (cxml::NodePtr& i, f) { + subtitle_nodes.push_back (shared_ptr (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 (new FontNode (i, _time_code_rate, "ID"))); } - parse_subtitles (xml, font_nodes); + f = subtitle_list->node_children ("Subtitle"); + list > subtitle_nodes; + BOOST_FOREACH (cxml::NodePtr& i, f) { + subtitle_nodes.push_back (shared_ptr (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 xml, list > font_nodes) +SubtitleAsset::parse_subtitles ( + shared_ptr xml, + list > font_nodes, + list > 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 xml, std::list > font_nodes); + void parse_subtitles ( + boost::shared_ptr xml, + std::list > font_nodes, + std::list > subtitle_nodes + ); + void subtitles_as_xml (xmlpp::Element* root, int time_code_rate, Standard standard) const; /** All our subtitles, in no particular order */ -- cgit v1.2.3