diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-03-07 19:27:33 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-04-19 23:04:32 +0100 |
| commit | 4f9cb03792e85cbb5b4d554ab8ec0a3275fa7524 (patch) | |
| tree | 2821608ecf5f7cc50649333903caff07d78fdbba /src/wx | |
| parent | 67a68bd971ebe1b35daa3f75873b4ccb53c00ba0 (diff) | |
Initial butler work.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/film_viewer.cc | 55 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 7 |
2 files changed, 35 insertions, 27 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index a5371fcf0..8fff21345 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -39,6 +39,7 @@ #include "lib/video_content.h" #include "lib/video_decoder.h" #include "lib/timer.h" +#include "lib/butler.h" #include "lib/log.h" #include "lib/config.h" extern "C" { @@ -179,9 +180,9 @@ FilmViewer::set_film (shared_ptr<Film> film) _player->set_play_referenced (); _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1)); - _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1)); - _player->Video.connect (boost::bind (&FilmViewer::video, this, _1, _2)); + + recreate_butler (); calculate_sizes (); refresh (); @@ -190,6 +191,18 @@ FilmViewer::set_film (shared_ptr<Film> film) } void +FilmViewer::recreate_butler () +{ + _butler.reset (); + + if (!_film) { + return; + } + + _butler.reset (new Butler (_film, _player)); +} + +void FilmViewer::refresh_panel () { _panel->Refresh (); @@ -197,16 +210,15 @@ FilmViewer::refresh_panel () } void -FilmViewer::video (shared_ptr<PlayerVideo> pv, DCPTime time) +FilmViewer::get () { - if (!_player) { - return; - } + pair<shared_ptr<PlayerVideo>, DCPTime> video; + do { + video = _butler->get_video (); + } while (_film->three_d() && ((_left_eye->GetValue() && video.first->eyes() == EYES_RIGHT) || (_right_eye->GetValue() && video.first->eyes() == EYES_LEFT))); - if (_film->three_d ()) { - if ((_left_eye->GetValue() && pv->eyes() == EYES_RIGHT) || (_right_eye->GetValue() && pv->eyes() == EYES_LEFT)) { - return; - } + if (!video.first) { + return; } /* In an ideal world, what we would do here is: @@ -227,29 +239,22 @@ FilmViewer::video (shared_ptr<PlayerVideo> pv, DCPTime time) * image and convert it (from whatever the user has said it is) to RGB. */ - _frame = pv->image ( + _frame = video.first->image ( bind (&Log::dcp_log, _film->log().get(), _1, _2), bind (&PlayerVideo::always_rgb, _1), false, true ); - ImageChanged (pv); + ImageChanged (video.first); - _position = time; - _inter_position = pv->inter_position (); - _inter_size = pv->inter_size (); + _position = video.second; + _inter_position = video.first->inter_position (); + _inter_size = video.first->inter_size (); refresh_panel (); } void -FilmViewer::get () -{ - Image const * current = _frame.get (); - while (!_player->pass() && _frame.get() == current) {} -} - -void FilmViewer::timer () { DCPTime const frame = DCPTime::from_frames (1, _film->video_frame_rate ()); @@ -334,7 +339,7 @@ FilmViewer::panel_sized (wxSizeEvent& ev) void FilmViewer::calculate_sizes () { - if (!_film || !_player) { + if (!_film) { return; } @@ -570,11 +575,11 @@ FilmViewer::jump_to_selected_clicked () void FilmViewer::seek (DCPTime t, bool accurate) { - if (!_player) { + if (!_butler) { return; } - _player->seek (t, accurate); + _butler->seek (t, accurate); _last_seek_accurate = accurate; get (); } diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 9fc21fc9c..d50cc562d 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -22,8 +22,8 @@ * @brief A wx widget to view `thumbnails' of a Film. */ -#include <wx/wx.h> #include "lib/film.h" +#include <wx/wx.h> class wxToggleButton; class FFmpegPlayer; @@ -31,6 +31,7 @@ class Image; class RGBPlusAlphaImage; class PlayerVideo; class Player; +class Butler; /** @class FilmViewer * @brief A wx widget to view a preview of a Film. @@ -68,7 +69,6 @@ private: void player_changed (bool); void update_position_label (); void update_position_slider (); - void video (boost::shared_ptr<PlayerVideo>, DCPTime time); void get (); void seek (DCPTime t, bool accurate); void refresh_panel (); @@ -79,6 +79,7 @@ private: void frame_number_clicked (); void go_to (DCPTime t); void jump_to_selected_clicked (); + void recreate_butler (); boost::shared_ptr<Film> _film; boost::shared_ptr<Player> _player; @@ -113,4 +114,6 @@ private: * can get the same one that we got last time. */ bool _last_seek_accurate; + + boost::shared_ptr<Butler> _butler; }; |
