-list<ContentTimePeriod>
-DCPSubtitleDecoder::subtitles_during (ContentTimePeriod p, bool starting) const
-{
- /* XXX: inefficient */
-
- list<ContentTimePeriod> d;
-
- for (list<dcp::SubtitleString>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
- ContentTimePeriod period (
- ContentTime::from_seconds (i->in().to_seconds ()),
- ContentTime::from_seconds (i->out().to_seconds ())
- );
-
- if ((starting && p.contains (period.from)) || (!starting && p.overlaps (period))) {
- d.push_back (period);
+ while (_next != _subtitles.end () && content_time_period (*_next) == p) {
+ shared_ptr<dcp::SubtitleString> ns = dynamic_pointer_cast<dcp::SubtitleString>(*_next);
+ if (ns) {
+ s.push_back (*ns);
+ ++_next;