diff options
author | Wang Xin-yu (王昕宇) <comicfans44@gmail.com> | 2014-07-01 08:36:53 +0800 |
---|---|---|
committer | Matthew Waters <ystreet00@gmail.com> | 2014-07-02 14:16:40 +1000 |
commit | 6e4ea66ede09ef71ede3baed6f39f35e198f60fc (patch) | |
tree | 2a7ff9fc7eaf360bd2806406256b03ce2e385bef /tests | |
parent | e050541f11711d2ff8edf4b80213acffbdba7a07 (diff) | |
download | gstreamer-plugins-bad-6e4ea66ede09ef71ede3baed6f39f35e198f60fc.tar.gz |
gl : fix qglwtextureshare demo
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examples/gl/qt/qglwtextureshare/glcontextid.h | 10 | ||||
-rw-r--r-- | tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp | 19 |
2 files changed, 16 insertions, 13 deletions
diff --git a/tests/examples/gl/qt/qglwtextureshare/glcontextid.h b/tests/examples/gl/qt/qglwtextureshare/glcontextid.h index a6c846013..7c59546f4 100644 --- a/tests/examples/gl/qt/qglwtextureshare/glcontextid.h +++ b/tests/examples/gl/qt/qglwtextureshare/glcontextid.h @@ -25,12 +25,12 @@ #include <gst/gl/gstglconfig.h> -#if defined(GST_GL_HAVE_PLATFORM_WGL) +#if GST_GL_HAVE_PLATFORM_WGL #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <Wingdi.h> #include <GL/gl.h> -#elif defined (GST_GL_HAVE_PLATFORM_CGL) +#elif GST_GL_HAVE_PLATFORM_CGL #include <OpenGL/OpenGL.h> class NSOpenGLContext; #else @@ -41,18 +41,18 @@ #endif -#if defined(GST_GL_HAVE_PLATFORM_WGL) +#if GST_GL_HAVE_PLATFORM_WGL typedef struct _tagGLContextID { HGLRC contextId; HDC dc; } GLContextID; -#elif defined(GST_GL_HAVE_PLATFORM_CGL) +#elif GST_GL_HAVE_PLATFORM_CGL typedef struct _tagGLContextID { NSOpenGLContext* contextId; } GLContextID; -#elif defined(GST_GL_HAVE_PLATFORM_GLX) +#elif GST_GL_HAVE_PLATFORM_GLX typedef struct _tagGLContextID { GLXContext contextId; diff --git a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp index c590ac7a3..218b8e4a4 100644 --- a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp +++ b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp @@ -22,6 +22,7 @@ #include <QGLWidget> #include <QApplication> +#include <QDebug> #include <QCloseEvent> #include <gst/video/video.h> @@ -60,11 +61,11 @@ QGLRenderer::initializeGL() display = gst_gl_display_new (); /* FIXME: Allow the choice at runtime */ -#if defined(GST_GL_HAVE_PLATFORM_WGL) +#if GST_GL_HAVE_PLATFORM_WGL context = gst_gl_context_new_wrapped (display, (guintptr) wglGetCurrentContext (), GST_GL_PLATFORM_WGL, GST_GL_API_OPENGL); -#elif defined (GST_GL_HAVE_PLATFORM_CGL) +#elif GST_GL_HAVE_PLATFORM_CGL context = gst_gl_context_new_wrapped (display, (guintptr) qt_current_nsopengl_context(), GST_GL_PLATFORM_CGL, GST_GL_API_OPENGL); -#elif defined(GST_GL_HAVE_PLATFORM_GLX) +#elif GST_GL_HAVE_PLATFORM_GLX context = gst_gl_context_new_wrapped (display, (guintptr) glXGetCurrentContext (), GST_GL_PLATFORM_GLX, GST_GL_API_OPENGL); #endif gst_object_unref (display); @@ -139,15 +140,15 @@ QGLRenderer::paintGL() mem = gst_buffer_peek_memory (this->frame, 0); v_meta = gst_buffer_get_video_meta (this->frame); - if (gst_is_gl_memory (mem)) { - gst_video_info_set_format (&v_info, v_meta->format, v_meta->width, + Q_ASSERT(gst_is_gl_memory (mem)); + + gst_video_info_set_format (&v_info, v_meta->format, v_meta->width, v_meta->height); - gst_video_frame_map (&v_frame, &v_info, this->frame, + gst_video_frame_map (&v_frame, &v_info, this->frame, (GstMapFlags) (GST_MAP_READ | GST_MAP_GL)); - tex_id = *(guint *) v_frame.data[0]; - } + tex_id = *(guint *) v_frame.data[0]; glEnable(GL_DEPTH_TEST); @@ -216,6 +217,8 @@ QGLRenderer::paintGL() zrot+=0.4f; glBindTexture(GL_TEXTURE_2D, 0); + + gst_video_frame_unmap(&v_frame); } } |