mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-07 15:02:40 +00:00
glfilterapp: port to gles2 and gl3
This commit is contained in:
parent
1331cbc54e
commit
18ae2d35e9
2 changed files with 40 additions and 16 deletions
|
@ -161,23 +161,42 @@ _emit_draw_signal (guint tex, gint width, gint height, gpointer data)
|
||||||
app_filter->default_draw = !drawn;
|
app_filter->default_draw = !drawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct glcb2
|
||||||
|
{
|
||||||
|
GLCB func;
|
||||||
|
gpointer data;
|
||||||
|
guint texture;
|
||||||
|
guint width;
|
||||||
|
guint height;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* convenience functions to simplify filter development */
|
||||||
|
static void
|
||||||
|
_glcb2 (gpointer data)
|
||||||
|
{
|
||||||
|
struct glcb2 *cb = data;
|
||||||
|
|
||||||
|
cb->func (cb->width, cb->height, cb->texture, cb->data);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_gl_filter_app_filter_texture (GstGLFilter * filter, guint in_tex,
|
gst_gl_filter_app_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
guint out_tex)
|
guint out_tex)
|
||||||
{
|
{
|
||||||
GstGLFilterApp *app_filter = GST_GL_FILTER_APP (filter);
|
GstGLFilterApp *app_filter = GST_GL_FILTER_APP (filter);
|
||||||
|
struct glcb2 cb;
|
||||||
|
|
||||||
|
cb.func = (GLCB) _emit_draw_signal;
|
||||||
|
cb.data = filter;
|
||||||
|
cb.texture = in_tex;
|
||||||
|
cb.width = GST_VIDEO_INFO_WIDTH (&filter->in_info);
|
||||||
|
cb.height = GST_VIDEO_INFO_HEIGHT (&filter->in_info);
|
||||||
|
|
||||||
//blocking call, use a FBO
|
//blocking call, use a FBO
|
||||||
gst_gl_context_use_fbo (filter->context,
|
gst_gl_context_use_fbo_v2 (filter->context,
|
||||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||||
filter->fbo, filter->depthbuffer, out_tex, (GLCB) _emit_draw_signal,
|
filter->fbo, filter->depthbuffer, out_tex, _glcb2, &cb);
|
||||||
GST_VIDEO_INFO_WIDTH (&filter->in_info),
|
|
||||||
GST_VIDEO_INFO_HEIGHT (&filter->in_info),
|
|
||||||
in_tex, 45,
|
|
||||||
(gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
|
|
||||||
(gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
|
||||||
0.1, 100, GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, filter);
|
|
||||||
|
|
||||||
if (app_filter->default_draw) {
|
if (app_filter->default_draw) {
|
||||||
gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
|
gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
|
||||||
|
@ -195,8 +214,12 @@ gst_gl_filter_app_callback (gint width, gint height, guint texture,
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = filter->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
#if GST_GL_HAVE_OPENGL
|
||||||
gl->LoadIdentity ();
|
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
|
||||||
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
|
gl->LoadIdentity ();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gst_gl_filter_draw_texture (filter, texture, width, height);
|
gst_gl_filter_draw_texture (filter, texture, width, height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "gstglcolorscale.h"
|
#include "gstglcolorscale.h"
|
||||||
#include "gstglvideomixer.h"
|
#include "gstglvideomixer.h"
|
||||||
#include "gstglfiltershader.h"
|
#include "gstglfiltershader.h"
|
||||||
|
#include "gstglfilterapp.h"
|
||||||
#if HAVE_GRAPHENE
|
#if HAVE_GRAPHENE
|
||||||
#include "gstgltransformation.h"
|
#include "gstgltransformation.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +64,6 @@
|
||||||
#include "gstgltestsrc.h"
|
#include "gstgltestsrc.h"
|
||||||
#include "gstglfilterlaplacian.h"
|
#include "gstglfilterlaplacian.h"
|
||||||
#include "gstglfilterglass.h"
|
#include "gstglfilterglass.h"
|
||||||
#include "gstglfilterapp.h"
|
|
||||||
#include "gstglfilterblur.h"
|
#include "gstglfilterblur.h"
|
||||||
#include "gstglfilterreflectedscreen.h"
|
#include "gstglfilterreflectedscreen.h"
|
||||||
#include "gstglfiltersobel.h"
|
#include "gstglfiltersobel.h"
|
||||||
|
@ -131,10 +131,16 @@ plugin_init (GstPlugin * plugin)
|
||||||
GST_RANK_NONE, GST_TYPE_GL_VIDEO_MIXER)) {
|
GST_RANK_NONE, GST_TYPE_GL_VIDEO_MIXER)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "glshader",
|
if (!gst_element_register (plugin, "glshader",
|
||||||
GST_RANK_NONE, gst_gl_filtershader_get_type ())) {
|
GST_RANK_NONE, gst_gl_filtershader_get_type ())) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!gst_element_register (plugin, "glfilterapp",
|
||||||
|
GST_RANK_NONE, GST_TYPE_GL_FILTER_APP)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
#if HAVE_JPEG
|
#if HAVE_JPEG
|
||||||
#if HAVE_PNG
|
#if HAVE_PNG
|
||||||
if (!gst_element_register (plugin, "gloverlay",
|
if (!gst_element_register (plugin, "gloverlay",
|
||||||
|
@ -169,11 +175,6 @@ plugin_init (GstPlugin * plugin)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "glfilterapp",
|
|
||||||
GST_RANK_NONE, GST_TYPE_GL_FILTER_APP)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "glfilterreflectedscreen",
|
if (!gst_element_register (plugin, "glfilterreflectedscreen",
|
||||||
GST_RANK_NONE, GST_TYPE_GL_FILTER_REFLECTED_SCREEN)) {
|
GST_RANK_NONE, GST_TYPE_GL_FILTER_REFLECTED_SCREEN)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue