summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-10-09 00:39:08 +0200
committerCarl Hetherington <cth@carlh.net>2025-10-10 21:13:45 +0200
commitb2c2a9e6ec7a4f8ef8e31f97d4feece18c9c3286 (patch)
tree4d4c6a724d29396e1e0529e142cf188ccdba4cda /src
parentb4e4f2f752bf451e38cf47190a4d4df228ff7db9 (diff)
Keep screen awake while playing on Windows (#3095).
Diffstat (limited to 'src')
-rw-r--r--src/tools/dcpomatic.cc2
-rw-r--r--src/tools/dcpomatic_player.cc2
-rw-r--r--src/wx/film_viewer.cc8
-rw-r--r--src/wx/film_viewer.h2
-rw-r--r--src/wx/gl_video_view.cc4
-rw-r--r--src/wx/gl_video_view.h2
-rw-r--r--src/wx/simple_video_view.cc4
-rw-r--r--src/wx/simple_video_view.h2
-rw-r--r--src/wx/video_view.cc8
-rw-r--r--src/wx/video_view.h5
10 files changed, 24 insertions, 15 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 8f8cf3df0..e0c69f5a4 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -316,7 +316,7 @@ public:
*/
, _splitter(new LimitedFrameSplitter(this))
, _right_panel(new wxPanel(_splitter, wxID_ANY))
- , _film_viewer(_right_panel)
+ , _film_viewer(_right_panel, false)
{
auto bar = new wxMenuBar;
setup_menu (bar);
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index 32c6c980b..f95165620 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -209,7 +209,7 @@ public:
the dark-grey background on Windows.
*/
, _overall_panel(new wxPanel(this, wxID_ANY))
- , _viewer(_overall_panel)
+ , _viewer(_overall_panel, true)
, _main_sizer (new wxBoxSizer(wxVERTICAL))
{
dcpomatic_log = make_shared<NullLog>();
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 45476c75d..dbda1d7f1 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -86,20 +86,20 @@ rtaudio_callback(void* out, void *, unsigned int frames, double, RtAudioStreamSt
}
-FilmViewer::FilmViewer(wxWindow* p)
+FilmViewer::FilmViewer(wxWindow* p, bool wake)
: _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);
+ _video_view = std::make_shared<GLVideoView>(this, p, wake);
break;
case Config::VIDEO_VIEW_SIMPLE:
- _video_view = std::make_shared<SimpleVideoView>(this, p);
+ _video_view = std::make_shared<SimpleVideoView>(this, p, wake);
break;
}
#else
- _video_view = std::make_shared<SimpleVideoView>(this, p);
+ _video_view = std::make_shared<SimpleVideoView>(this, p, wake);
#endif
_video_view->Sized.connect(boost::bind(&FilmViewer::video_view_sized, this));
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 2a6239d7d..d7afa2182 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -58,7 +58,7 @@ class wxToggleButton;
class FilmViewer : public Signaller
{
public:
- FilmViewer(wxWindow *);
+ FilmViewer(wxWindow* parent, bool wake);
~FilmViewer();
/** @return the window showing the film's video */
diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc
index c93d0b51b..3df7a724c 100644
--- a/src/wx/gl_video_view.cc
+++ b/src/wx/gl_video_view.cc
@@ -68,8 +68,8 @@ using namespace boost::placeholders;
using namespace dcpomatic::gl;
-GLVideoView::GLVideoView(FilmViewer* viewer, wxWindow *parent)
- : VideoView(viewer)
+GLVideoView::GLVideoView(FilmViewer* viewer, wxWindow *parent, bool wake)
+ : VideoView(viewer, wake)
, _context(nullptr)
, _rec2020(false)
, _vsync_enabled(false)
diff --git a/src/wx/gl_video_view.h b/src/wx/gl_video_view.h
index a4ea83f70..dde9e65d4 100644
--- a/src/wx/gl_video_view.h
+++ b/src/wx/gl_video_view.h
@@ -73,7 +73,7 @@ private:
class GLVideoView : public VideoView
{
public:
- GLVideoView(FilmViewer* viewer, wxWindow* parent);
+ GLVideoView(FilmViewer* viewer, wxWindow* parent, bool wake);
~GLVideoView();
wxWindow* get() const override {
diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc
index 0fd162196..3fbfe25cc 100644
--- a/src/wx/simple_video_view.cc
+++ b/src/wx/simple_video_view.cc
@@ -46,8 +46,8 @@ using namespace boost::placeholders;
using namespace dcpomatic;
-SimpleVideoView::SimpleVideoView (FilmViewer* viewer, wxWindow* parent)
- : VideoView (viewer)
+SimpleVideoView::SimpleVideoView(FilmViewer* viewer, wxWindow* parent, bool wake)
+ : VideoView(viewer, wake)
, _rec2020_filter("convert", "convert", "", "colorspace=all=bt709:iall=bt2020")
, _rec2020_filter_graph({ _rec2020_filter }, dcp::Fraction(24, 1))
{
diff --git a/src/wx/simple_video_view.h b/src/wx/simple_video_view.h
index e19068979..f195640e0 100644
--- a/src/wx/simple_video_view.h
+++ b/src/wx/simple_video_view.h
@@ -37,7 +37,7 @@ class Filter;
class SimpleVideoView : public VideoView
{
public:
- SimpleVideoView (FilmViewer* viewer, wxWindow* parent);
+ SimpleVideoView(FilmViewer* viewer, wxWindow* parent, bool wake);
wxWindow* get () const override {
return _panel;
diff --git a/src/wx/video_view.cc b/src/wx/video_view.cc
index 0cb4a46ce..ffd218e4c 100644
--- a/src/wx/video_view.cc
+++ b/src/wx/video_view.cc
@@ -36,9 +36,11 @@ static constexpr int TOO_MANY_DROPPED_FRAMES = 20;
static constexpr int TOO_MANY_DROPPED_PERIOD = 5.0;
-VideoView::VideoView(FilmViewer* viewer)
+VideoView::VideoView(FilmViewer* viewer, bool wake)
: _viewer(viewer)
, _state_timer("viewer")
+ , _wake(wake)
+ , _waker(Waker::Reason::PLAYING)
{
}
@@ -94,6 +96,10 @@ VideoView::get_next_frame(bool non_blocking)
++_errored;
}
+ if (_wake) {
+ _waker.nudge();
+ }
+
return SUCCESS;
}
diff --git a/src/wx/video_view.h b/src/wx/video_view.h
index 422323fe7..6a4c2225e 100644
--- a/src/wx/video_view.h
+++ b/src/wx/video_view.h
@@ -24,6 +24,7 @@
#include "optimisation.h"
+#include "lib/cross.h"
#include "lib/dcpomatic_time.h"
#include "lib/exception_store.h"
#include "lib/signaller.h"
@@ -48,7 +49,7 @@ class wxWindow;
class VideoView : public ExceptionStore, public Signaller
{
public:
- VideoView(FilmViewer* viewer);
+ VideoView(FilmViewer* viewer, bool wake);
virtual ~VideoView() {}
VideoView(VideoView const&) = delete;
@@ -198,6 +199,8 @@ private:
struct timeval _dropped_check_period_start;
int _errored = 0;
int _gets = 0;
+ bool _wake;
+ Waker _waker;
};