summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Xin-yu (王昕宇) <comicfans44@gmail.com>2014-08-26 16:21:42 +0800
committerSebastian Dröge <sebastian@centricular.com>2014-08-28 10:06:00 +0300
commit8d6f745b78e8190cebd9061192975ad88a08efd5 (patch)
tree6e94ead2327d79f02c76c02b45e05689d4bed384
parent9047a01f5ffad768ed97b9b33ea1aa710029fde9 (diff)
downloadgstreamer-plugins-bad-8d6f745b78e8190cebd9061192975ad88a08efd5.tar.gz
gl: qglwtextureshare demo fixes and cleanup
1. glcontextid function is replaced by gstreamer gst_gl_context_new_wrapped . 2. call gst_init before gst_gl_display_new , seems gst_gl_display_new depends on gst_allocator_register , which only worked after gst_init called 3. flush gstreamer OpenGL context before using shared texture, fix flicker problem. https://bugzilla.gnome.org/show_bug.cgi?id=735566
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/glcontextid.h65
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/gstthread.h1
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/main.cpp2
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/pipeline.cpp1
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/pipeline.h1
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp8
-rw-r--r--tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro2
7 files changed, 11 insertions, 69 deletions
diff --git a/tests/examples/gl/qt/qglwtextureshare/glcontextid.h b/tests/examples/gl/qt/qglwtextureshare/glcontextid.h
deleted file mode 100644
index 7c59546f4..000000000
--- a/tests/examples/gl/qt/qglwtextureshare/glcontextid.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
- * Copyright (C) 2009 Andrey Nechypurenko <andreynech@gmail.com>
- * Copyright (C) 2010 Nuno Santos <nunosantos@imaginando.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GLCONTEXTID_H
-#define __GLCONTEXTID_H
-
-#include <gst/gl/gstglconfig.h>
-
-#if GST_GL_HAVE_PLATFORM_WGL
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- #include <Wingdi.h>
- #include <GL/gl.h>
-#elif GST_GL_HAVE_PLATFORM_CGL
- #include <OpenGL/OpenGL.h>
- class NSOpenGLContext;
-#else
- #include <X11/Xlib.h>
- #include <GL/gl.h>
- #include <GL/glu.h>
- #include <GL/glx.h>
-#endif
-
-
-#if GST_GL_HAVE_PLATFORM_WGL
- typedef struct _tagGLContextID
- {
- HGLRC contextId;
- HDC dc;
- } GLContextID;
-#elif GST_GL_HAVE_PLATFORM_CGL
- typedef struct _tagGLContextID
- {
- NSOpenGLContext* contextId;
- } GLContextID;
-#elif GST_GL_HAVE_PLATFORM_GLX
- typedef struct _tagGLContextID
- {
- GLXContext contextId;
- Display *display;
- Window wnd;
- } GLContextID;
-#endif
-
-#endif // __GLCONTEXTID_H
-
diff --git a/tests/examples/gl/qt/qglwtextureshare/gstthread.h b/tests/examples/gl/qt/qglwtextureshare/gstthread.h
index 918859ee0..d18218c5c 100644
--- a/tests/examples/gl/qt/qglwtextureshare/gstthread.h
+++ b/tests/examples/gl/qt/qglwtextureshare/gstthread.h
@@ -26,7 +26,6 @@
#include <gst/gl/gstglcontext.h>
-#include "glcontextid.h"
class Pipeline;
diff --git a/tests/examples/gl/qt/qglwtextureshare/main.cpp b/tests/examples/gl/qt/qglwtextureshare/main.cpp
index f2eb2f11f..9ff8dbaa3 100644
--- a/tests/examples/gl/qt/qglwtextureshare/main.cpp
+++ b/tests/examples/gl/qt/qglwtextureshare/main.cpp
@@ -22,10 +22,12 @@
#include <QApplication>
#include "qglrenderer.h"
+#include <gst/gst.h>
int
main(int argc, char *argv[])
{
+ gst_init (NULL, NULL);
QApplication a(argc, argv);
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
QGLRenderer w(argc > 1 ? argv[1] : "");
diff --git a/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp b/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp
index a7dd4901f..942e1a76e 100644
--- a/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp
+++ b/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp
@@ -42,7 +42,6 @@ Pipeline::~Pipeline()
void
Pipeline::configure()
{
- gst_init (NULL, NULL);
#ifdef Q_WS_WIN
m_loop = g_main_loop_new (NULL, FALSE);
diff --git a/tests/examples/gl/qt/qglwtextureshare/pipeline.h b/tests/examples/gl/qt/qglwtextureshare/pipeline.h
index 5e59f1a04..c2a1c9daa 100644
--- a/tests/examples/gl/qt/qglwtextureshare/pipeline.h
+++ b/tests/examples/gl/qt/qglwtextureshare/pipeline.h
@@ -26,7 +26,6 @@
#include <gst/gl/gstglcontext.h>
-#include "glcontextid.h"
#include "AsyncQueue.h"
diff --git a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp
index 218b8e4a4..c7726d1d9 100644
--- a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp
+++ b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp
@@ -122,6 +122,10 @@ QGLRenderer::newFrame()
this->updateGL();
}
+static void flushGstreamerGL(GstGLContext* context,void *data){
+ context->gl_vtable->Flush();
+}
+
void
QGLRenderer::paintGL()
{
@@ -142,6 +146,10 @@ QGLRenderer::paintGL()
Q_ASSERT(gst_is_gl_memory (mem));
+ GstGLMemory *gl_memory=(GstGLMemory*)mem;
+
+ gst_gl_context_thread_add(gl_memory->context,flushGstreamerGL,NULL);
+
gst_video_info_set_format (&v_info, v_meta->format, v_meta->width,
v_meta->height);
diff --git a/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro b/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro
index 13014ac11..83e67d806 100644
--- a/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro
+++ b/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro
@@ -18,6 +18,7 @@ INCLUDEPATH += \
LIBS += -L"C:/gstreamer/lib" \
-L"C:/gstreamer/bin" \
-lgstreamer-1.0 \
+ -lgstgl-1.0 \
-lgstvideo-1.0 \
-lglib-2.0 \
-lgmodule-2.0 \
@@ -74,7 +75,6 @@ HEADERS += gstthread.h \
pipeline.h \
qglrenderer.h \
AsyncQueue.h \
- glcontextid.h
# Source files
SOURCES += gstthread.cpp \