[159/906] still some source tree reorganize, fixed some issue with headers and ifdefs...
authorFilippo Argiolas <filippo.argiolas@gmail.com>
Wed, 13 Aug 2008 20:36:13 +0000 (22:36 +0200)
committerMatthew Waters <ystreet00@gmail.com>
Sat, 15 Mar 2014 17:36:24 +0000 (18:36 +0100)
gst/gl/Makefile.am
gst/gl/effects/gstgleffectidentity.c [new file with mode: 0644]
gst/gl/effects/gstgleffectmirror.c
gst/gl/effects/gstgleffects.h
gst/gl/effects/gstgleffectssources.h
gst/gl/gstgleffects.c

index 5b49503..0fe8339 100644 (file)
@@ -25,9 +25,11 @@ libgstopengl_la_SOURCES = \
         gltestsrc.h \
        gstgltestsrc.c \
        gstgltestsrc.h \
-       gstgleffects.c \ 
+       gstgleffects.c \
        effects/gstgleffects.h \
-       effects/gstgleffectsources.h \
+       effects/gstgleffectssources.c \
+       effects/gstgleffectssources.h \
+       effects/gstgleffectidentity.c \
        effects/gstgleffectmirror.c
        
 
@@ -37,7 +39,8 @@ libgstopengl_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS) $(GST_BASE_CFLAGS) \
        $(GST_PLUGINS_BASE_CFLAGS) $(GL_CFLAGS) \
        -I$(top_srcdir)/gst-libs \
        -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 = \
        $(top_builddir)/gst-libs/gst/freeglut/libgstfreeglut-$(GST_MAJORMINOR).la \
        $(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_MAJORMINOR).la \
diff --git a/gst/gl/effects/gstgleffectidentity.c b/gst/gl/effects/gstgleffectidentity.c
new file mode 100644 (file)
index 0000000..39401db
--- /dev/null
@@ -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);
+}
index 5f6e110..11f3ad8 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstgleffects.h"
-#include "gstgleffectssources.h"
+#include <gstgleffects.h>
 
 static void
 gst_gl_effects_mirror_callback (gint width, gint height, guint texture, gpointer data)
index 77ed462..174341b 100644 (file)
 #endif
 
 #include <gstglfilter.h>
+#include <gstgleffectssources.h>
 
 G_BEGIN_DECLS
 
+
 #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_IS_GL_EFFECTS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GL_EFFECTS))
@@ -62,10 +64,18 @@ struct _GstGLEffectsClass
   GstGLFilterClass filter_class;
 };
 
+enum
+{
+  PROP_0,
+  PROP_EFFECT
+};
+
+
 GType gst_gl_effects_get_type (void);
 
 void gst_gl_effects_draw_texture (GstGLEffects * effects, GLuint tex);
 
+void gst_gl_effects_identity (GstGLEffects *effects);
 void gst_gl_effects_mirror (GstGLEffects *effects);
 
 G_END_DECLS
index 78097e7..f58fe89 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#include <gstgleffects.h>
+
 #ifndef __GST_GL_EFFECTS_SOURCES_H__
 #define __GST_GL_EFFECTS_SOURCES_H__
 
-/* Mirror effect */
-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;"
-  "}";
+const gchar *mirror_fragment_source;
 
 #endif /* __GST_GL_EFFECTS_SOURCES_H__ */
index f85f063..43b0178 100644 (file)
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include "effects/gstgleffects.h"
+#include <gstgleffects.h>
 
 #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_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))
 
-typedef enum {
-  GST_GL_EFFECT_IDENTITY,
-  GST_GL_EFFECT_MIRROR,
-  GST_GL_N_EFFECTS
-} GstGLEffectsEffect;
-
 #define GST_CAT_DEFAULT gst_gl_effects_debug
 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,
                                       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 ())
 static GType
 gst_gl_effects_effect_get_type (void)
@@ -71,18 +78,7 @@ gst_gl_effects_effect_get_type (void)
   return gl_effects_effect_type;
 }
 
-static const GstElementDetails element_details = GST_ELEMENT_DETAILS (
-  "Gstreamer OpenGL Effects",
-  "Filter/Effect",
-  "GL Shading Language effects",
-  "Filippo Argiolas <filippo.argiolas@gmail.com>");
-
-enum
-{
-  PROP_0,
-  PROP_EFFECT
-};
-
+/* init resources that need a gl context */
 static void
 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
 gst_gl_effects_reset_gl_resources (GstGLFilter *filter)
 {
@@ -170,17 +167,7 @@ gst_gl_effects_draw_texture (GstGLEffects * effects, GLuint tex)
   glEnd ();
 }
 
-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);
-}
-
+#if 0
 static void
 change_view (GstGLDisplay *display, gpointer data)
 {
@@ -196,15 +183,7 @@ change_view (GstGLDisplay *display, gpointer data)
   glMatrixMode (GL_MODELVIEW);
   glLoadMatrixd (mirrormatrix);
 }
-
-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);
-}
+#endif
 
 static void
 gst_gl_effects_init (GstGLEffects * effects, GstGLEffectsClass * klass)