Work in progress OpenGL Decoding for gst appsink

This commit is contained in:
Bruno Herbelin
2024-02-04 21:59:58 +01:00
parent 2e0732c75b
commit 00ff0f532f
4 changed files with 27 additions and 21 deletions

View File

@@ -78,6 +78,7 @@ if(UNIX)
else() else()
add_definitions(-DLINUX) add_definitions(-DLINUX)
# add_definitions(-DUSE_GST_OPENGL_SYNC_HANDLER)
# CPACK # CPACK
set(CPACK_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}") set(CPACK_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")

View File

@@ -44,6 +44,9 @@
#define USE_GST_PLAYBIN #define USE_GST_PLAYBIN
#endif #endif
#ifdef USE_GST_OPENGL_SYNC_HANDLER
#include "RenderingManager.h"
#endif
std::list<MediaPlayer*> MediaPlayer::registered_; std::list<MediaPlayer*> MediaPlayer::registered_;

View File

@@ -75,6 +75,10 @@
#include "RenderingManager.h" #include "RenderingManager.h"
#ifdef USE_GST_OPENGL_SYNC_HANDLER #ifdef USE_GST_OPENGL_SYNC_HANDLER
GLFW_EXPOSE_NATIVE_X11
#include <GLFW/glfw3native.h>
// //
// Discarded because not working under OSX - kept in case it would become useful // Discarded because not working under OSX - kept in case it would become useful
// //
@@ -376,25 +380,6 @@ bool Rendering::init()
Log::Info("No hardware decoding plugin found."); Log::Info("No hardware decoding plugin found.");
} }
#ifdef SYNC_GSTREAMER_OPENGL_CONTEXT
#if GST_GL_HAVE_PLATFORM_WGL
global_gl_context = gst_gl_context_new_wrapped (display, (guintptr) wglGetCurrentContext (),
GST_GL_PLATFORM_WGL, GST_GL_API_OPENGL);
#elif GST_GL_HAVE_PLATFORM_CGL
// global_display = GST_GL_DISPLAY ( glfwGetCocoaMonitor(main_.window()) );
global_display = GST_GL_DISPLAY (gst_gl_display_cocoa_new ());
global_gl_context = gst_gl_context_new_wrapped (global_display,
(guintptr) 0,
GST_GL_PLATFORM_CGL, GST_GL_API_OPENGL);
#elif GST_GL_HAVE_PLATFORM_GLX
global_display = (GstGLDisplay*) gst_gl_display_x11_new_with_display( glfwGetX11Display() );
global_gl_context = gst_gl_context_new_wrapped (global_display,
(guintptr) glfwGetGLXContext(main_.window()),
GST_GL_PLATFORM_GLX, GST_GL_API_OPENGL);
#endif
#endif
// //
// Monitors // Monitors
// //
@@ -420,6 +405,25 @@ bool Rendering::init()
// //
outputs_ = std::vector<RenderingWindow>(MAX_OUTPUT_WINDOW); outputs_ = std::vector<RenderingWindow>(MAX_OUTPUT_WINDOW);
#ifdef USE_GST_OPENGL_SYNC_HANDLER
#if GST_GL_HAVE_PLATFORM_WGL
global_gl_context = gst_gl_context_new_wrapped (display, (guintptr) wglGetCurrentContext (),
GST_GL_PLATFORM_WGL, GST_GL_API_OPENGL);
#elif GST_GL_HAVE_PLATFORM_CGL
// global_display = GST_GL_DISPLAY ( glfwGetCocoaMonitor(main_.window()) );
global_display = GST_GL_DISPLAY (gst_gl_display_cocoa_new ());
global_gl_context = gst_gl_context_new_wrapped (global_display,
(guintptr) 0,
GST_GL_PLATFORM_CGL, GST_GL_API_OPENGL);
#elif GST_GL_HAVE_PLATFORM_GLX
global_display = (GstGLDisplay*) gst_gl_display_x11_new_with_display( glfwGetX11Display() );
global_gl_context = gst_gl_context_new_wrapped (global_display,
(guintptr) glfwGetGLXContext(main_.window()),
GST_GL_PLATFORM_GLX, GST_GL_API_OPENGL);
#endif
#endif
return true; return true;
} }

View File

@@ -11,8 +11,6 @@
#include "Screenshot.h" #include "Screenshot.h"
//#define USE_GST_OPENGL_SYNC_HANDLER
typedef struct GLFWmonitor GLFWmonitor; typedef struct GLFWmonitor GLFWmonitor;
typedef struct GLFWwindow GLFWwindow; typedef struct GLFWwindow GLFWwindow;
class FrameBuffer; class FrameBuffer;