mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:26:14 +00:00
[308/906] Rename glpixbufoverlay to gloverlay
This commit is contained in:
parent
72691ce147
commit
4778241500
5 changed files with 102 additions and 102 deletions
|
@ -29,7 +29,7 @@ endif (WIN32)
|
||||||
|
|
||||||
if (PNG_FOUND AND ZLIB_FOUND)
|
if (PNG_FOUND AND ZLIB_FOUND)
|
||||||
set(OTHER_ELEMENTS
|
set(OTHER_ELEMENTS
|
||||||
gstglpixbufoverlay.c
|
gstgloverlay.c
|
||||||
gstgldifferencematte.c
|
gstgldifferencematte.c
|
||||||
gstglbumper.c)
|
gstglbumper.c)
|
||||||
endif (PNG_FOUND AND ZLIB_FOUND)
|
endif (PNG_FOUND AND ZLIB_FOUND)
|
||||||
|
|
|
@ -27,7 +27,7 @@ libgstopengl_la_SOURCES = \
|
||||||
gstglcolorscale.c \
|
gstglcolorscale.c \
|
||||||
gstglcolorscale.h \
|
gstglcolorscale.h \
|
||||||
gstgldifferencematte.c \
|
gstgldifferencematte.c \
|
||||||
gstglpixbufoverlay.c \
|
gstgloverlay.c \
|
||||||
gltestsrc.c \
|
gltestsrc.c \
|
||||||
gltestsrc.h \
|
gltestsrc.h \
|
||||||
gstgltestsrc.c \
|
gstgltestsrc.c \
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:element-glpixbufoverlay
|
* SECTION:element-gloverlay
|
||||||
*
|
*
|
||||||
* Overlay GL video texture with a PNG image
|
* Overlay GL video texture with a PNG image
|
||||||
*
|
*
|
||||||
* <refsect2>
|
* <refsect2>
|
||||||
* <title>Examples</title>
|
* <title>Examples</title>
|
||||||
* |[
|
* |[
|
||||||
* gst-launch videotestsrc ! "video/x-raw-rgb" ! glupload ! glpixbufoverlay location=imagefile ! glimagesink
|
* gst-launch videotestsrc ! "video/x-raw-rgb" ! glupload ! gloverlay location=imagefile ! glimagesink
|
||||||
* ]|
|
* ]|
|
||||||
* FBO (Frame Buffer Object) is required.
|
* FBO (Frame Buffer Object) is required.
|
||||||
* </refsect2>
|
* </refsect2>
|
||||||
|
@ -40,14 +40,14 @@
|
||||||
#include <gstglfilter.h>
|
#include <gstglfilter.h>
|
||||||
#include <gstgleffectssources.h>
|
#include <gstgleffectssources.h>
|
||||||
|
|
||||||
#define GST_TYPE_GL_PIXBUFOVERLAY (gst_gl_pixbufoverlay_get_type())
|
#define GST_TYPE_GL_OVERLAY (gst_gl_overlay_get_type())
|
||||||
#define GST_GL_PIXBUFOVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GL_PIXBUFOVERLAY,GstGLPixbufOverlay))
|
#define GST_GL_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_GL_OVERLAY,GstGLOverlay))
|
||||||
#define GST_IS_GL_PIXBUFOVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GL_PIXBUFOVERLAY))
|
#define GST_IS_GL_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GL_OVERLAY))
|
||||||
#define GST_GL_PIXBUFOVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) , GST_TYPE_GL_PIXBUFOVERLAY,GstGLPixbufOverlayClass))
|
#define GST_GL_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) , GST_TYPE_GL_OVERLAY,GstGLOverlayClass))
|
||||||
#define GST_IS_GL_PIXBUFOVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) , GST_TYPE_GL_PIXBUFOVERLAY))
|
#define GST_IS_GL_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) , GST_TYPE_GL_OVERLAY))
|
||||||
#define GST_GL_PIXBUFOVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) , GST_TYPE_GL_PIXBUFOVERLAY,GstGLPixbufOverlayClass))
|
#define GST_GL_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) , GST_TYPE_GL_OVERLAY,GstGLOverlayClass))
|
||||||
|
|
||||||
struct _GstGLPixbufOverlay
|
struct _GstGLOverlay
|
||||||
{
|
{
|
||||||
GstGLFilter filter;
|
GstGLFilter filter;
|
||||||
|
|
||||||
|
@ -61,38 +61,38 @@ struct _GstGLPixbufOverlay
|
||||||
// gboolean stretch;
|
// gboolean stretch;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstGLPixbufOverlayClass
|
struct _GstGLOverlayClass
|
||||||
{
|
{
|
||||||
GstGLFilterClass filter_class;
|
GstGLFilterClass filter_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _GstGLPixbufOverlay GstGLPixbufOverlay;
|
typedef struct _GstGLOverlay GstGLOverlay;
|
||||||
typedef struct _GstGLPixbufOverlayClass GstGLPixbufOverlayClass;
|
typedef struct _GstGLOverlayClass GstGLOverlayClass;
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_gl_pixbufoverlay_debug
|
#define GST_CAT_DEFAULT gst_gl_overlay_debug
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||||
|
|
||||||
#define DEBUG_INIT(bla) \
|
#define DEBUG_INIT(bla) \
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_gl_pixbufoverlay_debug, "glpixbufoverlay", 0, "glpixbufoverlay element");
|
GST_DEBUG_CATEGORY_INIT (gst_gl_overlay_debug, "gloverlay", 0, "gloverlay element");
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstGLPixbufOverlay, gst_gl_pixbufoverlay, GstGLFilter,
|
GST_BOILERPLATE_FULL (GstGLOverlay, gst_gl_overlay, GstGLFilter,
|
||||||
GST_TYPE_GL_FILTER, DEBUG_INIT);
|
GST_TYPE_GL_FILTER, DEBUG_INIT);
|
||||||
|
|
||||||
static void gst_gl_pixbufoverlay_set_property (GObject * object, guint prop_id,
|
static void gst_gl_overlay_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec);
|
const GValue * value, GParamSpec * pspec);
|
||||||
static void gst_gl_pixbufoverlay_get_property (GObject * object, guint prop_id,
|
static void gst_gl_overlay_get_property (GObject * object, guint prop_id,
|
||||||
GValue * value, GParamSpec * pspec);
|
GValue * value, GParamSpec * pspec);
|
||||||
|
|
||||||
static void gst_gl_pixbufoverlay_init_resources (GstGLFilter* filter);
|
static void gst_gl_overlay_init_resources (GstGLFilter* filter);
|
||||||
static void gst_gl_pixbufoverlay_reset_resources (GstGLFilter* filter);
|
static void gst_gl_overlay_reset_resources (GstGLFilter* filter);
|
||||||
|
|
||||||
static gboolean gst_gl_pixbufoverlay_filter (GstGLFilter * filter,
|
static gboolean gst_gl_overlay_filter (GstGLFilter * filter,
|
||||||
GstGLBuffer * inbuf, GstGLBuffer * outbuf);
|
GstGLBuffer * inbuf, GstGLBuffer * outbuf);
|
||||||
|
|
||||||
static gboolean gst_gl_pixbufoverlay_loader (GstGLFilter* filter);
|
static gboolean gst_gl_overlay_loader (GstGLFilter* filter);
|
||||||
|
|
||||||
static const GstElementDetails element_details = GST_ELEMENT_DETAILS (
|
static const GstElementDetails element_details = GST_ELEMENT_DETAILS (
|
||||||
"Gstreamer OpenGL PixbufOverlay",
|
"Gstreamer OpenGL Overlay",
|
||||||
"Filter/Effect",
|
"Filter/Effect",
|
||||||
"Overlay GL video texture with a PNG image",
|
"Overlay GL video texture with a PNG image",
|
||||||
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
||||||
|
@ -112,22 +112,22 @@ enum
|
||||||
|
|
||||||
/* init resources that need a gl context */
|
/* init resources that need a gl context */
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_init_gl_resources (GstGLFilter *filter)
|
gst_gl_overlay_init_gl_resources (GstGLFilter *filter)
|
||||||
{
|
{
|
||||||
// GstGLPixbufOverlay *pixbufoverlay = GST_GL_PIXBUFOVERLAY (filter);
|
// GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free resources that need a gl context */
|
/* free resources that need a gl context */
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_reset_gl_resources (GstGLFilter *filter)
|
gst_gl_overlay_reset_gl_resources (GstGLFilter *filter)
|
||||||
{
|
{
|
||||||
GstGLPixbufOverlay *pixbufoverlay = GST_GL_PIXBUFOVERLAY (filter);
|
GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
||||||
|
|
||||||
glDeleteTextures (1, &pixbufoverlay->pbuftexture);
|
glDeleteTextures (1, &overlay->pbuftexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_base_init (gpointer klass)
|
gst_gl_overlay_base_init (gpointer klass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
|
@ -135,19 +135,19 @@ gst_gl_pixbufoverlay_base_init (gpointer klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_class_init (GstGLPixbufOverlayClass * klass)
|
gst_gl_overlay_class_init (GstGLOverlayClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
gobject_class->set_property = gst_gl_pixbufoverlay_set_property;
|
gobject_class->set_property = gst_gl_overlay_set_property;
|
||||||
gobject_class->get_property = gst_gl_pixbufoverlay_get_property;
|
gobject_class->get_property = gst_gl_overlay_get_property;
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_pixbufoverlay_filter;
|
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_overlay_filter;
|
||||||
GST_GL_FILTER_CLASS (klass)->display_init_cb = gst_gl_pixbufoverlay_init_gl_resources;
|
GST_GL_FILTER_CLASS (klass)->display_init_cb = gst_gl_overlay_init_gl_resources;
|
||||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb = gst_gl_pixbufoverlay_reset_gl_resources;
|
GST_GL_FILTER_CLASS (klass)->display_reset_cb = gst_gl_overlay_reset_gl_resources;
|
||||||
GST_GL_FILTER_CLASS (klass)->onStart = gst_gl_pixbufoverlay_init_resources;
|
GST_GL_FILTER_CLASS (klass)->onStart = gst_gl_overlay_init_resources;
|
||||||
GST_GL_FILTER_CLASS (klass)->onStop = gst_gl_pixbufoverlay_reset_resources;
|
GST_GL_FILTER_CLASS (klass)->onStop = gst_gl_overlay_reset_resources;
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_LOCATION,
|
PROP_LOCATION,
|
||||||
|
@ -166,9 +166,9 @@ gst_gl_pixbufoverlay_class_init (GstGLPixbufOverlayClass * klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_gl_pixbufoverlay_draw_texture (GstGLPixbufOverlay * pixbufoverlay, GLuint tex)
|
gst_gl_overlay_draw_texture (GstGLOverlay * overlay, GLuint tex)
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (pixbufoverlay);
|
GstGLFilter *filter = GST_GL_FILTER (overlay);
|
||||||
|
|
||||||
gfloat width = (gfloat) filter->width;
|
gfloat width = (gfloat) filter->width;
|
||||||
gfloat height = (gfloat) filter->height;
|
gfloat height = (gfloat) filter->height;
|
||||||
|
@ -190,18 +190,18 @@ gst_gl_pixbufoverlay_draw_texture (GstGLPixbufOverlay * pixbufoverlay, GLuint te
|
||||||
|
|
||||||
glEnd ();
|
glEnd ();
|
||||||
|
|
||||||
if (pixbufoverlay->pbuftexture == 0) return;
|
if (overlay->pbuftexture == 0) return;
|
||||||
|
|
||||||
// if (pixbufoverlay->stretch) {
|
// if (overlay->stretch) {
|
||||||
width = (gfloat) pixbufoverlay->width;
|
width = (gfloat) overlay->width;
|
||||||
height = (gfloat) pixbufoverlay->height;
|
height = (gfloat) overlay->height;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, pixbufoverlay->pbuftexture);
|
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, overlay->pbuftexture);
|
||||||
|
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
|
|
||||||
|
@ -221,39 +221,39 @@ gst_gl_pixbufoverlay_draw_texture (GstGLPixbufOverlay * pixbufoverlay, GLuint te
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_init (GstGLPixbufOverlay * pixbufoverlay,
|
gst_gl_overlay_init (GstGLOverlay * overlay,
|
||||||
GstGLPixbufOverlayClass * klass)
|
GstGLOverlayClass * klass)
|
||||||
{
|
{
|
||||||
pixbufoverlay->location = NULL;
|
overlay->location = NULL;
|
||||||
pixbufoverlay->pixbuf = NULL;
|
overlay->pixbuf = NULL;
|
||||||
pixbufoverlay->pbuftexture = 0;
|
overlay->pbuftexture = 0;
|
||||||
pixbufoverlay->pbuftexture = 0;
|
overlay->pbuftexture = 0;
|
||||||
pixbufoverlay->width = 0;
|
overlay->width = 0;
|
||||||
pixbufoverlay->height = 0;
|
overlay->height = 0;
|
||||||
// pixbufoverlay->stretch = TRUE;
|
// overlay->stretch = TRUE;
|
||||||
pixbufoverlay->pbuf_has_changed = FALSE;
|
overlay->pbuf_has_changed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_reset_resources (GstGLFilter* filter)
|
gst_gl_overlay_reset_resources (GstGLFilter* filter)
|
||||||
{
|
{
|
||||||
// GstGLPixbufOverlay* pixbufoverlay = GST_GL_PIXBUFOVERLAY(filter);
|
// GstGLOverlay* overlay = GST_GL_OVERLAY(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_set_property (GObject * object, guint prop_id,
|
gst_gl_overlay_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstGLPixbufOverlay *pixbufoverlay = GST_GL_PIXBUFOVERLAY (object);
|
GstGLOverlay *overlay = GST_GL_OVERLAY (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_LOCATION:
|
case PROP_LOCATION:
|
||||||
if (pixbufoverlay->location != NULL) g_free (pixbufoverlay->location);
|
if (overlay->location != NULL) g_free (overlay->location);
|
||||||
pixbufoverlay->pbuf_has_changed = TRUE;
|
overlay->pbuf_has_changed = TRUE;
|
||||||
pixbufoverlay->location = g_value_dup_string (value);
|
overlay->location = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
/* case PROP_STRETCH:
|
/* case PROP_STRETCH:
|
||||||
pixbufoverlay->stretch = g_value_get_boolean (value);
|
overlay->stretch = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
|
@ -263,17 +263,17 @@ gst_gl_pixbufoverlay_set_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_get_property (GObject * object, guint prop_id,
|
gst_gl_overlay_get_property (GObject * object, guint prop_id,
|
||||||
GValue * value, GParamSpec * pspec)
|
GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstGLPixbufOverlay *pixbufoverlay = GST_GL_PIXBUFOVERLAY (object);
|
GstGLOverlay *overlay = GST_GL_OVERLAY (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_LOCATION:
|
case PROP_LOCATION:
|
||||||
g_value_set_string (value, pixbufoverlay->location);
|
g_value_set_string (value, overlay->location);
|
||||||
break;
|
break;
|
||||||
/* case PROP_STRETCH:
|
/* case PROP_STRETCH:
|
||||||
g_value_set_boolean (value, pixbufoverlay->stretch);
|
g_value_set_boolean (value, overlay->stretch);
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
|
@ -283,63 +283,63 @@ gst_gl_pixbufoverlay_get_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_init_resources (GstGLFilter* filter)
|
gst_gl_overlay_init_resources (GstGLFilter* filter)
|
||||||
{
|
{
|
||||||
// GstGLPixbufOverlay *pixbufoverlay = GST_GL_PIXBUFOVERLAY (filter);
|
// GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_pixbufoverlay_callback (gint width, gint height, guint texture, gpointer stuff)
|
gst_gl_overlay_callback (gint width, gint height, guint texture, gpointer stuff)
|
||||||
{
|
{
|
||||||
GstGLPixbufOverlay* pixbufoverlay = GST_GL_PIXBUFOVERLAY (stuff);
|
GstGLOverlay* overlay = GST_GL_OVERLAY (stuff);
|
||||||
|
|
||||||
glMatrixMode (GL_PROJECTION);
|
glMatrixMode (GL_PROJECTION);
|
||||||
glLoadIdentity ();
|
glLoadIdentity ();
|
||||||
|
|
||||||
gst_gl_pixbufoverlay_draw_texture (pixbufoverlay, texture);
|
gst_gl_overlay_draw_texture (overlay, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_pixbuf_texture (GstGLDisplay *display, gpointer data)
|
static void init_pixbuf_texture (GstGLDisplay *display, gpointer data)
|
||||||
{
|
{
|
||||||
GstGLPixbufOverlay *pixbufoverlay = GST_GL_PIXBUFOVERLAY (data);
|
GstGLOverlay *overlay = GST_GL_OVERLAY (data);
|
||||||
|
|
||||||
if (pixbufoverlay->pixbuf) {
|
if (overlay->pixbuf) {
|
||||||
|
|
||||||
glDeleteTextures (1, &pixbufoverlay->pbuftexture);
|
glDeleteTextures (1, &overlay->pbuftexture);
|
||||||
glGenTextures (1, &pixbufoverlay->pbuftexture);
|
glGenTextures (1, &overlay->pbuftexture);
|
||||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, pixbufoverlay->pbuftexture);
|
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, overlay->pbuftexture);
|
||||||
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA,
|
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA,
|
||||||
(gint)pixbufoverlay->width, (gint)pixbufoverlay->height, 0,
|
(gint)overlay->width, (gint)overlay->height, 0,
|
||||||
GL_RGBA, GL_UNSIGNED_BYTE, pixbufoverlay->pixbuf);
|
GL_RGBA, GL_UNSIGNED_BYTE, overlay->pixbuf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
display->isAlive = FALSE;
|
display->isAlive = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_gl_pixbufoverlay_filter (GstGLFilter* filter, GstGLBuffer* inbuf,
|
gst_gl_overlay_filter (GstGLFilter* filter, GstGLBuffer* inbuf,
|
||||||
GstGLBuffer* outbuf)
|
GstGLBuffer* outbuf)
|
||||||
{
|
{
|
||||||
GstGLPixbufOverlay* pixbufoverlay = GST_GL_PIXBUFOVERLAY(filter);
|
GstGLOverlay* overlay = GST_GL_OVERLAY(filter);
|
||||||
|
|
||||||
if (pixbufoverlay->pbuf_has_changed && (pixbufoverlay->location != NULL)) {
|
if (overlay->pbuf_has_changed && (overlay->location != NULL)) {
|
||||||
|
|
||||||
if (!gst_gl_pixbufoverlay_loader (filter))
|
if (!gst_gl_overlay_loader (filter))
|
||||||
pixbufoverlay->pixbuf = NULL;
|
overlay->pixbuf = NULL;
|
||||||
|
|
||||||
/* if loader failed then display is turned off */
|
/* if loader failed then display is turned off */
|
||||||
gst_gl_display_thread_add (filter->display, init_pixbuf_texture, pixbufoverlay);
|
gst_gl_display_thread_add (filter->display, init_pixbuf_texture, overlay);
|
||||||
|
|
||||||
if (pixbufoverlay->pixbuf) {
|
if (overlay->pixbuf) {
|
||||||
free (pixbufoverlay->pixbuf);
|
free (overlay->pixbuf);
|
||||||
pixbufoverlay->pixbuf = NULL;
|
overlay->pixbuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pixbufoverlay->pbuf_has_changed = FALSE;
|
overlay->pbuf_has_changed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_gl_filter_render_to_target (filter, inbuf->texture, outbuf->texture,
|
gst_gl_filter_render_to_target (filter, inbuf->texture, outbuf->texture,
|
||||||
gst_gl_pixbufoverlay_callback, pixbufoverlay);
|
gst_gl_overlay_callback, overlay);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -350,12 +350,12 @@ user_warning_fn(png_structp png_ptr, png_const_charp warning_msg)
|
||||||
g_warning("%s\n", warning_msg);
|
g_warning("%s\n", warning_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LOAD_ERROR(msg) { GST_WARNING ("unable to load %s: %s", pixbufoverlay->location, msg); return FALSE; }
|
#define LOAD_ERROR(msg) { GST_WARNING ("unable to load %s: %s", overlay->location, msg); return FALSE; }
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_gl_pixbufoverlay_loader (GstGLFilter* filter)
|
gst_gl_overlay_loader (GstGLFilter* filter)
|
||||||
{
|
{
|
||||||
GstGLPixbufOverlay* pixbufoverlay = GST_GL_PIXBUFOVERLAY(filter);
|
GstGLOverlay* overlay = GST_GL_OVERLAY(filter);
|
||||||
|
|
||||||
png_structp png_ptr;
|
png_structp png_ptr;
|
||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
|
@ -372,7 +372,7 @@ gst_gl_pixbufoverlay_loader (GstGLFilter* filter)
|
||||||
if (!filter->display)
|
if (!filter->display)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if ((fp = fopen(pixbufoverlay->location, "rb")) == NULL)
|
if ((fp = fopen(overlay->location, "rb")) == NULL)
|
||||||
LOAD_ERROR ("file not found");
|
LOAD_ERROR ("file not found");
|
||||||
|
|
||||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
|
@ -409,15 +409,15 @@ gst_gl_pixbufoverlay_loader (GstGLFilter* filter)
|
||||||
LOAD_ERROR ("color type is not rgb");
|
LOAD_ERROR ("color type is not rgb");
|
||||||
}
|
}
|
||||||
|
|
||||||
pixbufoverlay->width = width;
|
overlay->width = width;
|
||||||
pixbufoverlay->height = height;
|
overlay->height = height;
|
||||||
|
|
||||||
pixbufoverlay->pixbuf = (guchar*) malloc ( sizeof(guchar) * width * height * 4 );
|
overlay->pixbuf = (guchar*) malloc ( sizeof(guchar) * width * height * 4 );
|
||||||
|
|
||||||
rows = (guchar**)malloc(sizeof(guchar*) * height);
|
rows = (guchar**)malloc(sizeof(guchar*) * height);
|
||||||
|
|
||||||
for (y = 0; y < height; ++y)
|
for (y = 0; y < height; ++y)
|
||||||
rows[y] = (guchar*) (pixbufoverlay->pixbuf + y * width * 4);
|
rows[y] = (guchar*) (overlay->pixbuf + y * width * 4);
|
||||||
|
|
||||||
png_read_image(png_ptr, rows);
|
png_read_image(png_ptr, rows);
|
||||||
|
|
|
@ -63,7 +63,7 @@ GType gst_gl_filtersobel_get_type (void);
|
||||||
GType gst_gl_filter_edge_get_type (void);
|
GType gst_gl_filter_edge_get_type (void);
|
||||||
GType gst_gl_filter_laplacian_get_type (void);
|
GType gst_gl_filter_laplacian_get_type (void);
|
||||||
GType gst_gl_filter_glass_get_type (void);
|
GType gst_gl_filter_glass_get_type (void);
|
||||||
GType gst_gl_pixbufoverlay_get_type (void);
|
GType gst_gl_overlay_get_type (void);
|
||||||
GType gst_gl_differencematte_get_type (void);
|
GType gst_gl_differencematte_get_type (void);
|
||||||
GType gst_gl_bumper_get_type (void);
|
GType gst_gl_bumper_get_type (void);
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ plugin_init (GstPlugin * plugin)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!gst_element_register (plugin, "gloverlay",
|
if (!gst_element_register (plugin, "gloverlay",
|
||||||
GST_RANK_NONE, gst_gl_pixbufoverlay_get_type())) {
|
GST_RANK_NONE, gst_gl_overlay_get_type())) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!gst_element_register (plugin, "gldifferencematte",
|
if (!gst_element_register (plugin, "gldifferencematte",
|
||||||
|
|
|
@ -165,7 +165,7 @@ main (gint argc, gchar * argv[])
|
||||||
GOptionEntry options[] = {
|
GOptionEntry options[] = {
|
||||||
{ "source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
|
{ "source-bin", 's', 0, G_OPTION_ARG_STRING_ARRAY, &source_desc_array,
|
||||||
"Use a custom source bin description (gst-launch style)", NULL },
|
"Use a custom source bin description (gst-launch style)", NULL },
|
||||||
{ "method", 'm', 0, G_OPTION_ARG_INT, &method, "1 for gstdifferencematte, 2 for gstpixbufoverlay", "M" },
|
{ "method", 'm', 0, G_OPTION_ARG_INT, &method, "1 for gstdifferencematte, 2 for gloverlay", "M" },
|
||||||
{ "delay", 'd', 0, G_OPTION_ARG_INT, &delay, "Wait N seconds before to send the image to gstreamer (useful with differencematte)", "N" },
|
{ "delay", 'd', 0, G_OPTION_ARG_INT, &delay, "Wait N seconds before to send the image to gstreamer (useful with differencematte)", "N" },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
@ -207,7 +207,7 @@ main (gint argc, gchar * argv[])
|
||||||
|
|
||||||
uload = gst_element_factory_make ("glupload", "glu");
|
uload = gst_element_factory_make ("glupload", "glu");
|
||||||
if (method == 2) {
|
if (method == 2) {
|
||||||
filter = gst_element_factory_make ("glpixbufoverlay", "flt");
|
filter = gst_element_factory_make ("gloverlay", "flt");
|
||||||
} else {
|
} else {
|
||||||
filter = gst_element_factory_make ("gldifferencematte", "flt");
|
filter = gst_element_factory_make ("gldifferencematte", "flt");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue