Extract indices array and make some offset constants.
[dcpomatic.git] / src / wx / film_viewer.cc
index a3c015ab197299d0225408906026316f19e781a5..749e4ceb7c315e73147737c465f2d26e981fba80 100644 (file)
@@ -96,10 +96,10 @@ FilmViewer::FilmViewer (wxWindow* p)
 {
        switch (Config::instance()->video_view_type()) {
        case Config::VIDEO_VIEW_OPENGL:
-               _video_view = new GLVideoView (this, p);
+               _video_view = std::make_shared<GLVideoView>(this, p);
                break;
        case Config::VIDEO_VIEW_SIMPLE:
-               _video_view = new SimpleVideoView (this, p);
+               _video_view = std::make_shared<SimpleVideoView>(this, p);
                break;
        }
 
@@ -229,6 +229,10 @@ FilmViewer::recreate_butler ()
                _butler->disable_audio ();
        }
 
+       if (dynamic_pointer_cast<GLVideoView>(_video_view) && _optimise_for_j2k) {
+               _butler->set_prepare_only_proxy (true);
+       }
+
        _closed_captions_dialog->set_butler (_butler);
 
        resume ();
@@ -772,3 +776,12 @@ FilmViewer::image_changed (shared_ptr<PlayerVideo> pv)
 {
        emit (boost::bind(boost::ref(ImageChanged), pv));
 }
+
+
+void
+FilmViewer::set_optimise_for_j2k (bool o)
+{
+       _optimise_for_j2k = o;
+       _video_view->set_optimise_for_j2k (o);
+}
+