+ if (dynamic_pointer_cast<dcp::InteropSubtitleAsset> (asset)) {
+ boost::filesystem::path directory = output_dcp / asset->id ();
+ boost::filesystem::create_directories (directory);
+ asset->write (directory / ("sub_" + 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. 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.
+ */
+ dynamic_pointer_cast<dcp::SMPTESubtitleAsset>(asset)->set_intrinsic_duration (picture_duration);
+
+ asset->write (
+ output_dcp / ("sub_" + asset->id() + ".mxf")
+ );
+ }
+
+ reel_asset.reset (
+ new T (
+ asset,
+ dcp::Fraction (film->video_frame_rate(), 1),
+ picture_duration,
+ 0
+ )
+ );
+ } else {
+ /* We don't have a subtitle asset of our own; hopefully we have one to reference */
+ BOOST_FOREACH (ReferencedReelAsset j, refs) {
+ shared_ptr<T> k = dynamic_pointer_cast<T> (j.asset);
+ if (k && j.period == period) {
+ reel_asset = k;
+ /* If we have a hash for this asset in the CPL, assume that it is correct */
+ if (k->hash()) {
+ k->asset_ref()->set_hash (k->hash().get());
+ }
+ }
+ }
+ }
+
+ if (reel_asset) {
+ if (!text_only && reel_asset->actual_duration() != period_duration) {
+ throw ProgrammingError (
+ __FILE__, __LINE__,
+ String::compose ("%1 vs %2", reel_asset->actual_duration(), period_duration)
+ );
+ }
+ reel->add (reel_asset);
+ }
+
+ return reel_asset;
+}
+
+
+shared_ptr<dcp::ReelPictureAsset>
+ReelWriter::create_reel_picture (shared_ptr<dcp::Reel> reel, list<ReferencedReelAsset> const & refs) const
+{
+ shared_ptr<dcp::ReelPictureAsset> reel_asset;