X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_subtitle_decoder.cc;h=3a182c0c7a20c4ea953c6ea02ad601c051029d60;hb=11efa93e15b694b8ea6f0a2bc68c87503cc570bb;hp=46256e93ef43f6d57607693f723658414b0d414e;hpb=64a6a87dd4a3fd43665242b8a8b2b35a675a7839;p=dcpomatic.git diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 46256e93e..3a182c0c7 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -29,7 +29,8 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using boost::bind; -DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content, shared_ptr log) +DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr film, shared_ptr content) + : Decoder (film) { shared_ptr c (load (content->path (0))); _subtitles = c->subtitles (); @@ -39,7 +40,7 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr con if (_next != _subtitles.end()) { first = content_time_period(*_next).from; } - subtitle.reset (new SubtitleDecoder (this, content->subtitle, log, first)); + text.push_back (shared_ptr (new TextDecoder (this, content->only_text(), first))); } void @@ -63,12 +64,13 @@ DCPSubtitleDecoder::pass () /* Gather all subtitles with the same time period that are next on the list. We must emit all subtitles for the same time - period with the same text_subtitle() call otherwise the - SubtitleDecoder will assume there is nothing else at the - time of emit the first. + period with the same emit*() call otherwise the + TextDecoder will assume there is nothing else at the + time of emitting the first. */ list s; + list i; ContentTimePeriod const p = content_time_period (*_next); while (_next != _subtitles.end () && content_time_period (*_next) == p) { @@ -76,12 +78,20 @@ DCPSubtitleDecoder::pass () if (ns) { s.push_back (*ns); ++_next; + } else { + /* XXX: perhaps these image subs should also be collected together like the string ones are; + this would need to be done both here and in DCPDecoder. + */ + + shared_ptr ni = dynamic_pointer_cast(*_next); + if (ni) { + emit_subtitle_image (p, *ni, film()->frame_size(), only_text()); + ++_next; + } } - - /* XXX: image subtitles */ } - subtitle->emit_text (p, s); + only_text()->emit_plain (p, s); return false; }