DCPVideoFrame -> DCPVideo and PlayerVideoFrame -> PlayerVideo.
[dcpomatic.git] / src / wx / film_viewer.cc
index 33af202bc7164c31efd650fd8c854ad30b697f16..dd3d9ebe9817b576bf935968ce7cae44c8501bb8 100644 (file)
 #include "lib/examine_content_job.h"
 #include "lib/filter.h"
 #include "lib/player.h"
+#include "lib/player_video.h"
 #include "lib/video_content.h"
 #include "lib/video_decoder.h"
 #include "lib/timer.h"
-#include "lib/dcp_video.h"
 #include "film_viewer.h"
 #include "wx_util.h"
 
@@ -63,6 +63,7 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
        , _frame_number (new wxStaticText (this, wxID_ANY, wxT("")))
        , _timecode (new wxStaticText (this, wxID_ANY, wxT("")))
        , _play_button (new wxToggleButton (this, wxID_ANY, _("Play")))
+       , _last_get_accurate (true)
 {
 #ifndef __WXOSX__
        _panel->SetDoubleBuffered (true);
@@ -140,7 +141,7 @@ FilmViewer::set_film (shared_ptr<Film> f)
        _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
 
        calculate_sizes ();
-       get (_position, true);
+       get (_position, _last_get_accurate);
 }
 
 void
@@ -150,9 +151,9 @@ FilmViewer::get (DCPTime p, bool accurate)
                return;
        }
 
-       shared_ptr<DCPVideo> dcp_video = _player->get_video (p, accurate);
-       if (dcp_video) {
-               _frame = dcp_video->image (PIX_FMT_BGRA, true);
+       list<shared_ptr<PlayerVideo> > pvf = _player->get_video (p, accurate);
+       if (!pvf.empty ()) {
+               _frame = pvf.front()->image ();
                _frame = _frame->scale (_frame->size(), Scaler::from_id ("fastbilinear"), PIX_FMT_RGB24, false);
        } else {
                _frame.reset ();
@@ -163,6 +164,8 @@ FilmViewer::get (DCPTime p, bool accurate)
        set_position_text ();
        _panel->Refresh ();
        _panel->Update ();
+
+       _last_get_accurate = accurate;
 }
 
 void
@@ -234,7 +237,7 @@ FilmViewer::panel_sized (wxSizeEvent& ev)
        _panel_size.width = ev.GetSize().GetWidth();
        _panel_size.height = ev.GetSize().GetHeight();
        calculate_sizes ();
-       get (_position, true);
+       get (_position, _last_get_accurate);
 }
 
 void
@@ -362,5 +365,5 @@ FilmViewer::player_changed (bool frequent)
        }
 
        calculate_sizes ();
-       get (_position, true);
+       get (_position, _last_get_accurate);
 }