summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-10 11:49:07 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-10 11:49:07 +0100
commit2f6167a81ab09b327eab9026d1dd40052fd7bdd0 (patch)
tree44da8f075b412ba86b9b664a6f6abc94b4b2bcf5 /src
parent9e7697cd54968bcdec0d48781b3fb075629eecee (diff)
Fix initial display to be frame 1, not 2.
Diffstat (limited to 'src')
-rw-r--r--src/lib/ffmpeg.cc1
-rw-r--r--src/lib/ffmpeg_decoder.cc7
-rw-r--r--src/lib/ffmpeg_examiner.cc6
-rw-r--r--src/lib/player.cc2
-rw-r--r--src/wx/film_viewer.cc3
5 files changed, 11 insertions, 8 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;
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 62bad8195..185c3c53f 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -132,7 +132,6 @@ FilmViewer::set_film (shared_ptr<Film> f)
_player->Changed.connect (boost::bind (&FilmViewer::player_changed, this));
calculate_sizes ();
- fetch_current_frame_again ();
}
void
@@ -277,7 +276,7 @@ FilmViewer::process_video (shared_ptr<const Image> image, bool, Time t)
double const fps = _film->dcp_video_frame_rate ();
/* Count frame number from 1 ... not sure if this is the best idea */
_frame_number->SetLabel (wxString::Format (wxT("%d"), int (rint (t * fps / TIME_HZ)) + 1));
-
+
double w = static_cast<double>(t) / TIME_HZ;
int const h = (w / 3600);
w -= h * 3600;