+ if (dynamic_pointer_cast<dcp::InteropSubtitleAsset> (i.subtitle_asset)) {
+ boost::filesystem::path directory = _film->dir (_film->dcp_name ()) / i.subtitle_asset->id ();
+ boost::filesystem::create_directories (directory);
+ i.subtitle_asset->write (directory / ("sub_" + i.subtitle_asset->id() + ".xml"));
+ } else {
+
+ /* All our assets should be the same length; use the picture asset length here
+ as a reference to set the subtitle one.
+ */
+ dynamic_pointer_cast<dcp::SMPTESubtitleAsset>(_subtitle_asset)->set_intrinsic_duration (
+ reel_picture_asset->intrinsic_duration ()
+ );
+
+ i.subtitle_asset->write (
+ _film->dir (_film->dcp_name ()) / ("sub_" + i.subtitle_asset->id() + ".mxf")
+ );
+ }
+
+ reel->add (shared_ptr<dcp::ReelSubtitleAsset> (
+ new dcp::ReelSubtitleAsset (
+ i.subtitle_asset,
+ dcp::Fraction (_film->video_frame_rate(), 1),
+ reel_picture_asset->intrinsic_duration (),
+ 0
+ )
+ ));
+ } else {
+ /* We don't have a subtitle asset of our own; maybe we need to reference one */
+ /* XXX: this is all a hack */
+ BOOST_FOREACH (shared_ptr<dcp::ReelAsset> j, _reel_assets) {
+ if (dynamic_pointer_cast<dcp::ReelSubtitleAsset> (j)) {
+ reel->add (j);
+ }
+ }
+ }
+
+ cpl->add (reel);
+
+ shared_ptr<Job> job = _job.lock ();
+ DCPOMATIC_ASSERT (job);
+
+ job->sub (_("Computing image digest"));
+ if (i.picture_asset) {
+ i.picture_asset->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
+ }
+
+ if (i.sound_asset) {
+ job->sub (_("Computing audio digest"));
+ i.sound_asset->hash (boost::bind (&Job::set_progress, job.get(), _1, false));
+ }