mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
[159/906] still some source tree reorganize, fixed some issue with headers and ifdefs, moved identity into effects dir
This commit is contained in:
parent
7bbdcce721
commit
77fc214670
6 changed files with 78 additions and 63 deletions
|
@ -25,9 +25,11 @@ libgstopengl_la_SOURCES = \
|
||||||
gltestsrc.h \
|
gltestsrc.h \
|
||||||
gstgltestsrc.c \
|
gstgltestsrc.c \
|
||||||
gstgltestsrc.h \
|
gstgltestsrc.h \
|
||||||
gstgleffects.c \
|
gstgleffects.c \
|
||||||
effects/gstgleffects.h \
|
effects/gstgleffects.h \
|
||||||
effects/gstgleffectsources.h \
|
effects/gstgleffectssources.c \
|
||||||
|
effects/gstgleffectssources.h \
|
||||||
|
effects/gstgleffectidentity.c \
|
||||||
effects/gstgleffectmirror.c
|
effects/gstgleffectmirror.c
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +39,8 @@ libgstopengl_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS) $(GST_BASE_CFLAGS) \
|
||||||
$(GST_PLUGINS_BASE_CFLAGS) $(GL_CFLAGS) \
|
$(GST_PLUGINS_BASE_CFLAGS) $(GL_CFLAGS) \
|
||||||
-I$(top_srcdir)/gst-libs \
|
-I$(top_srcdir)/gst-libs \
|
||||||
-I$(top_srcdir)/gst-libs/gst/freeglut \
|
-I$(top_srcdir)/gst-libs/gst/freeglut \
|
||||||
-I$(top_srcdir)/gst-libs/gst/gl
|
-I$(top_srcdir)/gst-libs/gst/gl \
|
||||||
|
-I$(top_srcdir)/gst/gl/effects
|
||||||
libgstopengl_la_LIBADD = \
|
libgstopengl_la_LIBADD = \
|
||||||
$(top_builddir)/gst-libs/gst/freeglut/libgstfreeglut-$(GST_MAJORMINOR).la \
|
$(top_builddir)/gst-libs/gst/freeglut/libgstfreeglut-$(GST_MAJORMINOR).la \
|
||||||
$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_MAJORMINOR).la \
|
$(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_MAJORMINOR).la \
|
||||||
|
|
40
gst/gl/effects/gstgleffectidentity.c
Normal file
40
gst/gl/effects/gstgleffectidentity.c
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* GStreamer
|
||||||
|
* Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
|
||||||
|
*
|
||||||
|
* 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., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gstgleffects.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_gl_effects_identity_callback (gint width, gint height, guint texture, gpointer data)
|
||||||
|
{
|
||||||
|
GstGLEffects* effects = GST_GL_EFFECTS (data);
|
||||||
|
|
||||||
|
glMatrixMode (GL_PROJECTION);
|
||||||
|
glLoadIdentity ();
|
||||||
|
|
||||||
|
gst_gl_effects_draw_texture (effects, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_gl_effects_identity (GstGLEffects *effects) {
|
||||||
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
|
|
||||||
|
gst_gl_filter_render_to_target (filter, effects->intexture, effects->outtexture,
|
||||||
|
gst_gl_effects_identity_callback, effects);
|
||||||
|
}
|
|
@ -18,12 +18,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#include <gstgleffects.h>
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gstgleffects.h"
|
|
||||||
#include "gstgleffectssources.h"
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_effects_mirror_callback (gint width, gint height, guint texture, gpointer data)
|
gst_gl_effects_mirror_callback (gint width, gint height, guint texture, gpointer data)
|
||||||
|
|
|
@ -26,9 +26,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gstglfilter.h>
|
#include <gstglfilter.h>
|
||||||
|
#include <gstgleffectssources.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
#define GST_TYPE_GL_EFFECTS (gst_gl_effects_get_type())
|
#define GST_TYPE_GL_EFFECTS (gst_gl_effects_get_type())
|
||||||
#define GST_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GL_EFFECTS,GstGLEffects))
|
#define GST_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GL_EFFECTS,GstGLEffects))
|
||||||
#define GST_IS_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GL_EFFECTS))
|
#define GST_IS_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GL_EFFECTS))
|
||||||
|
@ -62,10 +64,18 @@ struct _GstGLEffectsClass
|
||||||
GstGLFilterClass filter_class;
|
GstGLFilterClass filter_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_EFFECT
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gst_gl_effects_get_type (void);
|
GType gst_gl_effects_get_type (void);
|
||||||
|
|
||||||
void gst_gl_effects_draw_texture (GstGLEffects * effects, GLuint tex);
|
void gst_gl_effects_draw_texture (GstGLEffects * effects, GLuint tex);
|
||||||
|
|
||||||
|
void gst_gl_effects_identity (GstGLEffects *effects);
|
||||||
void gst_gl_effects_mirror (GstGLEffects *effects);
|
void gst_gl_effects_mirror (GstGLEffects *effects);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -18,23 +18,11 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <gstgleffects.h>
|
||||||
|
|
||||||
#ifndef __GST_GL_EFFECTS_SOURCES_H__
|
#ifndef __GST_GL_EFFECTS_SOURCES_H__
|
||||||
#define __GST_GL_EFFECTS_SOURCES_H__
|
#define __GST_GL_EFFECTS_SOURCES_H__
|
||||||
|
|
||||||
/* Mirror effect */
|
const gchar *mirror_fragment_source;
|
||||||
static const gchar *mirror_fragment_source =
|
|
||||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
|
||||||
"uniform sampler2DRect tex;"
|
|
||||||
"uniform float width, height;"
|
|
||||||
"void main () {"
|
|
||||||
" vec2 tex_size = vec2 (width, height);"
|
|
||||||
" vec2 texturecoord = gl_TexCoord[0].xy;"
|
|
||||||
" vec2 normcoord;"
|
|
||||||
" normcoord = texturecoord / tex_size - 1.0;"
|
|
||||||
" normcoord.x *= sign (normcoord.x);"
|
|
||||||
" texturecoord = (normcoord + 1.0) * tex_size;"
|
|
||||||
" vec4 color = texture2DRect (tex, texturecoord); "
|
|
||||||
" gl_FragColor = color * gl_Color;"
|
|
||||||
"}";
|
|
||||||
|
|
||||||
#endif /* __GST_GL_EFFECTS_SOURCES_H__ */
|
#endif /* __GST_GL_EFFECTS_SOURCES_H__ */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "effects/gstgleffects.h"
|
#include <gstgleffects.h>
|
||||||
|
|
||||||
#define GST_TYPE_GL_EFFECTS (gst_gl_effects_get_type())
|
#define GST_TYPE_GL_EFFECTS (gst_gl_effects_get_type())
|
||||||
#define GST_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GL_EFFECTS,GstGLEffects))
|
#define GST_GL_EFFECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GL_EFFECTS,GstGLEffects))
|
||||||
|
@ -27,12 +27,6 @@
|
||||||
#define GST_IS_GL_EFFECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) , GST_TYPE_GL_EFFECTS))
|
#define GST_IS_GL_EFFECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) , GST_TYPE_GL_EFFECTS))
|
||||||
#define GST_GL_EFFECTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) , GST_TYPE_GL_EFFECTS,GstGLEffectsClass))
|
#define GST_GL_EFFECTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) , GST_TYPE_GL_EFFECTS,GstGLEffectsClass))
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GST_GL_EFFECT_IDENTITY,
|
|
||||||
GST_GL_EFFECT_MIRROR,
|
|
||||||
GST_GL_N_EFFECTS
|
|
||||||
} GstGLEffectsEffect;
|
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_gl_effects_debug
|
#define GST_CAT_DEFAULT gst_gl_effects_debug
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||||
|
|
||||||
|
@ -53,6 +47,19 @@ static void gst_gl_effects_reset_resources (GstGLFilter* filter);
|
||||||
static gboolean gst_gl_effects_filter (GstGLFilter * filter,
|
static gboolean gst_gl_effects_filter (GstGLFilter * filter,
|
||||||
GstGLBuffer * inbuf, GstGLBuffer * outbuf);
|
GstGLBuffer * inbuf, GstGLBuffer * outbuf);
|
||||||
|
|
||||||
|
static const GstElementDetails element_details = GST_ELEMENT_DETAILS (
|
||||||
|
"Gstreamer OpenGL Effects",
|
||||||
|
"Filter/Effect",
|
||||||
|
"GL Shading Language effects",
|
||||||
|
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GST_GL_EFFECT_IDENTITY,
|
||||||
|
GST_GL_EFFECT_MIRROR,
|
||||||
|
GST_GL_N_EFFECTS
|
||||||
|
} GstGLEffectsEffect;
|
||||||
|
|
||||||
#define GST_TYPE_GL_EFFECTS_EFFECT (gst_gl_effects_effect_get_type ())
|
#define GST_TYPE_GL_EFFECTS_EFFECT (gst_gl_effects_effect_get_type ())
|
||||||
static GType
|
static GType
|
||||||
gst_gl_effects_effect_get_type (void)
|
gst_gl_effects_effect_get_type (void)
|
||||||
|
@ -71,18 +78,7 @@ gst_gl_effects_effect_get_type (void)
|
||||||
return gl_effects_effect_type;
|
return gl_effects_effect_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const GstElementDetails element_details = GST_ELEMENT_DETAILS (
|
/* init resources that need a gl context */
|
||||||
"Gstreamer OpenGL Effects",
|
|
||||||
"Filter/Effect",
|
|
||||||
"GL Shading Language effects",
|
|
||||||
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PROP_0,
|
|
||||||
PROP_EFFECT
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_effects_init_gl_resources (GstGLFilter *filter)
|
gst_gl_effects_init_gl_resources (GstGLFilter *filter)
|
||||||
{
|
{
|
||||||
|
@ -101,6 +97,7 @@ gst_gl_effects_init_gl_resources (GstGLFilter *filter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* free resources that need a gl context */
|
||||||
static void
|
static void
|
||||||
gst_gl_effects_reset_gl_resources (GstGLFilter *filter)
|
gst_gl_effects_reset_gl_resources (GstGLFilter *filter)
|
||||||
{
|
{
|
||||||
|
@ -170,17 +167,7 @@ gst_gl_effects_draw_texture (GstGLEffects * effects, GLuint tex)
|
||||||
glEnd ();
|
glEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
#if 0
|
||||||
gst_gl_effects_identity_callback (gint width, gint height, guint texture, gpointer data)
|
|
||||||
{
|
|
||||||
GstGLEffects* effects = GST_GL_EFFECTS (data);
|
|
||||||
|
|
||||||
glMatrixMode (GL_PROJECTION);
|
|
||||||
glLoadIdentity ();
|
|
||||||
|
|
||||||
gst_gl_effects_draw_texture (effects, texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
change_view (GstGLDisplay *display, gpointer data)
|
change_view (GstGLDisplay *display, gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -196,15 +183,7 @@ change_view (GstGLDisplay *display, gpointer data)
|
||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
glLoadMatrixd (mirrormatrix);
|
glLoadMatrixd (mirrormatrix);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static void
|
|
||||||
gst_gl_effects_identity (GstGLEffects *effects) {
|
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
|
||||||
|
|
||||||
gst_gl_display_thread_add (filter->display, change_view, effects);
|
|
||||||
gst_gl_filter_render_to_target (filter, effects->intexture, effects->outtexture,
|
|
||||||
gst_gl_effects_identity_callback, effects);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_effects_init (GstGLEffects * effects, GstGLEffectsClass * klass)
|
gst_gl_effects_init (GstGLEffects * effects, GstGLEffectsClass * klass)
|
||||||
|
|
Loading…
Reference in a new issue