diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-24 15:58:45 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-24 15:58:45 +0100 |
| commit | d6ae629f4a11579818235d37b2558c6cc9838779 (patch) | |
| tree | f5a027c3135a290769241f98f6206c84799350b2 /src | |
| parent | 3e2e2fa63ce6e42efba734ced0099a2d87cd3290 (diff) | |
A few seeking fixes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/content.cc | 3 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 4 | ||||
| -rw-r--r-- | src/lib/player.cc | 15 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 6 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 2 |
5 files changed, 14 insertions, 16 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... */ diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index bc814fcbc..5cf0b7897 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -1147,9 +1147,9 @@ FilmEditor::setup_content_sensitivity () _content_remove->Enable (selection && _generally_sensitive); _content_timeline->Enable (_generally_sensitive); - _video_panel->Enable (selection && _generally_sensitive); - _audio_panel->Enable (selection && _generally_sensitive); - _subtitle_panel->Enable (selection && _generally_sensitive); + _video_panel->Enable (selection && dynamic_pointer_cast<VideoContent> (selection) && _generally_sensitive); + _audio_panel->Enable (selection && dynamic_pointer_cast<AudioContent> (selection) && _generally_sensitive); + _subtitle_panel->Enable (selection && dynamic_pointer_cast<FFmpegContent> (selection) && _generally_sensitive); } shared_ptr<Content> diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 13776110c..6478b8541 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -261,6 +261,8 @@ FilmViewer::paint_panel (wxPaintEvent &) void FilmViewer::slider_moved (wxScrollEvent &) { + cout << "slider " << _slider->GetValue() << " " << _film->length() << "\n"; + if (_film && _player) { _player->seek (_slider->GetValue() * _film->length() / 4096); } |
