2 Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "video_view.h"
22 #include "lib/signaller.h"
23 #include "lib/position.h"
25 #include <wx/glcanvas.h>
27 #include <boost/shared_ptr.hpp>
28 #include <boost/thread.hpp>
29 #include <boost/thread/condition.hpp>
33 class GLVideoView : public VideoView
36 GLVideoView (FilmViewer* viewer, wxWindow* parent);
39 void set_image (boost::shared_ptr<const Image> image);
40 wxWindow* get () const {
47 bool display_next_frame (bool);
49 bool vsync_enabled () const {
50 return _vsync_enabled;
54 void draw (Position<int> inter_position, dcp::Size inter_size);
56 void request_one_shot ();
58 void check_for_butler_errors ();
60 /* Mutex for use of _canvas; it's only contended when our ::thread
61 is started up so this may be overkill.
63 boost::mutex _canvas_mutex;
65 wxGLContext* _context;
68 boost::optional<dcp::Size> _size;
71 boost::thread _thread;
73 boost::mutex _playing_mutex;
74 boost::condition _playing_condition;
78 boost::shared_ptr<wxTimer> _timer;