X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_content.cc;h=a1992102c9e55e8e539f3757ba55208153ef86b6;hb=73f52e94953848c696725defd3d7f5c4c30707e2;hp=a12f45a30f81d20d6af73fb97e0b62f805a54a54;hpb=f0edd6ab35c3c2b7800a26ec8206adab75e5f633;p=dcpomatic.git diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index a12f45a30..a1992102c 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -396,20 +396,22 @@ FFmpegContent::audio_analysis_path () const return p; } -bool -FFmpegContent::has_subtitle_during (ContentTimePeriod period) const +list +FFmpegContent::subtitles_during (ContentTimePeriod period, bool starting) const { + list d; + shared_ptr stream = subtitle_stream (); if (!stream) { - return false; + return d; } /* XXX: inefficient */ for (vector::const_iterator i = stream->periods.begin(); i != stream->periods.end(); ++i) { - if (i->from <= period.to && i->to >= period.from) { - return true; + if ((starting && period.contains (i->from)) || (!starting && period.overlaps (*i))) { + d.push_back (*i); } } - return false; + return d; }