diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-02-25 12:10:27 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-02-25 12:10:27 +0000 |
| commit | e15fa4fe6d519c92f2083ca42c18675c729bda30 (patch) | |
| tree | 70813871a8219b00d5bd0fb8409ee1aa8aad2929 /src/lib | |
| parent | 751d212a973c3ce80a6664fec929801301db6349 (diff) | |
Somewhat riskily remove use of AV_SEEK_BACKWARD. It was causing
seeks at the end of a FFmpegDecoder to go back into the content,
confusing the player (which assumes that the next peek after seek
will be after the seek location).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/decoder.h | 8 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 4 | ||||
| -rw-r--r-- | src/lib/player.cc | 5 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 6646b0e76..562073c1e 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -41,7 +41,7 @@ public: Decoder (boost::shared_ptr<const Film>); virtual ~Decoder () {} - /** Seek so that the next get_*() will yield the next thing + /** Seek so that the next peek() will yield the next thing * (video/sound frame, subtitle etc.) at or after the requested * time. Pass accurate = true to try harder to get close to * the request. @@ -49,13 +49,17 @@ public: virtual void seek (ContentTime time, bool accurate); boost::shared_ptr<Decoded> peek (); + + /* Consume the last peek()ed thing so that it won't be returned + * from the next peek(). + */ void consume (); protected: /** Perform one decode pass of the content, which may or may not * result in a complete quantum (Decoded object) of decoded stuff - * being made ready. + * being added to _pending. * @return true if the decoder is done (i.e. no more data will be * produced by any future calls to pass() without a seek() first). */ diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 22e1b3bc1..d9729ee1a 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -372,13 +372,15 @@ FFmpegDecoder::seek_and_flush (ContentTime t) ); } + cout << "S&F " << t << "\n"; + /* Ridiculous empirical hack */ s--; if (s < 0) { s = 0; } - av_seek_frame (_format_context, _video_stream, s, AVSEEK_FLAG_BACKWARD); + av_seek_frame (_format_context, _video_stream, s, 0); avcodec_flush_buffers (video_codec_context()); if (audio_codec_context ()) { diff --git a/src/lib/player.cc b/src/lib/player.cc index db8be20c2..5fd3b8ffa 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -122,8 +122,10 @@ Player::pass () break; } + dec->set_dcp_times (_film->video_frame_rate(), _film->audio_frame_rate(), (*i)->frc, offset); DCPTime const t = dec->dcp_time - offset; + cout << "Peeked " << (*i)->content->paths()[0] << " for " << t << " cf " << ((*i)->content->full_length() - (*i)->content->trim_end ()) << "\n"; if (t >= ((*i)->content->full_length() - (*i)->content->trim_end ())) { /* In the end-trimmed part; decoder has nothing else to give us */ dec.reset (); @@ -173,7 +175,6 @@ Player::pass () shared_ptr<DecodedImageSubtitle> dis = dynamic_pointer_cast<DecodedImageSubtitle> (earliest_decoded); shared_ptr<DecodedTextSubtitle> dts = dynamic_pointer_cast<DecodedTextSubtitle> (earliest_decoded); -#if 0 if (dv) { cout << "Video @ " << dv->dcp_time << " " << (double(dv->dcp_time) / TIME_HZ) << ".\n"; } else if (da) { @@ -183,7 +184,6 @@ Player::pass () } else if (dts) { cout << "Text sub.\n"; } -#endif /* Will be set to false if we shouldn't consume the peeked DecodedThing */ bool consume = true; @@ -432,6 +432,7 @@ Player::seek (DCPTime t, bool accurate) ContentTime ct = (s + (*i)->content->trim_start()) * (*i)->frc.speed_up; /* And seek the decoder */ + cout << "seek " << (*i)->content->paths()[0] << " to " << ct << "\n"; (*i)->decoder->seek (ct, accurate); } |
