+
+void
+SMPTESubtitleAsset::read_mxf_descriptor (shared_ptr<ASDCP::TimedText::MXFReader> reader)
+{
+ ASDCP::TimedText::TimedTextDescriptor descriptor;
+ reader->FillTimedTextDescriptor (descriptor);
+
+ _intrinsic_duration = descriptor.ContainerDuration;
+ /* The thing which is called AssetID in the descriptor is also known as the
+ * ResourceID of the MXF. We store that, at present just for verification
+ * purposes.
+ */
+ char id[64];
+ Kumu::bin2UUIDhex (descriptor.AssetID, ASDCP::UUIDlen, id, sizeof(id));
+ _resource_id = id;
+}
+
+
+void
+SMPTESubtitleAsset::set_key (Key key)
+{
+ /* See if we already have a key; if we do, and we have a file, we'll already
+ have read that file.
+ */
+ auto const had_key = static_cast<bool>(_key);
+
+ MXF::set_key (key);
+
+ if (!_key_id || !_file || had_key) {
+ /* Either we don't have any data to read, it wasn't
+ encrypted, or we've already read it, so we don't
+ need to do anything else.
+ */
+ return;
+ }
+
+ /* Our data was encrypted; now we can decrypt it */
+
+ auto reader = make_shared<ASDCP::TimedText::MXFReader>();
+ auto r = reader->OpenRead (_file->string().c_str ());
+ if (ASDCP_FAILURE (r)) {
+ boost::throw_exception (
+ ReadError (
+ String::compose ("Could not read encrypted subtitle MXF (%1)", static_cast<int> (r))
+ )
+ );
+ }
+
+ auto dec = make_shared<DecryptionContext>(key, Standard::SMPTE);
+ string xml_string;
+ reader->ReadTimedTextResource (xml_string, dec->context(), dec->hmac());
+ _raw_xml = xml_string;
+ auto xml = make_shared<cxml::Document>("SubtitleReel");
+ xml->read_string (xml_string);
+ parse_xml (xml);
+ read_mxf_resources (reader, dec);
+}
+
+
+vector<shared_ptr<LoadFontNode>>