Add 'starting' option to subtitles_during().
[dcpomatic.git] / src / lib / ffmpeg_decoder.cc
index ce6fb1984e60d5a8568cc80efcf05bbb61ba0b03..4ae9dc3132f80eaf2c7f238e2618f15e7e8fcfe6 100644 (file)
@@ -45,6 +45,7 @@ extern "C" {
 #include "ffmpeg_content.h"
 #include "image_proxy.h"
 #include "film.h"
+#include "timer.h"
 
 #include "i18n.h"
 
@@ -59,6 +60,7 @@ using std::stringstream;
 using std::list;
 using std::min;
 using std::pair;
+using std::make_pair;
 using boost::shared_ptr;
 using boost::optional;
 using boost::dynamic_pointer_cast;
@@ -140,7 +142,7 @@ FFmpegDecoder::pass ()
        }
 
        int const si = _packet.stream_index;
-       
+
        if (si == _video_stream) {
                decode_video_packet ();
        } else if (_ffmpeg_content->audio_stream() && _ffmpeg_content->audio_stream()->uses_index (_format_context, si)) {
@@ -293,7 +295,7 @@ FFmpegDecoder::seek (ContentTime time, bool accurate)
        */
 
        ContentTime pre_roll = accurate ? ContentTime::from_seconds (2) : ContentTime (0);
-       time - pre_roll;
+       time -= pre_roll;
        if (time < ContentTime (0)) {
                time = ContentTime (0);
        }
@@ -479,8 +481,8 @@ FFmpegDecoder::decode_subtitle_packet ()
        avsubtitle_free (&sub);
 }
 
-bool
-FFmpegDecoder::has_subtitle_during (ContentTimePeriod p) const
+list<ContentTimePeriod>
+FFmpegDecoder::subtitles_during (ContentTimePeriod p, bool starting) const
 {
-       return _ffmpeg_content->has_subtitle_during (p);
+       return _ffmpeg_content->subtitles_during (p, starting);
 }