Basics of noting subtitle times in FFmpegSubtitleStreams.
[dcpomatic.git] / src / lib / ffmpeg_content.cc
index a191959fcf6bceb42f94630823fcf1afb1dd45a7..2b507ab371adf3187c08d5b1241ff80c7f359edc 100644 (file)
@@ -392,3 +392,18 @@ FFmpegContent::audio_analysis_path () const
        p /= name;
        return p;
 }
+
+bool
+FFmpegContent::has_subtitle_during (ContentTimePeriod period) const
+{
+       shared_ptr<FFmpegSubtitleStream> stream = subtitle_stream ();
+
+       /* XXX: inefficient */
+       for (vector<ContentTimePeriod>::const_iterator i = stream->periods.begin(); i != stream->periods.end(); ++i) {
+               if (i->from <= period.to && i->to >= period.from) {
+                       return true;
+               }
+       }
+
+       return false;
+}