Fix seek, for video at least.
authorCarl Hetherington <cth@carlh.net>
Wed, 11 May 2016 00:05:29 +0000 (01:05 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 18 May 2016 10:50:29 +0000 (11:50 +0100)
src/lib/audio_decoder_stream.cc
src/lib/ffmpeg_decoder.cc
src/lib/subtitle_decoder.cc
src/lib/video_decoder.cc

index 121e233afe8d50e16133ade8337da407fb28ba66..f64bd6955fade37bf122ef0a6368bacd77307958 100644 (file)
@@ -69,7 +69,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
 
        if (frame < _decoded.frame || end > (_decoded.frame + length * 4)) {
                /* Either we have no decoded data, or what we do have is a long way from what we want: seek */
-               seek (ContentTime::from_frames (frame, _content->resampled_frame_rate()), accurate);
+               _decoder->seek (ContentTime::from_frames (frame, _content->resampled_frame_rate()), accurate);
        }
 
        /* Offset of the data that we want from the start of _decoded.audio
index 195167d4b6735b9804bf3d5d693472f8248f87d3..e3a42537535621e1f8cfb5e4543696a5a4d1d557 100644 (file)
@@ -302,9 +302,17 @@ FFmpegDecoder::bytes_per_audio_sample (shared_ptr<FFmpegAudioStream> stream) con
 void
 FFmpegDecoder::seek (ContentTime time, bool accurate)
 {
-       video->seek (time, accurate);
-       audio->seek (time, accurate);
-       subtitle->seek (time, accurate);
+       if (video) {
+               video->seek (time, accurate);
+       }
+
+       if (audio) {
+               audio->seek (time, accurate);
+       }
+
+       if (subtitle) {
+               subtitle->seek (time, accurate);
+       }
 
        /* If we are doing an `accurate' seek, we need to use pre-roll, as
           we don't really know what the seek will give us.
index f182c53e559e4e01c7cba8d3749145bbaa0ba3c2..2da4b7a3438ded046dd83d886bc7484206550596 100644 (file)
@@ -74,7 +74,7 @@ SubtitleDecoder::get (list<T> const & subs, list<ContentTimePeriod> const & sp,
 
        /* Seek if what we want is before what we have, or a more than a little bit after */
        if (subs.empty() || sp.back().to < subs.front().period().from || sp.front().from > (subs.back().period().to + ContentTime::from_seconds (1))) {
-               seek (sp.front().from, true);
+               _parent->seek (sp.front().from, true);
        }
 
        /* Now enough pass() calls will either:
index a734f9b2a0e4aed81d5f48cfcc9c3b3d8147a67d..761de0701fea8d1151f75bbd8b07534b3a59636c 100644 (file)
@@ -86,7 +86,7 @@ VideoDecoder::get (Frame frame, bool accurate)
        _log->log (String::compose ("VD has request for %1", frame), LogEntry::TYPE_DEBUG_DECODE);
 
        if (_decoded.empty() || frame < _decoded.front().frame || frame > (_decoded.back().frame + 1)) {
-               seek (ContentTime::from_frames (frame, _content->active_video_frame_rate()), accurate);
+               _parent->seek (ContentTime::from_frames (frame, _content->active_video_frame_rate()), accurate);
        }
 
        list<ContentVideo> dec;