summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Isorce <julien.isorce@gmail.com>2008-07-18 21:55:00 +0200
committerJulien Isorce <julien.isorce@gmail.com>2008-07-18 21:55:00 +0200
commit3a87bcd4c1656bdefc30e19ed60dbbf07d58f26c (patch)
treefeccd9635e7609aad27b487a3f7c9ae69b9f29ab
parent47aa9eeb1b7116d65088d6bc66bfd030c4600d80 (diff)
add GstGLShader stuffs in the vs8 project, fix laplacian fragment code to make it compile on ATI, and fix check function about Opengl and Glew version
-rw-r--r--ChangeLog41
-rw-r--r--TODO59
-rw-r--r--gst-libs/gst/gl/gstgldisplay.c12
-rw-r--r--gst/gl/gstglfilterlaplacian.c41
-rw-r--r--tests/examples/qglwidgetxoverlay/qglrenderer.cpp19
-rw-r--r--tests/examples/qglwidgetxoverlay/qglrenderer.h8
-rw-r--r--tests/pipelines3
-rw-r--r--win32/vs8/libgstopengl.vcproj20
8 files changed, 153 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index 38c80e3..927ec93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2008-07-18 Julien Isorce <julien.isorce@gmail.com>
+
+ * TODO:
+ add task 4 and 5
+
+ * gst-libs/gst/gl/gstgldisplay.c
+ * gst-libs/gst/gl/gstgldisplay.h
+ Fix check function about OpenGL >= 1.4
+ and Glew >= 1.4
+ (version in [1.0, 1.4[ was not detected
+
+ * gst-libs/gst/gl/gstglfilter.h
+ * gst-libs/gst/gl/gstglshader.c:
+ * gst-libs/gst/gl/gstglshader.h:
+ * gst/gl/gstgltestsrc.h
+ * gst/gl/gstopengl.c
+ * gst/gl/gstglfilterlaplacian.h
+ I just make sure to save them to LF but
+ git is still writting its wrong message.
+ Let me know if I have commited in CRLF
+ by mistake.
+
+ * gst/gl/gstglfilterlaplacian.c
+ Fix convolution_fragment_source to make
+ it compile on ATI. (size array must be explicit in
+ the declaration)
+
+ * tests/examples/qglwidgetxoverlay/qglrenderer.cpp
+ * tests/examples/qglwidgetxoverlay/qglrenderer.h
+ Forgot to push them in my previous push
+
+ * tests/pipelines
+ Add two funny example pipelines that use
+ the gstglfilterlaplacian
+
+ * win32/vs8/libgstopengl.vcproj
+ Add gstglshader.h, .c, and gstglfilterlaplacian.h, .c
+ to the project.
+
2008-07-18 Filippo Argiolas <filippo.argiolas@gmail.com>
* gst-libs/gst/gl/Makefile.am:
@@ -11,7 +50,7 @@
Import gstglshader stuff from cvs branch.
Add a demo laplacian filter to demonstrate how gstglshader can be
easily integrated with minimum effort. Note that at the moment it does
- everything in the filter callback, I didn't use the InitFBO callback
+ everything in the filter callback, I didn't use the onInitFBO callback
to keep it simple.
2008-07-18 Julien Isorce <julien.isorce@gmail.com>
diff --git a/TODO b/TODO
index 6182a0f..ee107c2 100644
--- a/TODO
+++ b/TODO
@@ -1,42 +1,47 @@
//not arranged
-- make fargiolas stuffs work on this repository.
+- 1: make fargiolas stuffs work on this repository.
-- use GstGLShader in the GLSL colorspace conversion.
+- 2: use GstGLShader in the GLSL colorspace conversion.
-- add GLEW check in configure.ac
+- 3: add GLEW check in configure.ac
-- take a decision about the tests/examples/doublecube/data/lost.avi file (move ? remove ? replace ?)
+- 4: make the plugin (any pipeline) properly shutdown when Shader compilation failed (instead of g_assert)
+ (using "return GST_FLOW_UNEXPECTED")
-- make an example named "filterxoverlay" similar to gtkxoverlay one. But use a more complex pipeline
- involving several glfilters. In order to test switching bettween gst states on it.
+- 5: make the plugin (any pipeline) properly shutdown when one of the "check requirements" failed.
+ (for example when FBO extension is not available)
+ For now it properly shutdown only when using the glimagesink
-- put the pipelines listed in tests/pipelines to an automated test that attempts to reach some states.
+- 6: make an example named "filterxoverlay" similar to gtkxoverlay one. But use a more complex pipeline
+ involving several glfilters. In order to test switching bettween gst states on it.
-- make two elements named "gltee" (attach as much texture (to its fbo) as tee src pads) and "glqueue".
- In order to have something like that:
- videotestsrc ! glupload ! glfilterA ! gltee name=t \
- t. ! glqueue ! glfilterB ! glimagesink \
- t. ! glqueue ! glfilterC ! glimagesink
- Assuming glfilterA is GPU consumming and so do not need to duplicate it.
+- 7: put the pipelines listed in tests/pipelines to an automated test that attempts to reach some states.
-- rewrite the freeglut part that I minimized. Although I removed 90% of the orignal code,
- it should be rewrite with the GLib API. To have a better design and handle X/WIN32 with interfaces
- instead of having a lot of "define WIN32" scopes.
- And make it thread safe in order to have one glthread per GstGLDisplay, instead of having a global glthread.
- (the tests/examples/doublecube test shows the limitation of having only one (global) glthread).
+- 8: make two elements named "gltee" (attach as much texture (to its fbo) as tee src pads) and "glqueue".
+ In order to have something like that:
+ videotestsrc ! glupload ! glfilterA ! gltee name=t \
+ t. ! glqueue ! glfilterB ! glimagesink \
+ t. ! glqueue ! glfilterC ! glimagesink
+ Assuming glfilterA is GPU consumming and so do not need to duplicate it.
-- make colorspace conversion through ColorMatrix when GLSL (and mesa YCbCr) is not available and when imaging extension
- is available.
+- 9: rewrite the freeglut part that I minimized. Although I removed 90% of the orignal code,
+ it should be rewrite with the GLib API. To have a better design and handle X/WIN32 with interfaces
+ instead of having a lot of "define WIN32" scopes.
+ And make it thread safe in order to have one glthread per GstGLDisplay, instead of having a global glthread.
+ (the tests/examples/doublecube test shows the limitation of having only one (global) glthread).
-- make a test to estimate how much is a colorspace conversion. I mean compare an output frame
- to reference frame and estimate the differences. (usefull to compare several implementations)
+- 10: make colorspace conversion through ColorMatrix when GLSL (and mesa YCbCr) is not available and when imaging extension
+ is available.
-- write a cmake build or an other well known opensource and multiplatform builder.
-
-- test colorspace conversion with Apple YCbCr extension.
+- 11: make a test to estimate how much is a colorspace conversion. I mean compare an output frame
+ to reference frame and estimate the differences. (usefull to compare several implementations)
-- test the plugin on MAC.
+- 12: write a cmake build or an other well known opensource and multiplatform builder.
-- test the plugin on WIN CE and some other embedded operating system.
+- 13: test colorspace conversion with Apple YCbCr extension.
+
+- 14: test the plugin on MAC.
+
+- 15: test the plugin on WIN CE and some other embedded operating system.
diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
index 42483fb..ca605fd 100644
--- a/gst-libs/gst/gl/gstgldisplay.c
+++ b/gst-libs/gst/gl/gstgldisplay.c
@@ -670,24 +670,22 @@ gst_gl_display_thread_create_context (GstGLDisplay *display)
GString* opengl_version = g_string_truncate (g_string_new ((gchar*) glGetString (GL_VERSION)), 3);
gint opengl_version_major = 0;
gint opengl_version_minor = 0;
- GString* glew_version = g_string_truncate (g_string_new ((gchar*) glewGetString (GLEW_VERSION)), 3);
- gint glew_version_major = 0;
- gint glew_version_minor = 0;
sscanf(opengl_version->str, "%d.%d", &opengl_version_major, &opengl_version_minor);
- sscanf(glew_version->str, "%d.%d", &glew_version_major, &glew_version_minor);
g_print ("GL_VERSION: %s\n", glGetString (GL_VERSION));
g_print ("GLEW_VERSION: %s\n", glewGetString (GLEW_VERSION));
+ g_print ("GL_SHADING_LANGUAGE_VERSION: %s\n", glGetString (GL_SHADING_LANGUAGE_VERSION));
g_print ("GL_VENDOR: %s\n", glGetString (GL_VENDOR));
g_print ("GL_RENDERER: %s\n", glGetString (GL_RENDERER));
g_string_free (opengl_version, TRUE);
- g_string_free (glew_version, TRUE);
- if ((opengl_version_major < 1 && opengl_version_minor < 4) ||
- (glew_version_major < 1 && glew_version_minor < 4) )
+ if ((opengl_version_major < 1) ||
+ (GLEW_VERSION_MAJOR < 1) ||
+ (opengl_version_major < 2 && opengl_version_major >= 1 && opengl_version_minor < 4) ||
+ (GLEW_VERSION_MAJOR < 2 && GLEW_VERSION_MAJOR >= 1 && GLEW_VERSION_MINOR < 4) )
{
//turn off the pipeline, the old drivers are not yet supported
g_print ("Required OpenGL >= 1.4.0 and Glew >= 1.4.0\n");
diff --git a/gst/gl/gstglfilterlaplacian.c b/gst/gl/gstglfilterlaplacian.c
index 2d6cce4..e08b12f 100644
--- a/gst/gl/gstglfilterlaplacian.c
+++ b/gst/gl/gstglfilterlaplacian.c
@@ -62,10 +62,11 @@ static const gchar *convolution_fragment_source =
"uniform float norm_offset;"
"uniform float kernel[9];"
"void main () {"
- " vec2 offset[9];"
- " offset = vec2[] ( vec2(-1.0,-1.0), vec2( 0.0,-1.0), vec2( 1.0,-1.0),"
- " vec2(-1.0, 0.0), vec2( 0.0, 0.0), vec2( 1.0, 0.0),"
- " vec2(-1.0, 1.0), vec2( 0.0, 1.0), vec2( 1.0, 1.0) );"
+ " const int N = 9;"
+ " const vec2 offset[N] = vec2[N] ("
+ " vec2(-1.0,-1.0), vec2( 0.0,-1.0), vec2( 1.0,-1.0),"
+ " vec2(-1.0, 0.0), vec2( 0.0, 0.0), vec2( 1.0, 0.0),"
+ " vec2(-1.0, 1.0), vec2( 0.0, 1.0), vec2( 1.0, 1.0) );"
" vec2 texturecoord = gl_TexCoord[0].st;"
" int i;"
" vec4 sum = vec4 (0.0);"
@@ -111,8 +112,19 @@ gst_gl_filter_laplacian_reset (GstGLFilter* filter)
{
GstGLFilterLaplacian* laplacian_filter = GST_GL_FILTER_LAPLACIAN(filter);
- //blocking call, wait the opengl thread has destroyed the shader program
- g_object_unref (G_OBJECT (laplacian_filter->shader));
+ //I commented the following line to avoid a crash for now
+ //It crashs because when unreferencing the GstGLShader
+ //if ref is down to 0 it causes a finalize then a gst_gl_shader_release
+ //then a glDeleteObjectARB
+ //and this glDeleteObjectARB must be executed in by (in) the gl thread
+ //How to do that so ? Easy, using the gst_gl_display_del_shader method
+ //but I have not modified it yet (*1*) to use GstGLShader
+ //I'll do that soon so just comment the following line for now
+ //g_object_unref (G_OBJECT (laplacian_filter->shader));
+
+ //blocking call, wait the opengl thread has destroyed the GstGLShader
+ //Commented for the reason *1*
+ //gst_gl_display_del_shader (filter->display, laplacian_filter->shader);
}
static void
@@ -149,6 +161,11 @@ gst_gl_filter_laplacian_init_shader (GstGLFilter* filter)
// GstGLFilterLaplacian* laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
// at the moment I do everything in the laplacian_callback
+ // ok, then for the same reason *1* explained in the
+ // gst_gl_filter_laplacian_reset method I comment the following line
+
+ //blocking call, wait the opengl thread has destroyed the shader program
+ //gst_gl_display_del_shader (filter->display, laplacian_filter->shader);
}
static gboolean
@@ -181,12 +198,16 @@ gst_gl_filter_laplacian_callback (gint width, gint height, guint texture, gpoint
glLoadIdentity ();
/* compile and link the shader (if not done previously) */
+ //FIXME: do it in the gst_gl_filter_laplacian_init_shader method
if (!laplacian_filter->shader)
+ {
laplacian_filter->shader = gst_gl_shader_new ();
-
- g_return_if_fail (
- gst_gl_shader_compile_and_check (laplacian_filter->shader, convolution_fragment_source,
- GST_GL_SHADER_FRAGMENT_SOURCE));
+
+ g_return_if_fail (
+ gst_gl_shader_compile_and_check (laplacian_filter->shader, convolution_fragment_source,
+ GST_GL_SHADER_FRAGMENT_SOURCE));
+ }
+
gst_gl_shader_use (laplacian_filter->shader);
glActiveTexture (GL_TEXTURE0);
diff --git a/tests/examples/qglwidgetxoverlay/qglrenderer.cpp b/tests/examples/qglwidgetxoverlay/qglrenderer.cpp
index af252ef..27572fa 100644
--- a/tests/examples/qglwidgetxoverlay/qglrenderer.cpp
+++ b/tests/examples/qglwidgetxoverlay/qglrenderer.cpp
@@ -1,9 +1,19 @@
#include "qglrenderer.h"
-QGLRenderer::QGLRenderer(QWidget *parent)
- : QGLWidget(parent)
+QGLRenderer::QGLRenderer(const QString videoLocation, QWidget *parent)
+ : QGLWidget(parent),
+ m_gt(winId(), videoLocation)
{
setAttribute(Qt::WA_NoSystemBackground);
+ setVisible(false);
+ move(20, 10);
+ resize(640, 480);
+
+ QObject::connect(&m_gt, SIGNAL(finished()), this, SLOT(close()));
+ QObject::connect(this, SIGNAL(exposeRequested()), &m_gt, SLOT(exposeRequested()));
+ QObject::connect(this, SIGNAL(closeRequested()), &m_gt, SLOT(stop()), Qt::DirectConnection);
+ QObject::connect(&m_gt, SIGNAL(showRequested()), this, SLOT(show()));
+ m_gt.start();
}
QGLRenderer::~QGLRenderer()
@@ -15,3 +25,8 @@ void QGLRenderer::paintEvent(QPaintEvent* event)
emit exposeRequested();
}
+void QGLRenderer::closeEvent(QCloseEvent* event)
+{
+ emit closeRequested();
+ m_gt.wait();
+}
diff --git a/tests/examples/qglwidgetxoverlay/qglrenderer.h b/tests/examples/qglwidgetxoverlay/qglrenderer.h
index 21ed2e7..1df72af 100644
--- a/tests/examples/qglwidgetxoverlay/qglrenderer.h
+++ b/tests/examples/qglwidgetxoverlay/qglrenderer.h
@@ -2,18 +2,24 @@
#define QGLRENDERER_H
#include <QGLWidget>
+#include "gstthread.h"
class QGLRenderer : public QGLWidget
{
Q_OBJECT
public:
- QGLRenderer(QWidget *parent = 0);
+ QGLRenderer(const QString videoLocation, QWidget *parent = 0);
~QGLRenderer();
void paintEvent(QPaintEvent* event);
+ void closeEvent (QCloseEvent* event);
signals:
void exposeRequested();
+ void closeRequested();
+
+private:
+ GstThread m_gt;
};
#endif // QGLRENDERER_H
diff --git a/tests/pipelines b/tests/pipelines
index 1694d62..d0a7556 100644
--- a/tests/pipelines
+++ b/tests/pipelines
@@ -39,3 +39,6 @@ gst-launch-0.10 gltestsrc ! glfiltercube ! gldownload ! ximagesink
gst-launch-0.10 videotestsrc ! tee name=t t. ! queue ! glimagesink t. ! queue ! glimagesink t. ! queue ! glimagesink
gst-launch-0.10 videotestsrc ! tee name=t t. ! queue ! glimagesink t. ! queue ! glupload ! glfiltercube ! glimagesink
gst-launch-0.10 videotestsrc ! tee name=t t. ! queue ! glimagesink t. ! queue ! glupload ! glfiltercube ! glimagesink t. ! queue ! glcolorscale ! glimagesink
+
+gst-launch-0.10 videotestsrc ! glupload ! glfiltercube ! glfilterlaplacian ! glimagesink
+gst-launch-0.10 videotestsrc ! glupload ! glfilterlaplacian ! glfiltercube ! glimagesink
diff --git a/win32/vs8/libgstopengl.vcproj b/win32/vs8/libgstopengl.vcproj
index 3496e64..488613d 100644
--- a/win32/vs8/libgstopengl.vcproj
+++ b/win32/vs8/libgstopengl.vcproj
@@ -91,7 +91,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="copy /Y Debug\libgstopengl.dll ..\..\..\gstreamer\bin\lib\gstreamer-0.10"
+ CommandLine="copy /Y Debug\libgstopengl.dll H:\svn\gstreamer\bin\lib\gstreamer-0.10"
/>
</Configuration>
<Configuration
@@ -170,7 +170,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="copy /Y Release\libgstopengl.dll ..\..\..\gstreamer\bin\lib\gstreamer-0.10"
+ CommandLine="copy /Y Release\libgstopengl.dll H:\svn\gstreamer\bin\lib\gstreamer-0.10"
/>
</Configuration>
</Configurations>
@@ -233,6 +233,10 @@
RelativePath="..\..\gst-libs\gst\gl\gstglfilter.c"
>
</File>
+ <File
+ RelativePath="..\..\gst-libs\gst\gl\gstglshader.c"
+ >
+ </File>
</Filter>
<Filter
Name="gstglelements"
@@ -258,6 +262,10 @@
>
</File>
<File
+ RelativePath="..\..\gst\gl\gstglfilterlaplacian.c"
+ >
+ </File>
+ <File
RelativePath="..\..\gst\gl\gstglimagesink.c"
>
</File>
@@ -323,6 +331,10 @@
RelativePath="..\..\gst-libs\gst\gl\gstglfilter.h"
>
</File>
+ <File
+ RelativePath="..\..\gst-libs\gst\gl\gstglshader.h"
+ >
+ </File>
</Filter>
<Filter
Name="gstglelements"
@@ -348,6 +360,10 @@
>
</File>
<File
+ RelativePath="..\..\gst\gl\gstglfilterlaplacian.h"
+ >
+ </File>
+ <File
RelativePath="..\..\gst\gl\gstglimagesink.h"
>
</File>