diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/interop_subtitle_asset.cc | 2 | ||||
| -rw-r--r-- | src/smpte_subtitle_asset.cc | 11 | ||||
| -rw-r--r-- | src/subtitle_asset.h | 7 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index d250b752..39521ed7 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -61,6 +61,8 @@ using namespace dcp; InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file) : SubtitleAsset (file) { + _raw_xml = dcp::file_to_string (file); + shared_ptr<cxml::Document> xml (new cxml::Document ("DCSubtitle")); xml->read_file (file); _id = xml->string_child ("SubtitleID"); diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index 33a0c943..81a0aa6f 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -94,15 +94,15 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file) _id = read_writer_info (info); if (!_key_id) { /* Not encrypted; read it in now */ - string s; - reader->ReadTimedTextResource (s); - xml->read_string (s); + reader->ReadTimedTextResource (_raw_xml); + xml->read_string (_raw_xml); parse_xml (xml); read_mxf_descriptor (reader, shared_ptr<DecryptionContext> (new DecryptionContext (optional<Key>(), SMPTE))); } } else { /* Plain XML */ try { + _raw_xml = dcp::file_to_string (file); xml.reset (new cxml::Document ("SubtitleReel")); xml->read_file (file); parse_xml (xml); @@ -278,11 +278,10 @@ SMPTESubtitleAsset::set_key (Key key) ); } - string s; shared_ptr<DecryptionContext> dec (new DecryptionContext (key, SMPTE)); - reader->ReadTimedTextResource (s, dec->context(), dec->hmac()); + reader->ReadTimedTextResource (_raw_xml, dec->context(), dec->hmac()); shared_ptr<cxml::Document> xml (new cxml::Document ("SubtitleReel")); - xml->read_string (s); + xml->read_string (_raw_xml); parse_xml (xml); read_mxf_descriptor (reader, dec); } diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 9792ce05..fd233cc8 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -105,6 +105,10 @@ public: virtual std::list<boost::shared_ptr<LoadFontNode> > load_font_nodes () const = 0; + std::string raw_xml () const { + return _raw_xml; + } + protected: friend struct ::interop_dcp_font_test; friend struct ::smpte_dcp_font_test; @@ -174,6 +178,9 @@ protected: /** TTF font data that we need */ std::list<Font> _fonts; + /** The raw XML data that we read from our asset; useful for validation */ + std::string _raw_xml; + private: friend struct ::pull_fonts_test1; friend struct ::pull_fonts_test2; |
