diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-10 11:49:07 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-10 11:49:07 +0100 |
| commit | 2f6167a81ab09b327eab9026d1dd40052fd7bdd0 (patch) | |
| tree | 44da8f075b412ba86b9b664a6f6abc94b4b2bcf5 /src/lib | |
| parent | 9e7697cd54968bcdec0d48781b3fb075629eecee (diff) | |
Fix initial display to be frame 1, not 2.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ffmpeg.cc | 1 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 7 | ||||
| -rw-r--r-- | src/lib/ffmpeg_examiner.cc | 6 | ||||
| -rw-r--r-- | src/lib/player.cc | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index a39de391a..77bf75018 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -30,6 +30,7 @@ extern "C" { #include "i18n.h" using std::string; +using std::cout; using std::stringstream; using boost::shared_ptr; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index bcd1e738a..785a805f4 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -294,6 +294,11 @@ FFmpegDecoder::seek (VideoContent::Frame frame, bool accurate) _just_sought = true; + if (frame == 0) { + /* We're already there; from here on we can only seek non-zero amounts */ + return; + } + if (accurate) { while (1) { int r = av_read_frame (_format_context, &_packet); @@ -372,7 +377,7 @@ FFmpegDecoder::decode_video_packet () if (avcodec_decode_video2 (video_codec_context(), _frame, &frame_finished, &_packet) < 0 || !frame_finished) { return false; } - + boost::mutex::scoped_lock lm (_filter_graphs_mutex); shared_ptr<FilterGraph> graph; diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index f45b0fe52..ceeaee112 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -69,8 +69,6 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c) int frame_finished; avcodec_get_frame_defaults (_frame); - cout << "got packet " << _packet.stream_index << "\n"; - AVCodecContext* context = _format_context->streams[_packet.stream_index]->codec; if (_packet.stream_index == _video_stream && !_first_video) { @@ -94,11 +92,11 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c) ++i; } + av_free_packet (&_packet); + if (_first_video && have_all_audio) { break; } - - av_free_packet (&_packet); } } diff --git a/src/lib/player.cc b/src/lib/player.cc index fd697b522..26ded61b8 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -121,7 +121,7 @@ Player::pass () } #ifdef DEBUG_PLAYER - cout << "= PASS " << this << "\n"; + cout << "= PASS\n"; #endif Time earliest_t = TIME_MAX; |
