mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
[582/906] filters: changes for new API
This commit is contained in:
parent
e89266b664
commit
79ed68478f
12 changed files with 169 additions and 263 deletions
|
@ -68,8 +68,8 @@ static void gst_gl_bumper_get_property (GObject * object, guint prop_id,
|
|||
|
||||
static void gst_gl_bumper_reset (GstGLFilter * filter);
|
||||
static gboolean gst_gl_bumper_init_shader (GstGLFilter * filter);
|
||||
static gboolean gst_gl_bumper_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_bumper_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
static void gst_gl_bumper_callback (gint width, gint height, guint texture,
|
||||
gpointer stuff);
|
||||
|
||||
|
@ -273,7 +273,7 @@ gst_gl_bumper_class_init (GstGLBumperClass * klass)
|
|||
gobject_class->set_property = gst_gl_bumper_set_property;
|
||||
gobject_class->get_property = gst_gl_bumper_get_property;
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_bumper_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture = gst_gl_bumper_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->display_init_cb = gst_gl_bumper_init_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb = gst_gl_bumper_reset_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_bumper_init_shader;
|
||||
|
@ -355,23 +355,20 @@ gst_gl_bumper_init_shader (GstGLFilter * filter)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_bumper_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_bumper_filter_texture (GstGLFilter * filter, guint in_tex, guint out_tex)
|
||||
{
|
||||
GstGLMeta *in_gl_meta, *out_gl_meta;
|
||||
GstVideoMeta *in_v_meta;
|
||||
gpointer bumper_filter = GST_GL_BUMPER (filter);
|
||||
|
||||
in_gl_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_gl_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
in_v_meta = gst_buffer_get_video_meta (inbuf);
|
||||
|
||||
//blocking call, use a FBO
|
||||
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
||||
filter->fbo, filter->depthbuffer, out_gl_meta->memory->tex_id,
|
||||
gst_gl_bumper_callback, in_v_meta->width, in_v_meta->height,
|
||||
in_gl_meta->memory->tex_id, 45,
|
||||
(gdouble) filter->width / (gdouble) filter->height, 0.1, 50,
|
||||
gst_gl_display_use_fbo (filter->display,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
filter->fbo, filter->depthbuffer, out_tex, gst_gl_bumper_callback,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->in_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->in_info),
|
||||
in_tex, 45,
|
||||
(gdouble) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
|
||||
(gdouble) GST_VIDEO_INFO_HEIGHT (&filter->out_info), 0.1, 50,
|
||||
GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, bumper_filter);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -63,8 +63,8 @@ static void gst_gl_differencematte_get_property (GObject * object,
|
|||
static void gst_gl_differencematte_init_resources (GstGLFilter * filter);
|
||||
static void gst_gl_differencematte_reset_resources (GstGLFilter * filter);
|
||||
|
||||
static gboolean gst_gl_differencematte_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_differencematte_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
|
||||
static gboolean gst_gl_differencematte_loader (GstGLFilter * filter);
|
||||
|
||||
|
@ -86,7 +86,9 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
|||
glGenTextures (1, &differencematte->midtexture[i]);
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, differencematte->midtexture[i]);
|
||||
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
|
||||
filter->width, filter->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
|
||||
GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,
|
||||
|
@ -176,7 +178,8 @@ gst_gl_differencematte_class_init (GstGLDifferenceMatteClass * klass)
|
|||
gobject_class->set_property = gst_gl_differencematte_set_property;
|
||||
gobject_class->get_property = gst_gl_differencematte_get_property;
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_differencematte_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_differencematte_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->display_init_cb =
|
||||
gst_gl_differencematte_init_gl_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb =
|
||||
|
@ -211,11 +214,12 @@ gst_gl_differencematte_draw_texture (GstGLDifferenceMatte * differencematte,
|
|||
|
||||
glTexCoord2f (0.0, 0.0);
|
||||
glVertex2f (-1.0, -1.0);
|
||||
glTexCoord2f ((gfloat) filter->width, 0.0);
|
||||
glTexCoord2f ((gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info), 0.0);
|
||||
glVertex2f (1.0, -1.0);
|
||||
glTexCoord2f ((gfloat) filter->width, (gfloat) filter->height);
|
||||
glTexCoord2f ((gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
(gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info));
|
||||
glVertex2f (1.0, 1.0);
|
||||
glTexCoord2f (0.0, (gfloat) filter->height);
|
||||
glTexCoord2f (0.0, (gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info));
|
||||
glVertex2f (-1.0, 1.0);
|
||||
|
||||
glEnd ();
|
||||
|
@ -313,7 +317,9 @@ init_pixbuf_texture (GstGLDisplay * display, gpointer data)
|
|||
glGenTextures (1, &differencematte->savedbgtexture);
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, differencematte->savedbgtexture);
|
||||
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
|
||||
filter->width, filter->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
|
||||
GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,
|
||||
|
@ -432,9 +438,9 @@ gst_gl_differencematte_interp (gint width, gint height, guint texture,
|
|||
"base_height", (gfloat) differencematte->pbuf_height);
|
||||
|
||||
gst_gl_shader_set_uniform_1f (differencematte->shader[3],
|
||||
"final_width", (gfloat) filter->width);
|
||||
"final_width", (gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info));
|
||||
gst_gl_shader_set_uniform_1f (differencematte->shader[3],
|
||||
"final_height", (gfloat) filter->height);
|
||||
"final_height", (gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info));
|
||||
|
||||
glActiveTexture (GL_TEXTURE2);
|
||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||
|
@ -459,21 +465,12 @@ gst_gl_differencematte_identity (gint width, gint height, guint texture,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_differencematte_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_differencematte_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
|
||||
if (!in_meta || !out_meta) {
|
||||
GST_ERROR ("A Buffer does not contain required GstGLMeta");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
differencematte->intexture = in_meta->memory->tex_id;
|
||||
differencematte->intexture = in_tex;
|
||||
|
||||
if (differencematte->bg_has_changed && (differencematte->location != NULL)) {
|
||||
|
||||
|
@ -486,7 +483,7 @@ gst_gl_differencematte_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
|||
|
||||
/* save current frame, needed to calculate difference between
|
||||
* this frame and next ones */
|
||||
gst_gl_filter_render_to_target (filter, in_meta->memory->tex_id,
|
||||
gst_gl_filter_render_to_target (filter, in_tex,
|
||||
differencematte->savedbgtexture,
|
||||
gst_gl_differencematte_save_texture, differencematte);
|
||||
|
||||
|
@ -499,27 +496,20 @@ gst_gl_differencematte_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
|||
}
|
||||
|
||||
if (differencematte->savedbgtexture != 0) {
|
||||
gst_gl_filter_render_to_target (filter,
|
||||
in_meta->memory->tex_id,
|
||||
differencematte->midtexture[0],
|
||||
gst_gl_differencematte_diff, differencematte);
|
||||
gst_gl_filter_render_to_target (filter,
|
||||
differencematte->midtexture[0],
|
||||
differencematte->midtexture[1],
|
||||
gst_gl_differencematte_hblur, differencematte);
|
||||
gst_gl_filter_render_to_target (filter,
|
||||
differencematte->midtexture[1],
|
||||
differencematte->midtexture[2],
|
||||
gst_gl_differencematte_vblur, differencematte);
|
||||
gst_gl_filter_render_to_target (filter,
|
||||
in_meta->memory->tex_id,
|
||||
out_meta->memory->tex_id, gst_gl_differencematte_interp,
|
||||
gst_gl_filter_render_to_target (filter, in_tex,
|
||||
differencematte->midtexture[0], gst_gl_differencematte_diff,
|
||||
differencematte);
|
||||
gst_gl_filter_render_to_target (filter, differencematte->midtexture[0],
|
||||
differencematte->midtexture[1], gst_gl_differencematte_hblur,
|
||||
differencematte);
|
||||
gst_gl_filter_render_to_target (filter, differencematte->midtexture[1],
|
||||
differencematte->midtexture[2], gst_gl_differencematte_vblur,
|
||||
differencematte);
|
||||
gst_gl_filter_render_to_target (filter, in_tex, out_tex,
|
||||
gst_gl_differencematte_interp, differencematte);
|
||||
} else {
|
||||
gst_gl_filter_render_to_target (filter,
|
||||
in_meta->memory->tex_id,
|
||||
out_meta->memory->tex_id, gst_gl_differencematte_identity,
|
||||
differencematte);
|
||||
gst_gl_filter_render_to_target (filter, in_tex, out_tex,
|
||||
gst_gl_differencematte_identity, differencematte);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -63,8 +63,8 @@ static gboolean gst_gl_effects_on_init_gl_context (GstGLFilter * filter);
|
|||
static void gst_gl_effects_ghash_func_clean (gpointer key, gpointer value,
|
||||
gpointer data);
|
||||
|
||||
static gboolean gst_gl_effects_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_effects_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
|
||||
/* dont' forget to edit the following when a new effect is added */
|
||||
typedef enum
|
||||
|
@ -194,7 +194,9 @@ gst_gl_effects_init_gl_resources (GstGLFilter * filter)
|
|||
glGenTextures (1, &effects->midtexture[i]);
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, effects->midtexture[i]);
|
||||
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
|
||||
filter->width, filter->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
|
||||
GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,
|
||||
|
@ -235,7 +237,7 @@ gst_gl_effects_class_init (GstGLEffectsClass * klass)
|
|||
gobject_class->set_property = gst_gl_effects_set_property;
|
||||
gobject_class->get_property = gst_gl_effects_get_property;
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_effects_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture = gst_gl_effects_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->display_init_cb =
|
||||
gst_gl_effects_init_gl_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb =
|
||||
|
@ -278,11 +280,12 @@ gst_gl_effects_draw_texture (GstGLEffects * effects, GLuint tex)
|
|||
|
||||
glTexCoord2f (0.0, 0.0);
|
||||
glVertex2f (-1.0, -1.0);
|
||||
glTexCoord2f ((gfloat) filter->width, 0.0);
|
||||
glTexCoord2f ((gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info), 0.0);
|
||||
glVertex2f (1.0, -1.0);
|
||||
glTexCoord2f ((gfloat) filter->width, (gfloat) filter->height);
|
||||
glTexCoord2f ((gfloat) GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
(gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info));
|
||||
glVertex2f (1.0, 1.0);
|
||||
glTexCoord2f (0.0, (gfloat) filter->height);
|
||||
glTexCoord2f (0.0, (gfloat) GST_VIDEO_INFO_HEIGHT (&filter->out_info));
|
||||
glVertex2f (-1.0, 1.0);
|
||||
|
||||
glEnd ();
|
||||
|
@ -438,22 +441,13 @@ gst_gl_effects_on_init_gl_context (GstGLFilter * filter)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_effects_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_effects_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
GstGLEffects *effects = GST_GL_EFFECTS (filter);
|
||||
GstGLMeta *in_gl_meta, *out_gl_meta;
|
||||
|
||||
in_gl_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_gl_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
|
||||
if (!in_gl_meta || !out_gl_meta) {
|
||||
GST_ERROR ("buffers do not contain required GstGLMeta");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
effects->intexture = in_gl_meta->memory->tex_id;
|
||||
effects->outtexture = out_gl_meta->memory->tex_id;
|
||||
effects->intexture = in_tex;
|
||||
effects->outtexture = out_tex;
|
||||
|
||||
if (effects->horizontal_swap == TRUE)
|
||||
gst_gl_display_thread_add (filter->display, set_horizontal_swap, effects);
|
||||
|
|
|
@ -66,8 +66,8 @@ static void gst_gl_filter_app_get_property (GObject * object, guint prop_id,
|
|||
|
||||
static gboolean gst_gl_filter_app_set_caps (GstGLFilter * filter,
|
||||
GstCaps * incaps, GstCaps * outcaps);
|
||||
static gboolean gst_gl_filter_app_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_filter_app_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
static void gst_gl_filter_app_callback (gint width, gint height, guint texture,
|
||||
gpointer stuff);
|
||||
|
||||
|
@ -85,7 +85,8 @@ gst_gl_filter_app_class_init (GstGLFilterAppClass * klass)
|
|||
gobject_class->get_property = gst_gl_filter_app_get_property;
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->set_caps = gst_gl_filter_app_set_caps;
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filter_app_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_filter_app_filter_texture;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CLIENT_RESHAPE_CALLBACK,
|
||||
g_param_spec_pointer ("client-reshape-callback",
|
||||
|
@ -168,40 +169,31 @@ gst_gl_filter_app_set_caps (GstGLFilter * filter, GstCaps * incaps,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_filter_app_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_filter_app_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
GstGLFilterApp *app_filter = GST_GL_FILTER_APP (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
GstVideoMeta *in_v_meta;
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
in_v_meta = gst_buffer_get_video_meta (inbuf);
|
||||
|
||||
if (!in_meta || !out_meta || !in_v_meta) {
|
||||
GST_ERROR ("A Buffer does not contain required GstGLMeta or GstVideoMeta");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (app_filter->clientDrawCallback) {
|
||||
//blocking call, use a FBO
|
||||
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
||||
filter->fbo, filter->depthbuffer, out_meta->memory->tex_id,
|
||||
app_filter->clientDrawCallback, in_v_meta->width, in_v_meta->height,
|
||||
in_meta->memory->tex_id, 45,
|
||||
(gfloat) filter->width / (gfloat) filter->height,
|
||||
gst_gl_display_use_fbo (filter->display,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
filter->fbo, filter->depthbuffer, out_tex,
|
||||
app_filter->clientDrawCallback,
|
||||
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,
|
||||
app_filter->client_data);
|
||||
}
|
||||
//default
|
||||
else {
|
||||
//blocking call, use a FBO
|
||||
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
||||
filter->fbo, filter->depthbuffer, out_meta->memory->tex_id,
|
||||
gst_gl_filter_app_callback, in_v_meta->width, in_v_meta->height,
|
||||
in_meta->memory->tex_id, 0, filter->width, 0, filter->height,
|
||||
GST_GL_DISPLAY_PROJECTION_ORTHO2D, NULL);
|
||||
gst_gl_filter_render_to_target (filter, in_tex, out_tex,
|
||||
gst_gl_filter_app_callback, NULL);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -55,8 +55,8 @@ static void gst_gl_filterblur_get_property (GObject * object, guint prop_id,
|
|||
static void gst_gl_filter_filterblur_reset (GstGLFilter * filter);
|
||||
|
||||
static gboolean gst_gl_filterblur_init_shader (GstGLFilter * filter);
|
||||
static gboolean gst_gl_filterblur_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_filterblur_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
static void gst_gl_filterblur_hcallback (gint width, gint height, guint texture,
|
||||
gpointer stuff);
|
||||
static void gst_gl_filterblur_vcallback (gint width, gint height, guint texture,
|
||||
|
@ -71,7 +71,9 @@ gst_gl_filterblur_init_resources (GstGLFilter * filter)
|
|||
glGenTextures (1, &filterblur->midtexture);
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, filterblur->midtexture);
|
||||
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
|
||||
filter->width, filter->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S,
|
||||
|
@ -104,7 +106,8 @@ gst_gl_filterblur_class_init (GstGLFilterBlurClass * klass)
|
|||
"Filter/Effect", "Blur with 9x9 separable convolution",
|
||||
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filterblur_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_filterblur_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->display_init_cb =
|
||||
gst_gl_filterblur_init_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb =
|
||||
|
@ -182,25 +185,16 @@ gst_gl_filterblur_init_shader (GstGLFilter * filter)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_filterblur_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_filterblur_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
|
||||
if (!in_meta || !out_meta) {
|
||||
GST_WARNING ("A buffer did not contain required GstGLMeta");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_gl_filter_render_to_target (filter, in_meta->memory->tex_id,
|
||||
gst_gl_filter_render_to_target (filter, in_tex,
|
||||
filterblur->midtexture, gst_gl_filterblur_hcallback, filterblur);
|
||||
|
||||
gst_gl_filter_render_to_target (filter, filterblur->midtexture,
|
||||
out_meta->memory->tex_id, gst_gl_filterblur_vcallback, filterblur);
|
||||
out_tex, gst_gl_filterblur_vcallback, filterblur);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ static gboolean gst_gl_filter_cube_set_caps (GstGLFilter * filter,
|
|||
static void gst_gl_filter_cube_reset (GstGLFilter * filter);
|
||||
static gboolean gst_gl_filter_cube_init_shader (GstGLFilter * filter);
|
||||
#endif
|
||||
static gboolean gst_gl_filter_cube_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_filter_cube_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
static void gst_gl_filter_cube_callback (gint width, gint height, guint texture,
|
||||
gpointer stuff);
|
||||
|
||||
|
@ -144,7 +144,8 @@ gst_gl_filter_cube_class_init (GstGLFilterCubeClass * klass)
|
|||
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_cube_reset;
|
||||
#endif
|
||||
GST_GL_FILTER_CLASS (klass)->set_caps = gst_gl_filter_cube_set_caps;
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filter_cube_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_filter_cube_filter_texture;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_RED,
|
||||
g_param_spec_float ("red", "Red", "Background red color",
|
||||
|
@ -248,7 +249,8 @@ gst_gl_filter_cube_set_caps (GstGLFilter * filter, GstCaps * incaps,
|
|||
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
|
||||
|
||||
if (cube_filter->aspect == 0)
|
||||
cube_filter->aspect = (gdouble) filter->width / (gdouble) filter->height;
|
||||
cube_filter->aspect = (gdouble) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
|
||||
(gdouble) GST_VIDEO_INFO_HEIGHT (&filter->out_info);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -275,27 +277,20 @@ gst_gl_filter_cube_init_shader (GstGLFilter * filter)
|
|||
#endif
|
||||
|
||||
static gboolean
|
||||
gst_gl_filter_cube_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_filter_cube_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
GstVideoMeta *in_v_meta;
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
in_v_meta = gst_buffer_get_video_meta (inbuf);
|
||||
|
||||
if (!in_meta || !in_v_meta || !out_meta) {
|
||||
GST_WARNING ("A buffer does not contain required GstGLMeta"
|
||||
" or GstVideoMeta");
|
||||
return FALSE;
|
||||
}
|
||||
//blocking call, use a FBO
|
||||
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
||||
filter->fbo, filter->depthbuffer, out_meta->memory->tex_id,
|
||||
gst_gl_filter_cube_callback, in_v_meta->width, in_v_meta->height,
|
||||
in_meta->memory->tex_id, cube_filter->fovy, cube_filter->aspect,
|
||||
gst_gl_display_use_fbo (filter->display,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
filter->fbo, filter->depthbuffer, out_tex,
|
||||
gst_gl_filter_cube_callback,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->in_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->in_info),
|
||||
in_tex, cube_filter->fovy, cube_filter->aspect,
|
||||
cube_filter->znear, cube_filter->zfar,
|
||||
GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, (gpointer) cube_filter);
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ static void gst_gl_filter_glass_get_property (GObject * object, guint prop_id,
|
|||
|
||||
static void gst_gl_filter_glass_reset (GstGLFilter * filter);
|
||||
static gboolean gst_gl_filter_glass_init_shader (GstGLFilter * filter);
|
||||
static gboolean gst_gl_filter_glass_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_filter_glass_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
|
||||
static void gst_gl_filter_glass_draw_background_gradient ();
|
||||
static void gst_gl_filter_glass_draw_video_plane (GstGLFilter * filter,
|
||||
|
@ -115,7 +115,8 @@ gst_gl_filter_glass_class_init (GstGLFilterGlassClass * klass)
|
|||
"Filter/Effect", "Glass Filter",
|
||||
"Julien Isorce <julien.isorce@gmail.com>");
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filter_glass_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_filter_glass_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_glass_init_shader;
|
||||
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_glass_reset;
|
||||
}
|
||||
|
@ -173,30 +174,21 @@ gst_gl_filter_glass_init_shader (GstGLFilter * filter)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_filter_glass_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_filter_glass_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
gpointer glass_filter = GST_GL_FILTER_GLASS (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
GstVideoMeta *in_v_meta;
|
||||
|
||||
GST_GL_FILTER_GLASS (glass_filter)->timestamp = GST_BUFFER_TIMESTAMP (inbuf);
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
in_v_meta = gst_buffer_get_video_meta (inbuf);
|
||||
|
||||
if (!in_meta || !out_meta || !in_v_meta) {
|
||||
GST_WARNING ("A buffer does not contain required GstGLMeta "
|
||||
"or GstVideoMeta");
|
||||
return FALSE;
|
||||
}
|
||||
//blocking call, use a FBO
|
||||
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
||||
filter->fbo, filter->depthbuffer, out_meta->memory->tex_id,
|
||||
gst_gl_filter_glass_callback, in_v_meta->width, in_v_meta->height,
|
||||
in_meta->memory->tex_id, 80,
|
||||
(gdouble) filter->width / (gdouble) filter->height, 1.0, 5000.0,
|
||||
gst_gl_display_use_fbo (filter->display,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
filter->fbo, filter->depthbuffer, out_tex,
|
||||
gst_gl_filter_glass_callback,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->in_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->in_info),
|
||||
in_tex, 80, (gdouble) GST_VIDEO_INFO_WIDTH (&filter->out_info) /
|
||||
(gdouble) GST_VIDEO_INFO_HEIGHT (&filter->out_info), 1.0, 5000.0,
|
||||
GST_GL_DISPLAY_PROJECTION_PERSPECTIVE, (gpointer) glass_filter);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -59,8 +59,8 @@ static void gst_gl_filter_laplacian_get_property (GObject * object,
|
|||
|
||||
static void gst_gl_filter_laplacian_reset (GstGLFilter * filter);
|
||||
static gboolean gst_gl_filter_laplacian_init_shader (GstGLFilter * filter);
|
||||
static gboolean gst_gl_filter_laplacian_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_filter_laplacian_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
static void gst_gl_filter_laplacian_callback (gint width, gint height,
|
||||
guint texture, gpointer stuff);
|
||||
|
||||
|
@ -113,7 +113,8 @@ gst_gl_filter_laplacian_class_init (GstGLFilterLaplacianClass * klass)
|
|||
"Laplacian Convolution Demo Filter",
|
||||
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filter_laplacian_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_filter_laplacian_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_laplacian_init_shader;
|
||||
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_laplacian_reset;
|
||||
}
|
||||
|
@ -170,28 +171,15 @@ gst_gl_filter_laplacian_init_shader (GstGLFilter * filter)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_filter_laplacian_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_filter_laplacian_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
gpointer laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
GstVideoMeta *in_v_meta;
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
in_v_meta = gst_buffer_get_video_meta (inbuf);
|
||||
|
||||
if (!in_meta || !out_meta || !in_v_meta) {
|
||||
GST_WARNING ("A buffer does not contain required GstGLMeta"
|
||||
" or GstVideoMeta");
|
||||
return FALSE;
|
||||
}
|
||||
//blocking call, use a FBO
|
||||
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
||||
filter->fbo, filter->depthbuffer, out_meta->memory->tex_id,
|
||||
gst_gl_filter_laplacian_callback, in_v_meta->width, in_v_meta->height,
|
||||
in_meta->memory->tex_id, 0, filter->width, 0, filter->height,
|
||||
GST_GL_DISPLAY_PROJECTION_ORTHO2D, laplacian_filter);
|
||||
gst_gl_filter_render_to_target (filter, in_tex, out_tex,
|
||||
gst_gl_filter_laplacian_callback, laplacian_filter);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ static void gst_gl_filter_reflected_screen_set_property (GObject * object,
|
|||
static void gst_gl_filter_reflected_screen_get_property (GObject * object,
|
||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_gl_filter_reflected_screen_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_filter_reflected_screen_filter_texture (GstGLFilter *
|
||||
filter, guint in_tex, guint out_tex);
|
||||
|
||||
static void gst_gl_filter_reflected_screen_draw_background ();
|
||||
static void gst_gl_filter_reflected_screen_draw_floor ();
|
||||
|
@ -94,7 +94,8 @@ gst_gl_filter_reflected_screen_class_init (GstGLFilterReflectedScreenClass *
|
|||
gobject_class->set_property = gst_gl_filter_reflected_screen_set_property;
|
||||
gobject_class->get_property = gst_gl_filter_reflected_screen_get_property;
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filter_reflected_screen_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_filter_reflected_screen_filter_texture;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_ACTIVE_GRAPHIC_MODE,
|
||||
g_param_spec_boolean ("active-graphic-mode",
|
||||
|
@ -207,32 +208,20 @@ gst_gl_filter_reflected_screen_get_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_filter_reflected_screen_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf)
|
||||
gst_gl_filter_reflected_screen_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex)
|
||||
{
|
||||
GstGLFilterReflectedScreen *reflected_screen_filter =
|
||||
GST_GL_FILTER_REFLECTED_SCREEN (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
GstVideoMeta *in_v_meta;
|
||||
|
||||
if (reflected_screen_filter->aspect == 0.0)
|
||||
reflected_screen_filter->aspect =
|
||||
(gfloat) (filter->width) / (gfloat) (filter->height);
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
in_v_meta = gst_buffer_get_video_meta (inbuf);
|
||||
|
||||
if (!in_meta || !out_meta || !in_v_meta) {
|
||||
GST_WARNING ("A buffer does not contain required GstGLMeta or"
|
||||
" GstVideoMeta");
|
||||
return FALSE;
|
||||
}
|
||||
//blocking call, use a FBO
|
||||
gst_gl_display_use_fbo (filter->display, filter->width, filter->height,
|
||||
filter->fbo, filter->depthbuffer, out_meta->memory->tex_id,
|
||||
gst_gl_filter_reflected_screen_callback, in_v_meta->width,
|
||||
in_v_meta->height, in_meta->memory->tex_id,
|
||||
gst_gl_display_use_fbo (filter->display,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
filter->fbo, filter->depthbuffer, out_tex,
|
||||
gst_gl_filter_reflected_screen_callback,
|
||||
GST_VIDEO_INFO_WIDTH (&filter->in_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->in_info), in_tex,
|
||||
reflected_screen_filter->fovy, reflected_screen_filter->aspect,
|
||||
reflected_screen_filter->znear, reflected_screen_filter->zfar,
|
||||
GST_GL_DISPLAY_PROJECTION_PERSPECTIVE,
|
||||
|
|
|
@ -78,8 +78,8 @@ static void gst_gl_filter_filtershader_reset (GstGLFilter * filter);
|
|||
static void gst_gl_filtershader_load_shader (char *filename, char **storage);
|
||||
static void gst_gl_filtershader_load_variables (char *filename, char **storage);
|
||||
static gboolean gst_gl_filtershader_init_shader (GstGLFilter * filter);
|
||||
static gboolean gst_gl_filtershader_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_filtershader_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
static void gst_gl_filtershader_hcallback (gint width, gint height,
|
||||
guint texture, gpointer stuff);
|
||||
|
||||
|
@ -88,7 +88,9 @@ static void
|
|||
gst_gl_filtershader_init_resources (GstGLFilter * filter)
|
||||
{
|
||||
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
|
||||
filter->width, filter->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S,
|
||||
|
@ -134,7 +136,8 @@ gst_gl_filtershader_class_init (GstGLFilterShaderClass * klass)
|
|||
"OpenGL fragment shader filter", "Filter/Effect",
|
||||
"Load GLSL fragment shader from file", "<luc.deschenaux@freesurf.ch>");
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filtershader_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_filtershader_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->display_init_cb =
|
||||
gst_gl_filtershader_init_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb =
|
||||
|
@ -294,7 +297,6 @@ gst_gl_filtershader_variables_parse (GstGLShader * shader, gchar * variables)
|
|||
gst_gl_shadervariables_parse (shader, variables, 0);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gst_gl_filtershader_init_shader (GstGLFilter * filter)
|
||||
{
|
||||
|
@ -318,26 +320,13 @@ gst_gl_filtershader_init_shader (GstGLFilter * filter)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_filtershader_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_filtershader_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
GstGLFilterShader *filtershader = GST_GL_FILTERSHADER (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
|
||||
if (!in_meta || !out_meta) {
|
||||
GST_ERROR ("A buffer does not contain required GstGLMeta");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!filtershader->compiled) {
|
||||
gst_gl_filtershader_init_shader (filter);
|
||||
}
|
||||
|
||||
gst_gl_filter_render_to_target (filter, in_meta->memory->tex_id,
|
||||
out_meta->memory->tex_id, gst_gl_filtershader_hcallback, filtershader);
|
||||
gst_gl_filter_render_to_target (filter, in_tex, out_tex,
|
||||
gst_gl_filtershader_hcallback, filtershader);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ static void gst_gl_filtersobel_get_property (GObject * object, guint prop_id,
|
|||
static void gst_gl_filter_filtersobel_reset (GstGLFilter * filter);
|
||||
|
||||
static gboolean gst_gl_filtersobel_init_shader (GstGLFilter * filter);
|
||||
static gboolean gst_gl_filtersobel_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_filtersobel_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
|
||||
static void gst_gl_filtersobel_length (gint width, gint height, guint texture,
|
||||
gpointer stuff);
|
||||
|
@ -77,7 +77,9 @@ gst_gl_filtersobel_init_resources (GstGLFilter * filter)
|
|||
glGenTextures (1, &filtersobel->midtexture[i]);
|
||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, filtersobel->midtexture[i]);
|
||||
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8,
|
||||
filter->width, filter->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info),
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER,
|
||||
GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER,
|
||||
|
@ -112,7 +114,8 @@ gst_gl_filtersobel_class_init (GstGLFilterSobelClass * klass)
|
|||
gobject_class->set_property = gst_gl_filtersobel_set_property;
|
||||
gobject_class->get_property = gst_gl_filtersobel_get_property;
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_filtersobel_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture =
|
||||
gst_gl_filtersobel_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->display_init_cb =
|
||||
gst_gl_filtersobel_init_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb =
|
||||
|
@ -212,20 +215,12 @@ gst_gl_filtersobel_init_shader (GstGLFilter * filter)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_filtersobel_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_filtersobel_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
if (!in_meta || !out_meta) {
|
||||
GST_WARNING ("A buffer does not contain required GstGLMeta");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_gl_filter_render_to_target_with_shader (filter, in_meta->memory->tex_id,
|
||||
gst_gl_filter_render_to_target_with_shader (filter, in_tex,
|
||||
filtersobel->midtexture[0], filtersobel->desat);
|
||||
gst_gl_filter_render_to_target_with_shader (filter,
|
||||
filtersobel->midtexture[0], filtersobel->midtexture[1],
|
||||
|
@ -234,7 +229,7 @@ gst_gl_filtersobel_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
|||
filtersobel->midtexture[1], filtersobel->midtexture[0],
|
||||
filtersobel->vconv);
|
||||
gst_gl_filter_render_to_target (filter, filtersobel->midtexture[0],
|
||||
out_meta->memory->tex_id, gst_gl_filtersobel_length, filtersobel);
|
||||
out_tex, gst_gl_filtersobel_length, filtersobel);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ static void gst_gl_overlay_get_property (GObject * object, guint prop_id,
|
|||
static void gst_gl_overlay_init_resources (GstGLFilter * filter);
|
||||
static void gst_gl_overlay_reset_resources (GstGLFilter * filter);
|
||||
|
||||
static gboolean gst_gl_overlay_filter (GstGLFilter * filter,
|
||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
static gboolean gst_gl_overlay_filter_texture (GstGLFilter * filter,
|
||||
guint in_tex, guint out_tex);
|
||||
|
||||
static gint gst_gl_overlay_load_png (GstGLFilter * filter);
|
||||
static gint gst_gl_overlay_load_jpeg (GstGLFilter * filter);
|
||||
|
@ -122,7 +122,7 @@ gst_gl_overlay_class_init (GstGLOverlayClass * klass)
|
|||
gobject_class->get_property = gst_gl_overlay_get_property;
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->set_caps = gst_gl_overlay_set_caps;
|
||||
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_overlay_filter;
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture = gst_gl_overlay_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->display_init_cb =
|
||||
gst_gl_overlay_init_gl_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb =
|
||||
|
@ -588,19 +588,10 @@ init_pixbuf_texture (GstGLDisplay * display, gpointer data)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_overlay_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf)
|
||||
gst_gl_overlay_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||
guint out_tex)
|
||||
{
|
||||
GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
||||
GstGLMeta *in_meta, *out_meta;
|
||||
|
||||
in_meta = gst_buffer_get_gl_meta (inbuf);
|
||||
out_meta = gst_buffer_get_gl_meta (outbuf);
|
||||
|
||||
if (!in_meta || !out_meta) {
|
||||
GST_ERROR ("A Buffer does not contain required GstGLMeta");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (overlay->pbuf_has_changed && (overlay->location != NULL)) {
|
||||
if ((overlay->type_file = gst_gl_overlay_load_png (filter)) == 0)
|
||||
|
@ -616,8 +607,8 @@ gst_gl_overlay_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
|||
overlay->pbuf_has_changed = FALSE;
|
||||
}
|
||||
|
||||
gst_gl_filter_render_to_target (filter, in_meta->memory->tex_id,
|
||||
out_meta->memory->tex_id, gst_gl_overlay_callback, overlay);
|
||||
gst_gl_filter_render_to_target (filter, in_tex, out_tex,
|
||||
gst_gl_overlay_callback, overlay);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue