From a855b3030e511c130992dec8894e0d96fc811d97 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 29 Sep 2021 12:33:08 +0200 Subject: [PATCH] Only support GLVideoView when building with wxWidgets >= 3.1.0. --- src/wx/film_viewer.cc | 8 ++++++++ src/wx/full_config_dialog.cc | 2 ++ src/wx/gl_video_view.cc | 5 +++++ src/wx/gl_video_view.h | 19 ++++++++++++++++--- src/wx/system_information_dialog.cc | 13 +++++++++++++ 5 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 0131aa294..22de7b593 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -88,6 +88,7 @@ FilmViewer::FilmViewer (wxWindow* p) : _audio (DCPOMATIC_RTAUDIO_API) , _closed_captions_dialog (new ClosedCaptionsDialog(p, this)) { +#if wxCHECK_VERSION(3, 1, 0) switch (Config::instance()->video_view_type()) { case Config::VIDEO_VIEW_OPENGL: _video_view = std::make_shared(this, p); @@ -96,6 +97,9 @@ FilmViewer::FilmViewer (wxWindow* p) _video_view = std::make_shared(this, p); break; } +#else + _video_view = std::make_shared(this, p); +#endif _video_view->Sized.connect (boost::bind(&FilmViewer::video_view_sized, this)); _video_view->TooManyDropped.connect (boost::bind(boost::ref(TooManyDropped))); @@ -208,7 +212,11 @@ FilmViewer::recreate_butler () return; } +#if wxCHECK_VERSION(3, 1, 0) auto const j2k_gl_optimised = dynamic_pointer_cast(_video_view) && _optimise_for_j2k; +#else + auto const j2k_gl_optimised = false; +#endif _butler = std::make_shared( _film, diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index dcfcf394b..038a75146 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -1459,7 +1459,9 @@ private: _maximum_j2k_bandwidth->SetRange (1, 1000); _maximum_j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind (&AdvancedPage::maximum_j2k_bandwidth_changed, this)); _video_display_mode->Append (_("Simple (safer)")); +#if wxCHECK_VERSION(3, 1, 0) _video_display_mode->Append (_("OpenGL (faster)")); +#endif _video_display_mode->Bind (wxEVT_CHOICE, boost::bind(&AdvancedPage::video_display_mode_changed, this)); _allow_any_dcp_frame_rate->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_dcp_frame_rate_changed, this)); _allow_any_container->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_container_changed, this)); diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 04e0bac46..2b79bbd5e 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -24,6 +24,10 @@ #endif #include "gl_video_view.h" + +/* This will only build on an new-enough wxWidgets: see the comment in gl_video_view.h */ +#if wxCHECK_VERSION(3,1,0) + #include "film_viewer.h" #include "wx_util.h" #include "lib/image.h" @@ -830,3 +834,4 @@ Texture::set (shared_ptr image) } } +#endif diff --git a/src/wx/gl_video_view.h b/src/wx/gl_video_view.h index d7f8429af..7ef7b565a 100644 --- a/src/wx/gl_video_view.h +++ b/src/wx/gl_video_view.h @@ -18,14 +18,25 @@ */ -#include "video_view.h" -#include "lib/signaller.h" -#include "lib/position.h" + #include "lib/warnings.h" + DCPOMATIC_DISABLE_WARNINGS #include #include DCPOMATIC_ENABLE_WARNINGS + +/* The OpenGL API in wxWidgets 3.0.x is sufficiently different to make it awkward to support, + * and I think it may even have things missing that we require (e.g. the attributes parameter + * to wxGLContext). Hence we only support the GLVideoView on wxWidgets 3.1.0 and higher + * (which only excludes the old macOS builds, since wxWidgets 3.1.x does not support macOS + * 10.9 or earlier). + */ +#if wxCHECK_VERSION(3,1,0) + +#include "video_view.h" +#include "lib/signaller.h" +#include "lib/position.h" #include #include #include @@ -140,3 +151,5 @@ private: std::map _information; }; + +#endif diff --git a/src/wx/system_information_dialog.cc b/src/wx/system_information_dialog.cc index 1c8dd8d00..addb89da4 100644 --- a/src/wx/system_information_dialog.cc +++ b/src/wx/system_information_dialog.cc @@ -39,6 +39,8 @@ using std::weak_ptr; using std::shared_ptr; +#if wxCHECK_VERSION(3, 1, 0) + SystemInformationDialog::SystemInformationDialog (wxWindow* parent, weak_ptr weak_viewer) : TableDialog (parent, _("System information"), 2, 1, false) { @@ -75,3 +77,14 @@ SystemInformationDialog::SystemInformationDialog (wxWindow* parent, weak_ptr) + : TableDialog (parent, _("System information"), 2, 1, false) +{ + add (_("OpenGL version"), true); + add (_("OpenGL renderer not supported by this DCP-o-matic version"), false); +} + +#endif -- 2.30.2