Only support GLVideoView when building with wxWidgets >= 3.1.0.
authorCarl Hetherington <cth@carlh.net>
Wed, 29 Sep 2021 10:33:08 +0000 (12:33 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 29 Sep 2021 22:49:35 +0000 (00:49 +0200)
src/wx/film_viewer.cc
src/wx/full_config_dialog.cc
src/wx/gl_video_view.cc
src/wx/gl_video_view.h
src/wx/system_information_dialog.cc

index 0131aa294a66e9caa6fa5841eeb3003e929c268c..22de7b5934c28751b8d73b2c14a3b56a24273249 100644 (file)
@@ -88,6 +88,7 @@ FilmViewer::FilmViewer (wxWindow* p)
        : _audio (DCPOMATIC_RTAUDIO_API)
        , _closed_captions_dialog (new ClosedCaptionsDialog(p, this))
 {
        : _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);
        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;
        }
                _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)));
 
        _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;
        }
 
                return;
        }
 
+#if wxCHECK_VERSION(3, 1, 0)
        auto const j2k_gl_optimised = dynamic_pointer_cast<GLVideoView>(_video_view) && _optimise_for_j2k;
        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,
 
        _butler = std::make_shared<Butler>(
                _film,
index dcfcf394b08c6a67b289259c13d1ecda81f34a3f..038a7514686c0ae0975723c18a3bbd7faac76fc2 100644 (file)
@@ -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)"));
                _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)"));
                _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));
                _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));
index 04e0bac46ec373e3b731768fa00b949f5290505a..2b79bbd5e71074b107312323cbd2a3835060da99 100644 (file)
 #endif
 
 #include "gl_video_view.h"
 #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"
 #include "film_viewer.h"
 #include "wx_util.h"
 #include "lib/image.h"
@@ -830,3 +834,4 @@ Texture::set (shared_ptr<const Image> image)
        }
 }
 
        }
 }
 
+#endif
index d7f8429af78c705faff83d831d1cd888be16fa42..7ef7b565aaa2fa00f787a8eb212bfc4ab1a30fe0 100644 (file)
 
 */
 
 
 */
 
-#include "video_view.h"
-#include "lib/signaller.h"
-#include "lib/position.h"
+
 #include "lib/warnings.h"
 #include "lib/warnings.h"
+
 DCPOMATIC_DISABLE_WARNINGS
 #include <wx/glcanvas.h>
 #include <wx/wx.h>
 DCPOMATIC_ENABLE_WARNINGS
 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>
 #include <dcp/util.h>
 #include <boost/atomic.hpp>
 #include <boost/thread.hpp>
@@ -140,3 +151,5 @@ private:
 
        std::map<GLenum, std::string> _information;
 };
 
        std::map<GLenum, std::string> _information;
 };
+
+#endif
index 1c8dd8d00c2757defff1c1772739bd32aa4c1aac..addb89da4c7ab7d64882905b830b1f6651a23312 100644 (file)
@@ -39,6 +39,8 @@ using std::weak_ptr;
 using std::shared_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)
 {
 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 ();
 }
 
        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