]> git.sesse.net Git - nageru/commitdiff
Unify context.cpp from Nageru and Futatabi.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 2 Dec 2018 20:20:25 +0000 (21:20 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 2 Dec 2018 20:20:25 +0000 (21:20 +0100)
15 files changed:
futatabi/main.cpp
futatabi/meson.build
futatabi/player.cpp
futatabi/video_stream.cpp
nageru/analyzer.cpp
nageru/context.cpp [deleted file]
nageru/decklink_output.h
nageru/glwidget.cpp
nageru/main.cpp
nageru/meson.build
nageru/mixer.cpp
nageru/quicksync_encoder.cpp
shared/context.cpp [moved from futatabi/context.cpp with 100% similarity]
shared/context.h [moved from futatabi/context.h with 100% similarity]
shared/meson.build

index 58a131aa26c50e836b1b2ead40687f1f9553d57b..b885c81d82858af66253d6156c99cc748d9a7129 100644 (file)
@@ -20,7 +20,7 @@ extern "C" {
 }
 
 #include "clip_list.h"
-#include "context.h"
+#include "shared/context.h"
 #include "defs.h"
 #include "disk_space_estimator.h"
 #include "shared/ffmpeg_raii.h"
index 04e003a34d944978a0a0b2964f731e515d278fbd..3f82d8d72bf7dad74566669e828716a6129ac882 100644 (file)
@@ -34,7 +34,7 @@ moc_files = qt5.preprocess(
 srcs = ['flow.cpp', 'gpu_timers.cpp']
 
 # All the other files.
-srcs += ['main.cpp', 'player.cpp', 'httpd.cpp', 'video_stream.cpp', 'context.cpp', 'chroma_subsampler.cpp']
+srcs += ['main.cpp', 'player.cpp', 'httpd.cpp', 'video_stream.cpp', 'chroma_subsampler.cpp']
 srcs += ['vaapi_jpeg_decoder.cpp', 'db.cpp', 'disk_space_estimator.cpp', 'ycbcr_converter.cpp', 'flags.cpp']
 srcs += ['mainwindow.cpp', 'jpeg_frame_view.cpp', 'clip_list.cpp', 'frame_on_disk.cpp']
 srcs += moc_files
index 99edd865ed95f97b73880b8dac63076442ae02d9..816f72d216662169ba79e688da6f1b054bb30613 100644 (file)
@@ -1,7 +1,7 @@
 #include "player.h"
 
 #include "clip_list.h"
-#include "context.h"
+#include "shared/context.h"
 #include "defs.h"
 #include "shared/ffmpeg_raii.h"
 #include "frame_on_disk.h"
index 3df272ac08b5836b6f49c3277bff6de5504c3ef6..52612e2f53996756a3c2d67f8fccf9cc13a3b3cc 100644 (file)
@@ -6,7 +6,7 @@ extern "C" {
 }
 
 #include "chroma_subsampler.h"
-#include "context.h"
+#include "shared/context.h"
 #include "flags.h"
 #include "flow.h"
 #include "httpd.h"
index b24b46a26ff52457ae3893f7cbf6b1253a1b2f24..bdb80bc31b52c46d98ee4540220c606e706fd594 100644 (file)
@@ -9,7 +9,7 @@
 #include <movit/resource_pool.h>
 #include <movit/util.h>
 
-#include "context.h"
+#include "shared/context.h"
 #include "flags.h"
 #include "mixer.h"
 #include "ui_analyzer.h"
diff --git a/nageru/context.cpp b/nageru/context.cpp
deleted file mode 100644 (file)
index eb62183..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <stdio.h>
-
-#include <string>
-
-#include <QGL>
-#include <QOffscreenSurface>
-#include <QOpenGLContext>
-#include <QSurface>
-#include <QSurfaceFormat>
-
-QGLWidget *global_share_widget = nullptr;
-bool using_egl = false;
-
-using namespace std;
-
-QSurface *create_surface(const QSurfaceFormat &format)
-{
-       QOffscreenSurface *surface = new QOffscreenSurface;
-       surface->setFormat(format);
-       surface->create();
-       if (!surface->isValid()) {
-               fprintf(stderr, "ERROR: surface not valid!\n");
-               exit(1);
-       }
-       return surface;
-}
-
-QSurface *create_surface_with_same_format(const QSurface *surface)
-{
-       return create_surface(surface->format());
-}
-
-QOpenGLContext *create_context(const QSurface *surface)
-{
-       QOpenGLContext *context = new QOpenGLContext;
-       context->setShareContext(global_share_widget->context()->contextHandle());
-       context->setFormat(surface->format());
-       context->create();
-       return context;
-}
-
-bool make_current(QOpenGLContext *context, QSurface *surface)
-{
-       return context->makeCurrent(surface);
-}
-
-void delete_context(QOpenGLContext *context)
-{
-       delete context;
-}
index 29ea29c177481fbe3d3850de8e6cdbb9b79bb1fb..90b89a22a18f1f6e0de7a9352d94d437415f79f3 100644 (file)
@@ -17,7 +17,7 @@
 #include "DeckLinkAPITypes.h"
 #include "LinuxCOM.h"
 
-#include "context.h"
+#include "shared/context.h"
 #include "print_latency.h"
 #include "quittable_sleeper.h"
 #include "ref_counted_frame.h"
index 8316824693ce010826128ddc8f969812fc30deb4..e6c2c582853a1bfe894e7df5dabc465104acbdc1 100644 (file)
@@ -20,7 +20,7 @@
 #include <utility>
 
 #include "audio_mixer.h"
-#include "context.h"
+#include "shared/context.h"
 #include "context_menus.h"
 #include "flags.h"
 #include "mainwindow.h"
index c1a52c0489a6d7b4e9054da338635290846cf1cb..d5654a5a07c4ef26bb8924b7fa8cd7f1362cc827 100644 (file)
@@ -24,7 +24,7 @@ extern "C" {
 #ifdef HAVE_CEF
 #include "nageru_cef_app.h"
 #endif
-#include "context.h"
+#include "shared/context.h"
 #include "flags.h"
 #include "image_input.h"
 #include "mainwindow.h"
@@ -68,7 +68,6 @@ int main(int argc, char *argv[])
                // 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);
-               using_egl = true;
        }
        setlinebuf(stdout);
 #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 9, 100)
index 6b5b7c6afbea4ae208bbc2415b0b8bdf22900373..1fb60e674f591bee7afc8af97103d48133a55f6b 100644 (file)
@@ -161,7 +161,7 @@ nageru_link_with += audio
 
 # Mixer objects.
 srcs += ['chroma_subsampler.cpp', 'v210_converter.cpp', 'mixer.cpp', 'pbo_frame_allocator.cpp',
-       'context.cpp', 'theme.cpp', 'image_input.cpp', 'alsa_output.cpp',
+       'theme.cpp', 'image_input.cpp', 'alsa_output.cpp',
        'disk_space_estimator.cpp', 'timecode_renderer.cpp', 'tweaked_inputs.cpp']
 
 # Streaming and encoding objects (largely the set that is shared between Nageru and Kaeru).
index 2f6a8ebafc1018ddbc90ce7db9368b5594070f15..3a5783ba0c46c3316808e843212d0328cc1cdb98 100644 (file)
@@ -37,7 +37,7 @@
 #include "cef_capture.h"
 #endif
 #include "chroma_subsampler.h"
-#include "context.h"
+#include "shared/context.h"
 #include "decklink_capture.h"
 #include "decklink_output.h"
 #include "defs.h"
index 58f4172a900a84fa4b421306aeb117c54743c55b..ded20f65e5d9fc09b8ba94bf1561cca3fa1ed27d 100644 (file)
@@ -45,7 +45,7 @@ extern "C" {
 }  // namespace
 
 #include "audio_encoder.h"
-#include "context.h"
+#include "shared/context.h"
 #include "defs.h"
 #include "disk_space_estimator.h"
 #include "shared/ffmpeg_raii.h"
similarity index 100%
rename from futatabi/context.cpp
rename to shared/context.cpp
similarity index 100%
rename from futatabi/context.h
rename to shared/context.h
index 2afff9e5ead674b3cd5fee1571d1baffe659c0f2..8d1b203c7cd56e65feecd9eceea757f3dc3926f4 100644 (file)
@@ -1,6 +1,8 @@
+qt5 = import('qt5')
+qt5deps = dependency('qt5', modules: ['OpenGL'])
 
-srcs = ['memcpy_interleaved.cpp', 'metacube2.cpp', 'ffmpeg_raii.cpp', 'mux.cpp', 'metrics.cpp']
-shared = static_library('shared', srcs, include_directories: top_include)
+srcs = ['memcpy_interleaved.cpp', 'metacube2.cpp', 'ffmpeg_raii.cpp', 'mux.cpp', 'metrics.cpp', 'context.cpp']
+shared = static_library('shared', srcs, include_directories: top_include, dependencies: qt5deps)
 shareddep = declare_dependency(
    include_directories: top_include,
    link_with: shared)