diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-08-22 14:28:35 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-08-22 14:28:35 +0100 |
| commit | 533b606b866407e2f52e59f49e00c4e355b376ad (patch) | |
| tree | 81d5e42c05df03beb85b4ef239891b7be18a273a /src/dcp.cc | |
| parent | c70373ba74504ae39453c2a41ce1ab047fd441b4 (diff) | |
Look for subtitle assets more sensibly.
Diffstat (limited to 'src/dcp.cc')
| -rw-r--r-- | src/dcp.cc | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -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<PictureAsset> picture; shared_ptr<SoundAsset> sound; shared_ptr<SubtitleAsset> 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<Reel> (new Reel (picture, sound, subtitle))); } } |
