summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-09-29 12:33:08 +0200
committerCarl Hetherington <cth@carlh.net>2021-09-30 00:49:35 +0200
commita855b3030e511c130992dec8894e0d96fc811d97 (patch)
tree7e22531163d8313747fa6eb8ea743eed116a4956
parent9751270721fe4560eae0f53ac1e42ad0ebc80028 (diff)
Only support GLVideoView when building with wxWidgets >= 3.1.0.
-rw-r--r--src/wx/film_viewer.cc8
-rw-r--r--src/wx/full_config_dialog.cc2
-rw-r--r--src/wx/gl_video_view.cc5
-rw-r--r--src/wx/gl_video_view.h19
-rw-r--r--src/wx/system_information_dialog.cc13
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<GLVideoView>(this, p);
@@ -96,6 +97,9 @@ FilmViewer::FilmViewer (wxWindow* p)
_video_view = std::make_shared<SimpleVideoView>(this, p);
break;
}
+#else
+ _video_view = std::make_shared<SimpleVideoView>(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<GLVideoView>(_video_view) && _optimise_for_j2k;
+#else
+ auto const j2k_gl_optimised = false;
+#endif
_butler = std::make_shared<Butler>(
_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<const Image> 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 <wx/glcanvas.h>
#include <wx/wx.h>
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 <dcp/util.h>
#include <boost/atomic.hpp>
#include <boost/thread.hpp>
@@ -140,3 +151,5 @@ private:
std::map<GLenum, std::string> _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<FilmViewer> weak_viewer)
: TableDialog (parent, _("System information"), 2, 1, false)
{
@@ -75,3 +77,14 @@ SystemInformationDialog::SystemInformationDialog (wxWindow* parent, weak_ptr<Fil
layout ();
}
+
+#else
+
+SystemInformationDialog::SystemInformationDialog (wxWindow* parent, weak_ptr<FilmViewer>)
+ : TableDialog (parent, _("System information"), 2, 1, false)
+{
+ add (_("OpenGL version"), true);
+ add (_("OpenGL renderer not supported by this DCP-o-matic version"), false);
+}
+
+#endif