Olive
renderthread.h
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program 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 3 of the License, or
9  (at your option) any later version.
10 
11  This program 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.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef RENDERTHREAD_H
22 #define RENDERTHREAD_H
23 
24 #include <QThread>
25 #include <QMutex>
26 #include <QWaitCondition>
27 #include <QOffscreenSurface>
28 #include <QOpenGLContext>
29 #include <QOpenGLFramebufferObject>
30 #include <QOpenGLShaderProgram>
31 
32 struct Sequence;
33 class Effect;
34 
35 class RenderThread : public QThread {
36  Q_OBJECT
37 public:
38  RenderThread();
39  ~RenderThread();
40  void run();
41  QMutex mutex;
42  GLuint front_buffer;
43  GLuint front_texture;
44  Effect* gizmos;
45  void paint();
46  void start_render(QOpenGLContext* share, Sequence* s, const QString &save = nullptr, GLvoid *pixels = nullptr, int pixel_linesize = 0, int idivider = 0);
47  bool did_texture_fail();
48  void cancel();
49 
50 public slots:
51  // cleanup functions
52  void delete_ctx();
53 signals:
54  void ready();
55 private:
56  // cleanup functions
57  void delete_texture();
58  void delete_fbo();
59  void delete_shader_program();
60 
61  QWaitCondition waitCond;
62  QOffscreenSurface surface;
63  QOpenGLContext* share_ctx;
64  QOpenGLContext* ctx;
65  QOpenGLShaderProgram* blend_mode_program;
66  QOpenGLShaderProgram* premultiply_program;
67 
68  GLuint back_buffer_1;
69  GLuint back_buffer_2;
70  GLuint back_texture_1;
71  GLuint back_texture_2;
72 
73  Sequence* seq;
74  int divider;
75  int tex_width;
76  int tex_height;
77  bool queued;
78  bool texture_failed;
79  bool running;
80  QString save_fn;
81  GLvoid *pixel_buffer;
82  int pixel_buffer_linesize;
83 };
84 
85 #endif // RENDERTHREAD_H
Definition: sequence.h:33
Definition: effect.h:166
Definition: renderthread.h:35