]> git.sesse.net Git - nageru/blob - main.cpp
Support VA-API readback through glGetTexImage() instead of zerocopy.
[nageru] / main.cpp
1 extern "C" {
2 #include <libavformat/avformat.h>
3 }
4 #include <stdbool.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <epoxy/gl.h>
8
9 #include <QApplication>
10 #include <QCoreApplication>
11 #include <QGL>
12 #include <QSize>
13 #include <QSurfaceFormat>
14
15 #include "context.h"
16 #include "flags.h"
17 #include "mainwindow.h"
18 #include "mixer.h"
19
20 int main(int argc, char *argv[])
21 {
22         parse_flags(argc, argv);
23
24         if (global_flags.va_display.empty() ||
25             global_flags.va_display[0] != '/') {
26                 // We normally use EGL for zerocopy, but if we use VA against DRM
27                 // instead of against X11, we turn it off, and then don't need EGL.
28                 setenv("QT_XCB_GL_INTEGRATION", "xcb_egl", 0);
29         }
30         setlinebuf(stdout);
31         av_register_all();
32
33         QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
34         QApplication app(argc, argv);
35
36         QSurfaceFormat fmt;
37         fmt.setDepthBufferSize(0);
38         fmt.setStencilBufferSize(0);
39         fmt.setProfile(QSurfaceFormat::CoreProfile);
40         fmt.setMajorVersion(3);
41         fmt.setMinorVersion(1);
42         QSurfaceFormat::setDefaultFormat(fmt);
43
44         QGLFormat::setDefaultFormat(QGLFormat::fromSurfaceFormat(fmt));
45
46         global_share_widget = new QGLWidget();
47
48         MainWindow mainWindow;
49         mainWindow.resize(QSize(1500, 810));
50         mainWindow.show();
51
52         app.installEventFilter(&mainWindow);  // For white balance color picking.
53
54         int rc = app.exec();
55         global_mixer->quit();
56         mainWindow.mixer_shutting_down();
57         delete global_mixer;
58         return rc;
59 }