summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-24 15:58:45 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-24 15:58:45 +0100
commitd6ae629f4a11579818235d37b2558c6cc9838779 (patch)
treef5a027c3135a290769241f98f6206c84799350b2 /src/lib
parent3e2e2fa63ce6e42efba734ced0099a2d87cd3290 (diff)
A few seeking fixes.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/content.cc3
-rw-r--r--src/lib/ffmpeg_decoder.cc4
-rw-r--r--src/lib/player.cc15
3 files changed, 9 insertions, 13 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc
index c12a8a166..ad61f4d6c 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -97,6 +97,3 @@ Content::set_start (Time s)
signal_changed (ContentProperty::START);
}
-
-
-
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 799e89a38..047829d45 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -452,7 +452,7 @@ FFmpegDecoder::seek (Time t)
void
FFmpegDecoder::seek_back ()
{
- if (next() < 2.5) {
+ if (next() < (2.5 * TIME_HZ / video_frame_rate())) {
return;
}
@@ -462,7 +462,7 @@ FFmpegDecoder::seek_back ()
void
FFmpegDecoder::seek_forward ()
{
- if (next() >= (video_length() - video_frame_rate())) {
+ if (next() >= (_ffmpeg_content->length() - 0.5 * TIME_HZ / video_frame_rate())) {
return;
}
diff --git a/src/lib/player.cc b/src/lib/player.cc
index c03b4753c..8a13efd0c 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -37,6 +37,7 @@
using std::list;
using std::cout;
using std::min;
+using std::max;
using std::vector;
using boost::shared_ptr;
using boost::weak_ptr;
@@ -118,7 +119,6 @@ Player::pass ()
return true;
}
-#if 0
cout << "PASS:\n";
cout << "\tpass ";
if (dynamic_pointer_cast<FFmpegContent> (earliest->content)) {
@@ -132,7 +132,6 @@ Player::pass ()
} else if (dynamic_pointer_cast<SilenceDecoder> (earliest->decoder)) {
cout << " Silence.\n";
}
-#endif
earliest->decoder->pass ();
_position = earliest->content->start() + earliest->decoder->next ();
@@ -202,13 +201,13 @@ Player::seek (Time t)
return;
}
- for (list<shared_ptr<Piece> >::iterator i = _pieces.begin(); i != _pieces.end(); ++i) {
+ cout << "seek to " << t << " " << (t / TIME_HZ) << "\n";
- if ((*i)->content->start() > t || (*i)->content->end() <= t) {
- continue;
- }
-
- (*i)->decoder->seek (t - (*i)->content->start());
+ for (list<shared_ptr<Piece> >::iterator i = _pieces.begin(); i != _pieces.end(); ++i) {
+ Time s = t - (*i)->content->start ();
+ s = max (static_cast<Time> (0), s);
+ s = min ((*i)->content->length(), s);
+ (*i)->decoder->seek (s);
}
/* XXX: don't seek audio because we don't need to... */