]> git.sesse.net Git - nageru/blobdiff - main.cpp
Yet more fixes for clean shutdown.
[nageru] / main.cpp
index a3c3334e798ec2741b2606a4db4745b505663778..a0d8f669ca083085deaca67119451303cd7226a4 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -1,3 +1,8 @@
+extern "C" {
+#include <libavformat/avformat.h>
+}
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <epoxy/gl.h>
 
 #include <QSurfaceFormat>
 
 #include "context.h"
+#include "flags.h"
+#include "image_input.h"
 #include "mainwindow.h"
 #include "mixer.h"
 
 int main(int argc, char *argv[])
 {
-       setenv("QT_XCB_GL_INTEGRATION", "xcb_egl", 0);
+       parse_flags(argc, argv);
+
+       if (global_flags.va_display.empty() ||
+           global_flags.va_display[0] != '/') {
+               // We normally use EGL for zerocopy, but if we use VA against DRM
+               // instead of against X11, we turn it off, and then don't need EGL.
+               setenv("QT_XCB_GL_INTEGRATION", "xcb_egl", 0);
+       }
+       setlinebuf(stdout);
+       av_register_all();
 
        QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
        QApplication app(argc, argv);
@@ -31,10 +47,15 @@ int main(int argc, char *argv[])
        global_share_widget = new QGLWidget();
 
        MainWindow mainWindow;
-       mainWindow.resize(QSize(1500, 670));
+       mainWindow.resize(QSize(1500, 810));
        mainWindow.show();
 
+       app.installEventFilter(&mainWindow);  // For white balance color picking.
+
        int rc = app.exec();
        global_mixer->quit();
+       mainWindow.mixer_shutting_down();
+       delete global_mixer;
+       ImageInput::shutdown_updaters();
        return rc;
 }