From 533b606b866407e2f52e59f49e00c4e355b376ad Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 22 Aug 2012 14:28:35 +0100 Subject: Look for subtitle assets more sensibly. --- src/dcp.cc | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/dcp.cc b/src/dcp.cc index 767ab401..aa937de5 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -278,17 +278,17 @@ DCP::DCP (string directory) _fps = p->frame_rate.numerator; _length += p->duration; - string n = pkl->asset_from_id (p->id)->original_file_name; - if (n.empty ()) { - n = p->annotation_text; - } - shared_ptr picture; shared_ptr sound; shared_ptr subtitle; if ((*i)->asset_list->main_picture) { + string n = pkl->asset_from_id (p->id)->original_file_name; + if (n.empty ()) { + n = p->annotation_text; + } + picture.reset (new MonoPictureAsset ( _directory, n, @@ -299,6 +299,11 @@ DCP::DCP (string directory) } else if ((*i)->asset_list->main_stereoscopic_picture) { + string n = pkl->asset_from_id (p->id)->original_file_name; + if (n.empty ()) { + n = p->annotation_text; + } + picture.reset (new StereoPictureAsset ( _directory, n, @@ -311,7 +316,7 @@ DCP::DCP (string directory) if ((*i)->asset_list->main_sound) { - n = pkl->asset_from_id ((*i)->asset_list->main_sound->id)->original_file_name; + string n = pkl->asset_from_id ((*i)->asset_list->main_sound->id)->original_file_name; if (n.empty ()) { n = (*i)->asset_list->main_sound->annotation_text; } @@ -325,13 +330,20 @@ DCP::DCP (string directory) ); } - assert (files.subtitles.size() < 2); + if ((*i)->asset_list->main_subtitle) { - if (!files.subtitles.empty ()) { - string const l = files.subtitles.front().substr (_directory.length ()); - subtitle.reset (new SubtitleAsset (_directory, l)); + string n = pkl->asset_from_id ((*i)->asset_list->main_subtitle->id)->original_file_name; + if (n.empty ()) { + n = (*i)->asset_list->main_subtitle->annotation_text; + } + + subtitle.reset (new SubtitleAsset ( + _directory, + n + ) + ); } - + _reels.push_back (shared_ptr (new Reel (picture, sound, subtitle))); } } -- cgit v1.2.3