+ if (!ASDCP_FAILURE(r)) {
+ /* MXF-wrapped */
+ ASDCP::WriterInfo info;
+ reader->FillWriterInfo (info);
+ _id = read_writer_info (info);
+ if (!_key_id) {
+ /* Not encrypted; read it in now */
+ reader->ReadTimedTextResource (_raw_xml);
+ xml->read_string (_raw_xml);
+ parse_xml (xml);
+ read_mxf_descriptor (reader, make_shared<DecryptionContext>(optional<Key>(), Standard::SMPTE));
+ }
+ } else {
+ /* Plain XML */
+ try {
+ _raw_xml = dcp::file_to_string (file);
+ xml = make_shared<cxml::Document>("SubtitleReel");
+ xml->read_file (file);
+ parse_xml (xml);
+ _id = _xml_id = remove_urn_uuid (xml->string_child ("Id"));
+ } catch (cxml::Error& e) {
+ boost::throw_exception (
+ ReadError (
+ String::compose (
+ "Failed to read subtitle file %1; MXF failed with %2, XML failed with %3",
+ file, static_cast<int>(r), e.what()
+ )
+ )
+ );
+ }