summaryrefslogtreecommitdiff
path: root/src/smpte_subtitle_content.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/smpte_subtitle_content.cc')
-rw-r--r--src/smpte_subtitle_content.cc40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/smpte_subtitle_content.cc b/src/smpte_subtitle_content.cc
index 1fa94d1c..d34c1dbe 100644
--- a/src/smpte_subtitle_content.cc
+++ b/src/smpte_subtitle_content.cc
@@ -31,29 +31,35 @@ using std::stringstream;
using boost::shared_ptr;
using namespace dcp;
-SMPTESubtitleContent::SMPTESubtitleContent (boost::filesystem::path file)
+SMPTESubtitleContent::SMPTESubtitleContent (boost::filesystem::path file, bool mxf)
: SubtitleContent (file)
{
- ASDCP::TimedText::MXFReader reader;
- Kumu::Result_t r = reader.OpenRead (file.string().c_str ());
- if (ASDCP_FAILURE (r)) {
- boost::throw_exception (MXFFileError ("could not open MXF file for reading", file, r));
- }
-
- string s;
- reader.ReadTimedTextResource (s, 0, 0);
shared_ptr<cxml::Document> xml (new cxml::Document ("SubtitleReel"));
- stringstream t;
- t << s;
- xml->read_stream (t);
- ASDCP::WriterInfo info;
- reader.FillWriterInfo (info);
+ if (mxf) {
+ ASDCP::TimedText::MXFReader reader;
+ Kumu::Result_t r = reader.OpenRead (file.string().c_str ());
+ if (ASDCP_FAILURE (r)) {
+ boost::throw_exception (MXFFileError ("could not open MXF file for reading", file, r));
+ }
- char buffer[64];
- Kumu::bin2UUIDhex (info.AssetUUID, ASDCP::UUIDlen, buffer, sizeof (buffer));
- _id = buffer;
+ string s;
+ reader.ReadTimedTextResource (s, 0, 0);
+ stringstream t;
+ t << s;
+ xml->read_stream (t);
+ ASDCP::WriterInfo info;
+ reader.FillWriterInfo (info);
+
+ char buffer[64];
+ Kumu::bin2UUIDhex (info.AssetUUID, ASDCP::UUIDlen, buffer, sizeof (buffer));
+ _id = buffer;
+ } else {
+ xml->read_file (file);
+ _id = xml->string_child("Id").substr (9);
+ }
+
_load_font_nodes = type_children<dcp::SMPTELoadFont> (xml, "LoadFont");
shared_ptr<cxml::Node> subtitle_list = xml->optional_node_child ("SubtitleList");