+ Frame const period_duration = period.duration().frames_round(film->video_frame_rate());
+
+ shared_ptr<Result> reel_asset;
+
+ if (asset) {
+ if (film->interop()) {
+ if (chosen_interop_font) {
+ /* We only add one font, as Interop will ignore subsequent ones (and some validators will
+ * complain if they are even present)
+ */
+ asset->add_font(fonts.get(chosen_interop_font), chosen_interop_font->data().get_value_or(default_font));
+ }
+ } else {
+ for (auto const& font: fonts.map()) {
+ asset->add_font(font.second, font.first->data().get_value_or(default_font));
+ }
+ }
+
+ if (auto interop = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(asset)) {
+ auto directory = output_dcp / interop->id ();
+ boost::filesystem::create_directories (directory);
+ interop->write (directory / subtitle_asset_filename(asset, reel_index, reel_count, content_summary, ".xml"));
+ reel_asset = make_shared<Interop> (
+ interop,
+ dcp::Fraction(film->video_frame_rate(), 1),
+ picture_duration,
+ 0
+ );
+ } else if (auto smpte = dynamic_pointer_cast<dcp::SMPTESubtitleAsset>(asset)) {
+ /* All our assets should be the same length; use the picture asset length here
+ as a reference to set the subtitle one. We'll use the duration rather than
+ the intrinsic duration; we don't care if the picture asset has been trimmed, we're
+ just interested in its presentation length.
+ */
+ smpte->set_intrinsic_duration(picture_duration);
+ smpte->write (
+ output_dcp / subtitle_asset_filename(asset, reel_index, reel_count, content_summary, ".mxf")
+ );
+ reel_asset = make_shared<SMPTE> (
+ smpte,
+ dcp::Fraction(film->video_frame_rate(), 1),
+ picture_duration,
+ 0
+ );
+ }