mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
gl: get the context from basemixer/basefilter
This commit is contained in:
parent
51620950e4
commit
92f0aa9bd8
35 changed files with 218 additions and 224 deletions
|
@ -30,7 +30,7 @@ gst_gl_effects_bulge_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "bulge0");
|
shader = g_hash_table_lookup (effects->shaderstable, "bulge0");
|
||||||
|
|
|
@ -30,7 +30,7 @@ gst_gl_effects_fisheye_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "fisheye0");
|
shader = g_hash_table_lookup (effects->shaderstable, "fisheye0");
|
||||||
|
|
|
@ -33,7 +33,7 @@ gst_gl_effects_glow_step_one (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "glow0");
|
shader = g_hash_table_lookup (effects->shaderstable, "glow0");
|
||||||
|
@ -73,7 +73,7 @@ gst_gl_effects_glow_step_two (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "glow1");
|
shader = g_hash_table_lookup (effects->shaderstable, "glow1");
|
||||||
|
@ -120,7 +120,7 @@ gst_gl_effects_glow_step_three (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "glow2");
|
shader = g_hash_table_lookup (effects->shaderstable, "glow2");
|
||||||
|
@ -162,7 +162,7 @@ gst_gl_effects_glow_step_four (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "glow3");
|
shader = g_hash_table_lookup (effects->shaderstable, "glow3");
|
||||||
|
|
|
@ -35,7 +35,7 @@ gst_gl_effects_identity_callback (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
#if GST_GL_HAVE_OPENGL
|
#if GST_GL_HAVE_OPENGL
|
||||||
|
|
|
@ -31,7 +31,7 @@ gst_gl_effects_luma_to_curve (GstGLEffects * effects,
|
||||||
{
|
{
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "lumamap0");
|
shader = g_hash_table_lookup (effects->shaderstable, "lumamap0");
|
||||||
|
|
|
@ -36,7 +36,7 @@ gst_gl_effects_mirror_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLFilter *filter = GST_GL_FILTER (data);
|
GstGLFilter *filter = GST_GL_FILTER (data);
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (filter);
|
GstGLEffects *effects = GST_GL_EFFECTS (filter);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "mirror0");
|
shader = g_hash_table_lookup (effects->shaderstable, "mirror0");
|
||||||
|
|
|
@ -31,7 +31,7 @@ gst_gl_effects_rgb_to_curve (GstGLEffects * effects,
|
||||||
{
|
{
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "rgbmap0");
|
shader = g_hash_table_lookup (effects->shaderstable, "rgbmap0");
|
||||||
|
|
|
@ -30,7 +30,7 @@ gst_gl_effects_sin_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "sin0");
|
shader = g_hash_table_lookup (effects->shaderstable, "sin0");
|
||||||
|
|
|
@ -30,7 +30,7 @@ gst_gl_effects_square_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "square0");
|
shader = g_hash_table_lookup (effects->shaderstable, "square0");
|
||||||
|
|
|
@ -36,7 +36,7 @@ gst_gl_effects_squeeze_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLFilter *filter = GST_GL_FILTER (data);
|
GstGLFilter *filter = GST_GL_FILTER (data);
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "squeeze0");
|
shader = g_hash_table_lookup (effects->shaderstable, "squeeze0");
|
||||||
|
|
|
@ -30,7 +30,7 @@ gst_gl_effects_stretch_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "stretch0");
|
shader = g_hash_table_lookup (effects->shaderstable, "stretch0");
|
||||||
|
|
|
@ -30,7 +30,7 @@ gst_gl_effects_tunnel_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "tunnel0");
|
shader = g_hash_table_lookup (effects->shaderstable, "tunnel0");
|
||||||
|
|
|
@ -30,13 +30,13 @@ gst_gl_effects_twirl_callback (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "twirl0");
|
shader = g_hash_table_lookup (effects->shaderstable, "twirl0");
|
||||||
|
|
||||||
if (!shader) {
|
if (!shader) {
|
||||||
shader = gst_gl_shader_new (GST_GL_FILTER (effects)->context);
|
shader = gst_gl_shader_new (context);
|
||||||
g_hash_table_insert (effects->shaderstable, (gchar *) "twirl0", shader);
|
g_hash_table_insert (effects->shaderstable, (gchar *) "twirl0", shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ gst_gl_effects_xray_step_two (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "xray1");
|
shader = g_hash_table_lookup (effects->shaderstable, "xray1");
|
||||||
|
@ -92,7 +92,7 @@ gst_gl_effects_xray_step_three (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "xray2");
|
shader = g_hash_table_lookup (effects->shaderstable, "xray2");
|
||||||
|
@ -135,7 +135,7 @@ gst_gl_effects_xray_desaturate (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "xray_desat");
|
shader = g_hash_table_lookup (effects->shaderstable, "xray_desat");
|
||||||
|
@ -175,7 +175,7 @@ gst_gl_effects_xray_sobel_hconv (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_hconv");
|
shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_hconv");
|
||||||
|
@ -218,7 +218,7 @@ gst_gl_effects_xray_sobel_vconv (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_vconv");
|
shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_vconv");
|
||||||
|
@ -261,7 +261,7 @@ gst_gl_effects_xray_sobel_length (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_len");
|
shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_len");
|
||||||
|
@ -305,7 +305,7 @@ gst_gl_effects_xray_step_five (gint width, gint height, guint texture,
|
||||||
GstGLShader *shader;
|
GstGLShader *shader;
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
GstGLEffects *effects = GST_GL_EFFECTS (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (effects);
|
GstGLFilter *filter = GST_GL_FILTER (effects);
|
||||||
GstGLContext *context = filter->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
|
||||||
GstGLFuncs *gl = context->gl_vtable;
|
GstGLFuncs *gl = context->gl_vtable;
|
||||||
|
|
||||||
shader = g_hash_table_lookup (effects->shaderstable, "xray4");
|
shader = g_hash_table_lookup (effects->shaderstable, "xray4");
|
||||||
|
|
|
@ -297,7 +297,7 @@ gst_gl_bumper_class_init (GstGLBumperClass * klass)
|
||||||
"Cyril Comparon <cyril.comparon@gmail.com>, "
|
"Cyril Comparon <cyril.comparon@gmail.com>, "
|
||||||
"Julien Isorce <julien.isorce@gmail.com>");
|
"Julien Isorce <julien.isorce@gmail.com>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -104,7 +104,7 @@ gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
|
||||||
filter_class->filter_texture = gst_gl_colorscale_filter_texture;
|
filter_class->filter_texture = gst_gl_colorscale_filter_texture;
|
||||||
|
|
||||||
basetransform_class->passthrough_on_same_caps = TRUE;
|
basetransform_class->passthrough_on_same_caps = TRUE;
|
||||||
filter_class->supported_gl_api =
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
|
||||||
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
|
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,13 +156,13 @@ gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
|
GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
|
||||||
|
|
||||||
if (gst_gl_context_get_gl_api (filter->context) & (GST_GL_API_GLES2 |
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
|
||||||
GST_GL_API_OPENGL3)) {
|
(GST_GL_API_GLES2 | GST_GL_API_OPENGL3)) {
|
||||||
gst_gl_context_thread_add (filter->context,
|
gst_gl_context_thread_add (GST_GL_BASE_FILTER (filter)->context,
|
||||||
(GstGLContextThreadFunc) _compile_identity_shader, colorscale);
|
(GstGLContextThreadFunc) _compile_identity_shader, colorscale);
|
||||||
|
|
||||||
if (!colorscale->shader) {
|
if (!colorscale->shader) {
|
||||||
gst_gl_context_set_error (filter->context,
|
gst_gl_context_set_error (GST_GL_BASE_FILTER (filter)->context,
|
||||||
"Failed to initialize identity shader");
|
"Failed to initialize identity shader");
|
||||||
GST_ELEMENT_ERROR (colorscale, RESOURCE, NOT_FOUND, ("%s",
|
GST_ELEMENT_ERROR (colorscale, RESOURCE, NOT_FOUND, ("%s",
|
||||||
gst_gl_context_get_error ()), (NULL));
|
gst_gl_context_get_error ()), (NULL));
|
||||||
|
@ -179,7 +179,8 @@ gst_gl_colorscale_del_gl_resources (GstGLFilter * filter)
|
||||||
GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
|
GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
|
||||||
|
|
||||||
if (colorscale->shader) {
|
if (colorscale->shader) {
|
||||||
gst_gl_context_del_shader (filter->context, colorscale->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
colorscale->shader);
|
||||||
colorscale->shader = NULL;
|
colorscale->shader = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,12 +193,13 @@ gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
|
|
||||||
colorscale = GST_GL_COLORSCALE (filter);
|
colorscale = GST_GL_COLORSCALE (filter);
|
||||||
|
|
||||||
if (gst_gl_context_get_gl_api (filter->context) & (GST_GL_API_GLES2 |
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
|
||||||
GST_GL_API_OPENGL3))
|
(GST_GL_API_GLES2 | GST_GL_API_OPENGL3))
|
||||||
gst_gl_filter_render_to_target_with_shader (filter, TRUE, in_tex, out_tex,
|
gst_gl_filter_render_to_target_with_shader (filter, TRUE, in_tex, out_tex,
|
||||||
colorscale->shader);
|
colorscale->shader);
|
||||||
|
|
||||||
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL)
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
|
||||||
|
GST_GL_API_OPENGL)
|
||||||
gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
|
gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex,
|
||||||
gst_gl_colorscale_callback, colorscale);
|
gst_gl_colorscale_callback, colorscale);
|
||||||
|
|
||||||
|
@ -211,8 +213,9 @@ gst_gl_colorscale_callback (gint width, gint height, guint texture,
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
|
|
||||||
#if GST_GL_HAVE_OPENGL
|
#if GST_GL_HAVE_OPENGL
|
||||||
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
|
||||||
const GstGLFuncs *gl = filter->context->gl_vtable;
|
GST_GL_API_OPENGL) {
|
||||||
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
|
|
@ -169,7 +169,7 @@ gst_gl_deinterlace_class_init (GstGLDeinterlaceClass * klass)
|
||||||
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_deinterlace_init_shader;
|
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_deinterlace_init_shader;
|
||||||
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_deinterlace_reset;
|
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_deinterlace_reset;
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -185,13 +185,12 @@ gst_gl_deinterlace_reset (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (filter);
|
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (filter);
|
||||||
|
|
||||||
if (deinterlace_filter->prev_buffer) {
|
gst_buffer_replace (&deinterlace_filter->prev_buffer, NULL);
|
||||||
gst_buffer_unref (deinterlace_filter->prev_buffer);
|
|
||||||
deinterlace_filter->prev_buffer = NULL;
|
|
||||||
}
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
if (deinterlace_filter->shader)
|
if (deinterlace_filter->shader)
|
||||||
gst_gl_context_del_shader (filter->context, deinterlace_filter->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
deinterlace_filter->shader);
|
||||||
deinterlace_filter->shader = NULL;
|
deinterlace_filter->shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,8 +226,8 @@ gst_gl_deinterlace_init_shader (GstGLFilter * filter)
|
||||||
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (filter);
|
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (filter);
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has compiled the shader
|
//blocking call, wait the opengl thread has compiled the shader
|
||||||
return gst_gl_context_gen_shader (filter->context, 0, greedyh_fragment_source,
|
return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
|
||||||
&deinterlace_filter->shader);
|
greedyh_fragment_source, &deinterlace_filter->shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -252,10 +251,7 @@ gst_gl_deinterlace_filter (GstGLFilter * filter, GstBuffer * inbuf,
|
||||||
|
|
||||||
gst_gl_filter_filter_texture (filter, inbuf, outbuf);
|
gst_gl_filter_filter_texture (filter, inbuf, outbuf);
|
||||||
|
|
||||||
if (deinterlace_filter->prev_buffer) {
|
gst_buffer_replace (&deinterlace_filter->prev_buffer, inbuf);
|
||||||
gst_buffer_unref (deinterlace_filter->prev_buffer);
|
|
||||||
}
|
|
||||||
deinterlace_filter->prev_buffer = gst_buffer_ref (filter->uploaded_buffer);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +263,7 @@ gst_gl_deinterlace_callback (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (stuff);
|
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (stuff);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
guint temp;
|
guint temp;
|
||||||
|
|
||||||
GLfloat verts[] = { -1.0, -1.0,
|
GLfloat verts[] = { -1.0, -1.0,
|
||||||
|
@ -294,7 +290,7 @@ gst_gl_deinterlace_callback (gint width, gint height, guint texture,
|
||||||
gl->Enable (GL_TEXTURE_2D);
|
gl->Enable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
if (G_UNLIKELY (deinterlace_filter->prev_tex == 0)) {
|
if (G_UNLIKELY (deinterlace_filter->prev_tex == 0)) {
|
||||||
gst_gl_context_gen_texture (filter->context,
|
gst_gl_context_gen_texture (GST_GL_BASE_FILTER (filter)->context,
|
||||||
&deinterlace_filter->prev_tex,
|
&deinterlace_filter->prev_tex,
|
||||||
GST_VIDEO_INFO_FORMAT (&filter->out_info),
|
GST_VIDEO_INFO_FORMAT (&filter->out_info),
|
||||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||||
|
|
|
@ -81,7 +81,7 @@ static void
|
||||||
gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (filter);
|
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
|
@ -95,12 +95,13 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
||||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
differencematte->shader[i] = gst_gl_shader_new (filter->context);
|
differencematte->shader[i] =
|
||||||
|
gst_gl_shader_new (GST_GL_BASE_FILTER (filter)->context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_gl_shader_compile_and_check (differencematte->shader[0],
|
if (!gst_gl_shader_compile_and_check (differencematte->shader[0],
|
||||||
difference_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
difference_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||||
gst_gl_context_set_error (GST_GL_FILTER (differencematte)->context,
|
gst_gl_context_set_error (GST_GL_BASE_FILTER (differencematte)->context,
|
||||||
"Failed to initialize difference shader");
|
"Failed to initialize difference shader");
|
||||||
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
||||||
("%s", gst_gl_context_get_error ()), (NULL));
|
("%s", gst_gl_context_get_error ()), (NULL));
|
||||||
|
@ -109,7 +110,7 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
||||||
|
|
||||||
if (!gst_gl_shader_compile_and_check (differencematte->shader[1],
|
if (!gst_gl_shader_compile_and_check (differencematte->shader[1],
|
||||||
hconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
hconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||||
gst_gl_context_set_error (GST_GL_FILTER (differencematte)->context,
|
gst_gl_context_set_error (GST_GL_BASE_FILTER (differencematte)->context,
|
||||||
"Failed to initialize hconv7 shader");
|
"Failed to initialize hconv7 shader");
|
||||||
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
||||||
("%s", gst_gl_context_get_error ()), (NULL));
|
("%s", gst_gl_context_get_error ()), (NULL));
|
||||||
|
@ -118,7 +119,7 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
||||||
|
|
||||||
if (!gst_gl_shader_compile_and_check (differencematte->shader[2],
|
if (!gst_gl_shader_compile_and_check (differencematte->shader[2],
|
||||||
vconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
vconv7_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||||
gst_gl_context_set_error (GST_GL_FILTER (differencematte)->context,
|
gst_gl_context_set_error (GST_GL_BASE_FILTER (differencematte)->context,
|
||||||
"Failed to initialize vconv7 shader");
|
"Failed to initialize vconv7 shader");
|
||||||
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
||||||
("%s", gst_gl_context_get_error ()), (NULL));
|
("%s", gst_gl_context_get_error ()), (NULL));
|
||||||
|
@ -127,7 +128,7 @@ gst_gl_differencematte_init_gl_resources (GstGLFilter * filter)
|
||||||
|
|
||||||
if (!gst_gl_shader_compile_and_check (differencematte->shader[3],
|
if (!gst_gl_shader_compile_and_check (differencematte->shader[3],
|
||||||
texture_interp_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
texture_interp_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
|
||||||
gst_gl_context_set_error (GST_GL_FILTER (differencematte)->context,
|
gst_gl_context_set_error (GST_GL_BASE_FILTER (differencematte)->context,
|
||||||
"Failed to initialize interp shader");
|
"Failed to initialize interp shader");
|
||||||
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
|
||||||
("%s", gst_gl_context_get_error ()), (NULL));
|
("%s", gst_gl_context_get_error ()), (NULL));
|
||||||
|
@ -140,7 +141,7 @@ static void
|
||||||
gst_gl_differencematte_reset_gl_resources (GstGLFilter * filter)
|
gst_gl_differencematte_reset_gl_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (filter);
|
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
gl->DeleteTextures (1, &differencematte->savedbgtexture);
|
gl->DeleteTextures (1, &differencematte->savedbgtexture);
|
||||||
|
@ -194,7 +195,7 @@ gst_gl_differencematte_class_init (GstGLDifferenceMatteClass * klass)
|
||||||
"Saves a background frame and replace it with a pixbuf",
|
"Saves a background frame and replace it with a pixbuf",
|
||||||
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -265,7 +266,7 @@ gst_gl_differencematte_save_texture (gint width, gint height, guint texture,
|
||||||
gpointer stuff)
|
gpointer stuff)
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
@ -278,7 +279,7 @@ init_pixbuf_texture (GstGLContext * context, gpointer data)
|
||||||
{
|
{
|
||||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (data);
|
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (data);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (data);
|
GstGLFilter *filter = GST_GL_FILTER (data);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->DeleteTextures (1, &differencematte->newbgtexture);
|
gl->DeleteTextures (1, &differencematte->newbgtexture);
|
||||||
gl->GenTextures (1, &differencematte->newbgtexture);
|
gl->GenTextures (1, &differencematte->newbgtexture);
|
||||||
|
@ -311,7 +312,7 @@ gst_gl_differencematte_diff (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
@ -341,7 +342,7 @@ gst_gl_differencematte_hblur (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
@ -368,7 +369,7 @@ gst_gl_differencematte_vblur (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
@ -395,7 +396,7 @@ gst_gl_differencematte_interp (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
glLoadIdentity ();
|
glLoadIdentity ();
|
||||||
|
@ -432,7 +433,7 @@ gst_gl_differencematte_identity (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
|
||||||
GstGLFilter *filter = GST_GL_FILTER (differencematte);
|
GstGLFilter *filter = GST_GL_FILTER (differencematte);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
@ -454,8 +455,8 @@ gst_gl_differencematte_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
differencematte->pixbuf = NULL;
|
differencematte->pixbuf = NULL;
|
||||||
|
|
||||||
/* if loader failed then context is turned off */
|
/* if loader failed then context is turned off */
|
||||||
gst_gl_context_thread_add (filter->context, init_pixbuf_texture,
|
gst_gl_context_thread_add (GST_GL_BASE_FILTER (filter)->context,
|
||||||
differencematte);
|
init_pixbuf_texture, differencematte);
|
||||||
|
|
||||||
/* save current frame, needed to calculate difference between
|
/* save current frame, needed to calculate difference between
|
||||||
* this frame and next ones */
|
* this frame and next ones */
|
||||||
|
@ -517,7 +518,7 @@ gst_gl_differencematte_loader (GstGLFilter * filter)
|
||||||
guchar **rows = NULL;
|
guchar **rows = NULL;
|
||||||
gint filler;
|
gint filler;
|
||||||
|
|
||||||
if (!filter->context)
|
if (!GST_GL_BASE_FILTER (filter)->context)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if ((fp = fopen (differencematte->location, "rb")) == NULL)
|
if ((fp = fopen (differencematte->location, "rb")) == NULL)
|
||||||
|
|
|
@ -130,8 +130,8 @@ gst_gl_effects_effect_get_type (void)
|
||||||
static void
|
static void
|
||||||
gst_gl_effects_set_effect (GstGLEffects * effects, gint effect_type)
|
gst_gl_effects_set_effect (GstGLEffects * effects, gint effect_type)
|
||||||
{
|
{
|
||||||
GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (effects);
|
GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (effects);
|
||||||
GstGLContext *context = GST_GL_FILTER (effects)->context;
|
GstGLContext *context = GST_GL_BASE_FILTER (effects)->context;
|
||||||
|
|
||||||
switch (effect_type) {
|
switch (effect_type) {
|
||||||
case GST_GL_EFFECT_IDENTITY:
|
case GST_GL_EFFECT_IDENTITY:
|
||||||
|
@ -232,7 +232,7 @@ static void
|
||||||
gst_gl_effects_init_gl_resources (GstGLFilter * filter)
|
gst_gl_effects_init_gl_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (filter);
|
GstGLEffects *effects = GST_GL_EFFECTS (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
|
|
||||||
for (i = 0; i < NEEDED_TEXTURES; i++) {
|
for (i = 0; i < NEEDED_TEXTURES; i++) {
|
||||||
|
@ -260,7 +260,7 @@ static void
|
||||||
gst_gl_effects_reset_gl_resources (GstGLFilter * filter)
|
gst_gl_effects_reset_gl_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLEffects *effects = GST_GL_EFFECTS (filter);
|
GstGLEffects *effects = GST_GL_EFFECTS (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
|
|
||||||
for (i = 0; i < NEEDED_TEXTURES; i++) {
|
for (i = 0; i < NEEDED_TEXTURES; i++) {
|
||||||
|
@ -313,7 +313,7 @@ gst_gl_effects_class_init (GstGLEffectsClass * klass)
|
||||||
"GL Shading Language effects",
|
"GL Shading Language effects",
|
||||||
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api =
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
|
||||||
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ gst_gl_effects_ghash_func_clean (gpointer key, gpointer value, gpointer data)
|
||||||
GstGLFilter *filter = (GstGLFilter *) data;
|
GstGLFilter *filter = (GstGLFilter *) data;
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
gst_gl_context_del_shader (filter->context, shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context, shader);
|
||||||
|
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,8 @@ gst_gl_effects_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
effects->outtexture = out_tex;
|
effects->outtexture = out_tex;
|
||||||
|
|
||||||
if (effects->horizontal_swap == TRUE)
|
if (effects->horizontal_swap == TRUE)
|
||||||
gst_gl_context_thread_add (filter->context, set_horizontal_swap, effects);
|
gst_gl_context_thread_add (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
set_horizontal_swap, effects);
|
||||||
|
|
||||||
effects->effect (effects);
|
effects->effect (effects);
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ gst_gl_filter_app_class_init (GstGLFilterAppClass * klass)
|
||||||
"Use client callbacks to define the scene",
|
"Use client callbacks to define the scene",
|
||||||
"Julien Isorce <julien.isorce@gmail.com>");
|
"Julien Isorce <julien.isorce@gmail.com>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api =
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
|
||||||
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ gst_gl_filter_app_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
cb.height = GST_VIDEO_INFO_HEIGHT (&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_v2 (filter->context,
|
gst_gl_context_use_fbo_v2 (GST_GL_BASE_FILTER (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, _glcb2, &cb);
|
filter->fbo, filter->depthbuffer, out_tex, _glcb2, &cb);
|
||||||
|
@ -217,8 +217,9 @@ gst_gl_filter_app_callback (gint width, gint height, guint texture,
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
|
|
||||||
#if GST_GL_HAVE_OPENGL
|
#if GST_GL_HAVE_OPENGL
|
||||||
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GST_GL_API_OPENGL) {
|
||||||
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
|
|
@ -67,7 +67,7 @@ static void
|
||||||
gst_gl_filterblur_init_resources (GstGLFilter * filter)
|
gst_gl_filterblur_init_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->GenTextures (1, &filterblur->midtexture);
|
gl->GenTextures (1, &filterblur->midtexture);
|
||||||
gl->BindTexture (GL_TEXTURE_2D, filterblur->midtexture);
|
gl->BindTexture (GL_TEXTURE_2D, filterblur->midtexture);
|
||||||
|
@ -85,7 +85,7 @@ static void
|
||||||
gst_gl_filterblur_reset_resources (GstGLFilter * filter)
|
gst_gl_filterblur_reset_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->DeleteTextures (1, &filterblur->midtexture);
|
gl->DeleteTextures (1, &filterblur->midtexture);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ gst_gl_filterblur_class_init (GstGLFilterBlurClass * klass)
|
||||||
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filterblur_init_shader;
|
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filterblur_init_shader;
|
||||||
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_filterblur_reset;
|
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_filterblur_reset;
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -137,12 +137,14 @@ gst_gl_filter_filterblur_reset (GstGLFilter * filter)
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
if (filterblur->shader0)
|
if (filterblur->shader0)
|
||||||
gst_gl_context_del_shader (filter->context, filterblur->shader0);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
filterblur->shader0);
|
||||||
filterblur->shader0 = NULL;
|
filterblur->shader0 = NULL;
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
if (filterblur->shader1)
|
if (filterblur->shader1)
|
||||||
gst_gl_context_del_shader (filter->context, filterblur->shader1);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
filterblur->shader1);
|
||||||
filterblur->shader1 = NULL;
|
filterblur->shader1 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,13 +180,13 @@ gst_gl_filterblur_init_shader (GstGLFilter * filter)
|
||||||
GstGLFilterBlur *blur_filter = GST_GL_FILTERBLUR (filter);
|
GstGLFilterBlur *blur_filter = GST_GL_FILTERBLUR (filter);
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has compiled the shader
|
//blocking call, wait the opengl thread has compiled the shader
|
||||||
if (!gst_gl_context_gen_shader (filter->context, 0, hconv7_fragment_source,
|
if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
|
||||||
&blur_filter->shader0))
|
hconv7_fragment_source, &blur_filter->shader0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has compiled the shader
|
//blocking call, wait the opengl thread has compiled the shader
|
||||||
if (!gst_gl_context_gen_shader (filter->context, 0, vconv7_fragment_source,
|
if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
|
||||||
&blur_filter->shader1))
|
vconv7_fragment_source, &blur_filter->shader1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -211,7 +213,7 @@ gst_gl_filterblur_hcallback (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
@ -238,7 +240,7 @@ gst_gl_filterblur_vcallback (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
GstGLFilterBlur *filterblur = GST_GL_FILTERBLUR (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
|
|
|
@ -180,7 +180,7 @@ gst_gl_filter_cube_class_init (GstGLFilterCubeClass * klass)
|
||||||
"Filter/Effect/Video", "Map input texture on the 6 cube faces",
|
"Filter/Effect/Video", "Map input texture on the 6 cube faces",
|
||||||
"Julien Isorce <julien.isorce@gmail.com>");
|
"Julien Isorce <julien.isorce@gmail.com>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api =
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
|
||||||
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ static void
|
||||||
gst_gl_filter_cube_reset_gl (GstGLFilter * filter)
|
gst_gl_filter_cube_reset_gl (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
|
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
|
||||||
const GstGLFuncs *gl = filter->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
if (cube_filter->vao) {
|
if (cube_filter->vao) {
|
||||||
gl->DeleteVertexArrays (1, &cube_filter->vao);
|
gl->DeleteVertexArrays (1, &cube_filter->vao);
|
||||||
|
@ -299,7 +299,8 @@ gst_gl_filter_cube_reset (GstGLFilter * filter)
|
||||||
|
|
||||||
/* blocking call, wait the opengl thread has destroyed the shader */
|
/* blocking call, wait the opengl thread has destroyed the shader */
|
||||||
if (cube_filter->shader)
|
if (cube_filter->shader)
|
||||||
gst_gl_context_del_shader (filter->context, cube_filter->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
cube_filter->shader);
|
||||||
cube_filter->shader = NULL;
|
cube_filter->shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,8 +310,8 @@ gst_gl_filter_cube_init_shader (GstGLFilter * filter)
|
||||||
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
|
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
|
||||||
|
|
||||||
/* blocking call, wait the opengl thread has compiled the shader */
|
/* blocking call, wait the opengl thread has compiled the shader */
|
||||||
return gst_gl_context_gen_shader (filter->context, cube_v_src, cube_f_src,
|
return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
&cube_filter->shader);
|
cube_v_src, cube_f_src, &cube_filter->shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -322,7 +323,7 @@ gst_gl_filter_cube_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
cube_filter->in_tex = in_tex;
|
cube_filter->in_tex = in_tex;
|
||||||
|
|
||||||
/* blocking call, use a FBO */
|
/* blocking call, use a FBO */
|
||||||
gst_gl_context_use_fbo_v2 (filter->context,
|
gst_gl_context_use_fbo_v2 (GST_GL_BASE_FILTER (filter)->context,
|
||||||
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&filter->out_info), filter->fbo,
|
GST_VIDEO_INFO_HEIGHT (&filter->out_info), filter->fbo,
|
||||||
filter->depthbuffer, out_tex, _callback, (gpointer) cube_filter);
|
filter->depthbuffer, out_tex, _callback, (gpointer) cube_filter);
|
||||||
|
@ -369,7 +370,7 @@ static const GLfloat vertices[] = {
|
||||||
static void
|
static void
|
||||||
_bind_buffer (GstGLFilterCube * cube_filter)
|
_bind_buffer (GstGLFilterCube * cube_filter)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_FILTER (cube_filter)->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (cube_filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->BindBuffer (GL_ARRAY_BUFFER, cube_filter->vertex_buffer);
|
gl->BindBuffer (GL_ARRAY_BUFFER, cube_filter->vertex_buffer);
|
||||||
|
|
||||||
|
@ -394,7 +395,7 @@ _bind_buffer (GstGLFilterCube * cube_filter)
|
||||||
static void
|
static void
|
||||||
_unbind_buffer (GstGLFilterCube * cube_filter)
|
_unbind_buffer (GstGLFilterCube * cube_filter)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_FILTER (cube_filter)->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (cube_filter)->context->gl_vtable;
|
||||||
|
|
||||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
@ -407,7 +408,7 @@ _callback (gpointer stuff)
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
|
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
static GLfloat xrot = 0;
|
static GLfloat xrot = 0;
|
||||||
static GLfloat yrot = 0;
|
static GLfloat yrot = 0;
|
||||||
|
|
|
@ -163,7 +163,7 @@ gst_gl_filter_glass_class_init (GstGLFilterGlassClass * klass)
|
||||||
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_glass_init_shader;
|
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_glass_init_shader;
|
||||||
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_glass_reset;
|
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_glass_reset;
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -180,10 +180,11 @@ gst_gl_filter_glass_reset (GstGLFilter * filter)
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
if (glass_filter->shader)
|
if (glass_filter->shader)
|
||||||
gst_gl_context_del_shader (filter->context, glass_filter->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
glass_filter->shader);
|
||||||
glass_filter->shader = NULL;
|
glass_filter->shader = NULL;
|
||||||
if (glass_filter->passthrough_shader)
|
if (glass_filter->passthrough_shader)
|
||||||
gst_gl_context_del_shader (filter->context,
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
glass_filter->passthrough_shader);
|
glass_filter->passthrough_shader);
|
||||||
glass_filter->passthrough_shader = NULL;
|
glass_filter->passthrough_shader = NULL;
|
||||||
}
|
}
|
||||||
|
@ -222,12 +223,13 @@ gst_gl_filter_glass_init_shader (GstGLFilter * filter)
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has compiled the shader
|
//blocking call, wait the opengl thread has compiled the shader
|
||||||
ret =
|
ret =
|
||||||
gst_gl_context_gen_shader (filter->context, glass_vertex_source,
|
gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
glass_fragment_source, &glass_filter->shader);
|
glass_vertex_source, glass_fragment_source, &glass_filter->shader);
|
||||||
if (ret)
|
if (ret)
|
||||||
ret =
|
ret =
|
||||||
gst_gl_context_gen_shader (filter->context, passthrough_vertex,
|
gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
passthrough_fragment, &glass_filter->passthrough_shader);
|
passthrough_vertex, passthrough_fragment,
|
||||||
|
&glass_filter->passthrough_shader);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +242,7 @@ gst_gl_filter_glass_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
glass_filter->in_tex = in_tex;
|
glass_filter->in_tex = in_tex;
|
||||||
|
|
||||||
//blocking call, use a FBO
|
//blocking call, use a FBO
|
||||||
gst_gl_context_use_fbo_v2 (filter->context,
|
gst_gl_context_use_fbo_v2 (GST_GL_BASE_FILTER (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,
|
filter->fbo, filter->depthbuffer, out_tex,
|
||||||
|
@ -262,7 +264,7 @@ static void
|
||||||
gst_gl_filter_glass_draw_background_gradient (GstGLFilterGlass * glass)
|
gst_gl_filter_glass_draw_background_gradient (GstGLFilterGlass * glass)
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (glass);
|
GstGLFilter *filter = GST_GL_FILTER (glass);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
gfloat mesh[] = {
|
gfloat mesh[] = {
|
||||||
|
@ -303,7 +305,7 @@ gst_gl_filter_glass_draw_video_plane (GstGLFilter * filter,
|
||||||
gfloat start_alpha, gfloat stop_alpha, gboolean reversed, gfloat rotation)
|
gfloat start_alpha, gfloat stop_alpha, gboolean reversed, gfloat rotation)
|
||||||
{
|
{
|
||||||
GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (filter);
|
GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gfloat topy = reversed ? center_y - 1.0f : center_y + 1.0f;
|
gfloat topy = reversed ? center_y - 1.0f : center_y + 1.0f;
|
||||||
gfloat bottomy = reversed ? center_y + 1.0f : center_y - 1.0f;
|
gfloat bottomy = reversed ? center_y + 1.0f : center_y - 1.0f;
|
||||||
|
@ -358,7 +360,7 @@ gst_gl_filter_glass_callback (gpointer stuff)
|
||||||
|
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (stuff);
|
GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gint width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
|
gint width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
|
||||||
gint height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
|
gint height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
|
||||||
|
@ -401,7 +403,7 @@ gst_gl_filter_glass_callback (gpointer stuff)
|
||||||
gst_gl_filter_glass_draw_video_plane (filter, width, height, texture,
|
gst_gl_filter_glass_draw_video_plane (filter, width, height, texture,
|
||||||
0.0f, 0.0f, 1.0f, 1.0f, FALSE, rotation);
|
0.0f, 0.0f, 1.0f, 1.0f, FALSE, rotation);
|
||||||
|
|
||||||
gst_gl_context_clear_shader (filter->context);
|
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
|
||||||
|
|
||||||
gl->Disable (GL_TEXTURE_2D);
|
gl->Disable (GL_TEXTURE_2D);
|
||||||
gl->Disable (GL_BLEND);
|
gl->Disable (GL_BLEND);
|
||||||
|
|
|
@ -120,7 +120,7 @@ gst_gl_filter_laplacian_class_init (GstGLFilterLaplacianClass * klass)
|
||||||
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_laplacian_init_shader;
|
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filter_laplacian_init_shader;
|
||||||
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_laplacian_reset;
|
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_laplacian_reset;
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -136,7 +136,8 @@ gst_gl_filter_laplacian_reset (GstGLFilter * filter)
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
if (laplacian_filter->shader)
|
if (laplacian_filter->shader)
|
||||||
gst_gl_context_del_shader (filter->context, laplacian_filter->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
laplacian_filter->shader);
|
||||||
laplacian_filter->shader = NULL;
|
laplacian_filter->shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +173,7 @@ gst_gl_filter_laplacian_init_shader (GstGLFilter * filter)
|
||||||
GstGLFilterLaplacian *laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
|
GstGLFilterLaplacian *laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has compiled the shader
|
//blocking call, wait the opengl thread has compiled the shader
|
||||||
return gst_gl_context_gen_shader (filter->context, 0,
|
return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
|
||||||
convolution_fragment_source, &laplacian_filter->shader);
|
convolution_fragment_source, &laplacian_filter->shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +198,7 @@ gst_gl_filter_laplacian_callback (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFilterLaplacian *laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
|
GstGLFilterLaplacian *laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gfloat kernel[9] = { 0.0, -1.0, 0.0,
|
gfloat kernel[9] = { 0.0, -1.0, 0.0,
|
||||||
-1.0, 4.0, -1.0,
|
-1.0, 4.0, -1.0,
|
||||||
|
|
|
@ -139,7 +139,7 @@ gst_gl_filter_reflected_screen_class_init (GstGLFilterReflectedScreenClass *
|
||||||
"OpenGL Reflected Screen filter", "Filter/Effect/Video",
|
"OpenGL Reflected Screen filter", "Filter/Effect/Video",
|
||||||
"Reflected Screen Filter", "Pierre POUZOL <pierre.pouzol@hotmail.fr>");
|
"Reflected Screen Filter", "Pierre POUZOL <pierre.pouzol@hotmail.fr>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -150,7 +150,7 @@ gst_gl_filtershader_class_init (GstGLFilterShaderClass * klass)
|
||||||
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filtershader_init_shader;
|
GST_GL_FILTER_CLASS (klass)->onInitFBO = gst_gl_filtershader_init_shader;
|
||||||
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_filtershader_reset;
|
GST_GL_FILTER_CLASS (klass)->onReset = gst_gl_filter_filtershader_reset;
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api =
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
|
||||||
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,8 @@ gst_gl_filter_filtershader_reset (GstGLFilter * filter)
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
if (filtershader->shader0)
|
if (filtershader->shader0)
|
||||||
gst_gl_context_del_shader (filter->context, filtershader->shader0);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
filtershader->shader0);
|
||||||
filtershader->shader0 = NULL;
|
filtershader->shader0 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,8 +327,8 @@ gst_gl_filtershader_init_shader (GstGLFilter * filter)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has compiled the shader
|
//blocking call, wait the opengl thread has compiled the shader
|
||||||
if (!gst_gl_context_gen_shader (filter->context, text_vertex_shader,
|
if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
hfilter_fragment_source, &filtershader->shader0))
|
text_vertex_shader, hfilter_fragment_source, &filtershader->shader0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -395,7 +396,7 @@ gst_gl_filtershader_hcallback (gint width, gint height, guint texture,
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFilterShader *filtershader = GST_GL_FILTERSHADER (filter);
|
GstGLFilterShader *filtershader = GST_GL_FILTERSHADER (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
gst_gl_shader_use (filtershader->shader0);
|
gst_gl_shader_use (filtershader->shader0);
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void
|
||||||
gst_gl_filtersobel_init_resources (GstGLFilter * filter)
|
gst_gl_filtersobel_init_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
|
GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
|
@ -92,7 +92,7 @@ static void
|
||||||
gst_gl_filtersobel_reset_resources (GstGLFilter * filter)
|
gst_gl_filtersobel_reset_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
|
GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
|
@ -132,7 +132,7 @@ gst_gl_filtersobel_class_init (GstGLFilterSobelClass * klass)
|
||||||
"Gstreamer OpenGL Sobel", "Filter/Effect/Video", "Sobel edge detection",
|
"Gstreamer OpenGL Sobel", "Filter/Effect/Video", "Sobel edge detection",
|
||||||
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
"Filippo Argiolas <filippo.argiolas@gmail.com>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -154,19 +154,23 @@ gst_gl_filter_filtersobel_reset (GstGLFilter * filter)
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
if (filtersobel->desat)
|
if (filtersobel->desat)
|
||||||
gst_gl_context_del_shader (filter->context, filtersobel->desat);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
filtersobel->desat);
|
||||||
filtersobel->desat = NULL;
|
filtersobel->desat = NULL;
|
||||||
|
|
||||||
if (filtersobel->hconv)
|
if (filtersobel->hconv)
|
||||||
gst_gl_context_del_shader (filter->context, filtersobel->hconv);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
filtersobel->hconv);
|
||||||
filtersobel->hconv = NULL;
|
filtersobel->hconv = NULL;
|
||||||
|
|
||||||
if (filtersobel->vconv)
|
if (filtersobel->vconv)
|
||||||
gst_gl_context_del_shader (filter->context, filtersobel->vconv);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
filtersobel->vconv);
|
||||||
filtersobel->vconv = NULL;
|
filtersobel->vconv = NULL;
|
||||||
|
|
||||||
if (filtersobel->len)
|
if (filtersobel->len)
|
||||||
gst_gl_context_del_shader (filter->context, filtersobel->len);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
filtersobel->len);
|
||||||
filtersobel->len = NULL;
|
filtersobel->len = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,16 +214,16 @@ gst_gl_filtersobel_init_shader (GstGLFilter * filter)
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has compiled the shader
|
//blocking call, wait the opengl thread has compiled the shader
|
||||||
ret =
|
ret =
|
||||||
gst_gl_context_gen_shader (filter->context, 0, desaturate_fragment_source,
|
gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
|
||||||
&filtersobel->desat);
|
desaturate_fragment_source, &filtersobel->desat);
|
||||||
ret &=
|
ret &=
|
||||||
gst_gl_context_gen_shader (filter->context, 0,
|
gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
|
||||||
sep_sobel_hconv3_fragment_source, &filtersobel->hconv);
|
sep_sobel_hconv3_fragment_source, &filtersobel->hconv);
|
||||||
ret &=
|
ret &=
|
||||||
gst_gl_context_gen_shader (filter->context, 0,
|
gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
|
||||||
sep_sobel_vconv3_fragment_source, &filtersobel->vconv);
|
sep_sobel_vconv3_fragment_source, &filtersobel->vconv);
|
||||||
ret &=
|
ret &=
|
||||||
gst_gl_context_gen_shader (filter->context, 0,
|
gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
|
||||||
sep_sobel_length_fragment_source, &filtersobel->len);
|
sep_sobel_length_fragment_source, &filtersobel->len);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -250,7 +254,7 @@ gst_gl_filtersobel_length (gint width, gint height, guint texture,
|
||||||
gpointer stuff)
|
gpointer stuff)
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
|
GstGLFilterSobel *filtersobel = GST_GL_FILTERSOBEL (filter);
|
||||||
|
|
||||||
glMatrixMode (GL_PROJECTION);
|
glMatrixMode (GL_PROJECTION);
|
||||||
|
|
|
@ -112,19 +112,14 @@ static gboolean
|
||||||
_negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps)
|
_negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstGLMixer *mix = GST_GL_MIXER (vagg);
|
GstGLMixer *mix = GST_GL_MIXER (vagg);
|
||||||
GstGLMixerClass *mix_class = GST_GL_MIXER_GET_CLASS (mix);
|
|
||||||
GstGLBaseMixerClass *base_mix_class = GST_GL_BASE_MIXER_GET_CLASS (mix);
|
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
mix->priv->negotiated = TRUE;
|
mix->priv->negotiated = TRUE;
|
||||||
base_mix_class->supported_gl_api = mix_class->supported_gl_api;
|
|
||||||
|
|
||||||
gst_caps_replace (&mix->out_caps, caps);
|
gst_caps_replace (&mix->out_caps, caps);
|
||||||
|
|
||||||
ret = GST_VIDEO_AGGREGATOR_CLASS (parent_class)->negotiated_caps (vagg, caps);
|
ret = GST_VIDEO_AGGREGATOR_CLASS (parent_class)->negotiated_caps (vagg, caps);
|
||||||
|
|
||||||
mix->context = GST_GL_BASE_MIXER (mix)->context;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +384,6 @@ gst_gl_mixer_class_init (GstGLMixerClass * klass)
|
||||||
g_type_class_ref (GST_TYPE_GL_MIXER_PAD);
|
g_type_class_ref (GST_TYPE_GL_MIXER_PAD);
|
||||||
|
|
||||||
klass->set_caps = NULL;
|
klass->set_caps = NULL;
|
||||||
klass->supported_gl_api = GST_GL_API_ANY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -537,7 +531,6 @@ gst_gl_mixer_decide_allocation (GstGLBaseMixer * base_mix, GstQuery * query)
|
||||||
|
|
||||||
gst_query_parse_allocation (query, &caps, NULL);
|
gst_query_parse_allocation (query, &caps, NULL);
|
||||||
|
|
||||||
mix->context = context;
|
|
||||||
if (mixer_class->set_caps)
|
if (mixer_class->set_caps)
|
||||||
mixer_class->set_caps (mix, caps);
|
mixer_class->set_caps (mix, caps);
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,6 @@ struct _GstGLMixer
|
||||||
{
|
{
|
||||||
GstGLBaseMixer vaggregator;
|
GstGLBaseMixer vaggregator;
|
||||||
|
|
||||||
GstGLContext *context;
|
|
||||||
|
|
||||||
GPtrArray *array_buffers;
|
GPtrArray *array_buffers;
|
||||||
GPtrArray *frames;
|
GPtrArray *frames;
|
||||||
|
|
||||||
|
@ -101,7 +99,6 @@ struct _GstGLMixer
|
||||||
struct _GstGLMixerClass
|
struct _GstGLMixerClass
|
||||||
{
|
{
|
||||||
GstGLBaseMixerClass parent_class;
|
GstGLBaseMixerClass parent_class;
|
||||||
GstGLAPI supported_gl_api;
|
|
||||||
|
|
||||||
GstGLMixerSetCaps set_caps;
|
GstGLMixerSetCaps set_caps;
|
||||||
GstGLMixerReset reset;
|
GstGLMixerReset reset;
|
||||||
|
|
|
@ -135,7 +135,7 @@ gst_gl_mosaic_class_init (GstGLMosaicClass * klass)
|
||||||
GST_GL_MIXER_CLASS (klass)->reset = gst_gl_mosaic_reset;
|
GST_GL_MIXER_CLASS (klass)->reset = gst_gl_mosaic_reset;
|
||||||
GST_GL_MIXER_CLASS (klass)->process_textures = gst_gl_mosaic_process_textures;
|
GST_GL_MIXER_CLASS (klass)->process_textures = gst_gl_mosaic_process_textures;
|
||||||
|
|
||||||
GST_GL_MIXER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
GST_GL_BASE_MIXER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -180,7 +180,8 @@ gst_gl_mosaic_reset (GstGLMixer * mixer)
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has destroyed the shader
|
//blocking call, wait the opengl thread has destroyed the shader
|
||||||
if (mosaic->shader)
|
if (mosaic->shader)
|
||||||
gst_gl_context_del_shader (mixer->context, mosaic->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_MIXER (mixer)->context,
|
||||||
|
mosaic->shader);
|
||||||
mosaic->shader = NULL;
|
mosaic->shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,8 +191,8 @@ gst_gl_mosaic_init_shader (GstGLMixer * mixer, GstCaps * outcaps)
|
||||||
GstGLMosaic *mosaic = GST_GL_MOSAIC (mixer);
|
GstGLMosaic *mosaic = GST_GL_MOSAIC (mixer);
|
||||||
|
|
||||||
//blocking call, wait the opengl thread has compiled the shader
|
//blocking call, wait the opengl thread has compiled the shader
|
||||||
return gst_gl_context_gen_shader (mixer->context, mosaic_v_src, mosaic_f_src,
|
return gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
|
||||||
&mosaic->shader);
|
mosaic_v_src, mosaic_f_src, &mosaic->shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -203,7 +204,7 @@ gst_gl_mosaic_process_textures (GstGLMixer * mix, GPtrArray * frames,
|
||||||
mosaic->input_frames = frames;
|
mosaic->input_frames = frames;
|
||||||
|
|
||||||
//blocking call, use a FBO
|
//blocking call, use a FBO
|
||||||
gst_gl_context_use_fbo_v2 (mix->context,
|
gst_gl_context_use_fbo_v2 (GST_GL_BASE_MIXER (mix)->context,
|
||||||
GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info),
|
GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info), mix->fbo,
|
GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info), mix->fbo,
|
||||||
mix->depthbuffer, out_tex, gst_gl_mosaic_callback, (gpointer) mosaic);
|
mix->depthbuffer, out_tex, gst_gl_mosaic_callback, (gpointer) mosaic);
|
||||||
|
@ -217,7 +218,7 @@ gst_gl_mosaic_callback (gpointer stuff)
|
||||||
{
|
{
|
||||||
GstGLMosaic *mosaic = GST_GL_MOSAIC (stuff);
|
GstGLMosaic *mosaic = GST_GL_MOSAIC (stuff);
|
||||||
GstGLMixer *mixer = GST_GL_MIXER (mosaic);
|
GstGLMixer *mixer = GST_GL_MIXER (mosaic);
|
||||||
GstGLFuncs *gl = mixer->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
|
||||||
|
|
||||||
static GLfloat xrot = 0;
|
static GLfloat xrot = 0;
|
||||||
static GLfloat yrot = 0;
|
static GLfloat yrot = 0;
|
||||||
|
@ -239,7 +240,7 @@ gst_gl_mosaic_callback (gpointer stuff)
|
||||||
|
|
||||||
guint count = 0;
|
guint count = 0;
|
||||||
|
|
||||||
gst_gl_context_clear_shader (mixer->context);
|
gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
|
||||||
gl->BindTexture (GL_TEXTURE_2D, 0);
|
gl->BindTexture (GL_TEXTURE_2D, 0);
|
||||||
gl->Disable (GL_TEXTURE_2D);
|
gl->Disable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
@ -344,7 +345,7 @@ gst_gl_mosaic_callback (gpointer stuff)
|
||||||
|
|
||||||
gl->Disable (GL_DEPTH_TEST);
|
gl->Disable (GL_DEPTH_TEST);
|
||||||
|
|
||||||
gst_gl_context_clear_shader (mixer->context);
|
gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
|
||||||
|
|
||||||
xrot += 0.6f;
|
xrot += 0.6f;
|
||||||
yrot += 0.4f;
|
yrot += 0.4f;
|
||||||
|
|
|
@ -125,10 +125,11 @@ gst_gl_overlay_init_gl_resources (GstGLFilter * filter)
|
||||||
GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
||||||
|
|
||||||
if (overlay->shader)
|
if (overlay->shader)
|
||||||
gst_gl_context_del_shader (filter->context, overlay->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
overlay->shader);
|
||||||
|
|
||||||
return gst_gl_context_gen_shader (filter->context, overlay_v_src,
|
return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
overlay_f_src, &overlay->shader);
|
overlay_v_src, overlay_f_src, &overlay->shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free resources that need a gl context */
|
/* free resources that need a gl context */
|
||||||
|
@ -136,10 +137,11 @@ static void
|
||||||
gst_gl_overlay_reset_gl_resources (GstGLFilter * filter)
|
gst_gl_overlay_reset_gl_resources (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
|
||||||
const GstGLFuncs *gl = filter->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
if (overlay->shader) {
|
if (overlay->shader) {
|
||||||
gst_gl_context_del_shader (filter->context, overlay->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
overlay->shader);
|
||||||
overlay->shader = NULL;
|
overlay->shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +247,7 @@ gst_gl_overlay_class_init (GstGLOverlayClass * klass)
|
||||||
"Filippo Argiolas <filippo.argiolas@gmail.com>, "
|
"Filippo Argiolas <filippo.argiolas@gmail.com>, "
|
||||||
"Matthew Waters <matthew@centricular.com>");
|
"Matthew Waters <matthew@centricular.com>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api =
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
|
||||||
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +375,7 @@ gst_gl_overlay_set_caps (GstGLFilter * filter, GstCaps * incaps,
|
||||||
static void
|
static void
|
||||||
_unbind_buffer (GstGLOverlay * overlay)
|
_unbind_buffer (GstGLOverlay * overlay)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_FILTER (overlay)->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (overlay)->context->gl_vtable;
|
||||||
|
|
||||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
@ -384,7 +386,7 @@ _unbind_buffer (GstGLOverlay * overlay)
|
||||||
static void
|
static void
|
||||||
_bind_buffer (GstGLOverlay * overlay, GLuint vbo)
|
_bind_buffer (GstGLOverlay * overlay, GLuint vbo)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_FILTER (overlay)->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (overlay)->context->gl_vtable;
|
||||||
|
|
||||||
gl->BindBuffer (GL_ARRAY_BUFFER, vbo);
|
gl->BindBuffer (GL_ARRAY_BUFFER, vbo);
|
||||||
|
|
||||||
|
@ -415,7 +417,7 @@ gst_gl_overlay_callback (gint width, gint height, guint texture, gpointer stuff)
|
||||||
GstMapInfo map_info;
|
GstMapInfo map_info;
|
||||||
guint image_tex;
|
guint image_tex;
|
||||||
gboolean memory_mapped = FALSE;
|
gboolean memory_mapped = FALSE;
|
||||||
const GstGLFuncs *gl = filter->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
GLushort indices[] = {
|
GLushort indices[] = {
|
||||||
0, 1, 2,
|
0, 1, 2,
|
||||||
|
@ -423,14 +425,16 @@ gst_gl_overlay_callback (gint width, gint height, guint texture, gpointer stuff)
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GST_GL_HAVE_OPENGL
|
#if GST_GL_HAVE_OPENGL
|
||||||
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
|
||||||
|
GST_GL_API_OPENGL) {
|
||||||
|
|
||||||
gl->MatrixMode (GL_PROJECTION);
|
gl->MatrixMode (GL_PROJECTION);
|
||||||
gl->LoadIdentity ();
|
gl->LoadIdentity ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL)
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
|
||||||
|
GST_GL_API_OPENGL)
|
||||||
gl->Enable (GL_TEXTURE_2D);
|
gl->Enable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
gl->ActiveTexture (GL_TEXTURE0);
|
gl->ActiveTexture (GL_TEXTURE0);
|
||||||
|
@ -549,7 +553,7 @@ out:
|
||||||
_unbind_buffer (overlay);
|
_unbind_buffer (overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_gl_context_clear_shader (filter->context);
|
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
|
||||||
|
|
||||||
if (memory_mapped)
|
if (memory_mapped)
|
||||||
gst_memory_unmap ((GstMemory *) overlay->image_memory, &map_info);
|
gst_memory_unmap ((GstMemory *) overlay->image_memory, &map_info);
|
||||||
|
@ -643,8 +647,8 @@ gst_gl_overlay_load_jpeg (GstGLFilter * filter)
|
||||||
gst_video_info_align (&v_info, &v_align);
|
gst_video_info_align (&v_info, &v_align);
|
||||||
|
|
||||||
overlay->image_memory =
|
overlay->image_memory =
|
||||||
(GstGLMemory *) gst_gl_memory_alloc (filter->context, NULL, &v_info, 0,
|
(GstGLMemory *) gst_gl_memory_alloc (GST_GL_BASE_FILTER (filter)->context,
|
||||||
&v_align);
|
NULL, &v_info, 0, &v_align);
|
||||||
|
|
||||||
if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
|
if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
|
||||||
GST_MAP_WRITE)) {
|
GST_MAP_WRITE)) {
|
||||||
|
@ -683,7 +687,7 @@ gst_gl_overlay_load_png (GstGLFilter * filter)
|
||||||
png_byte magic[8];
|
png_byte magic[8];
|
||||||
gint n_read;
|
gint n_read;
|
||||||
|
|
||||||
if (!filter->context)
|
if (!GST_GL_BASE_FILTER (filter)->context)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if ((fp = fopen (overlay->location, "rb")) == NULL)
|
if ((fp = fopen (overlay->location, "rb")) == NULL)
|
||||||
|
@ -744,8 +748,8 @@ gst_gl_overlay_load_png (GstGLFilter * filter)
|
||||||
|
|
||||||
gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, width, height);
|
gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, width, height);
|
||||||
overlay->image_memory =
|
overlay->image_memory =
|
||||||
(GstGLMemory *) gst_gl_memory_alloc (filter->context, NULL, &v_info, 0,
|
(GstGLMemory *) gst_gl_memory_alloc (GST_GL_BASE_FILTER (filter)->context,
|
||||||
NULL);
|
NULL, &v_info, 0, NULL);
|
||||||
|
|
||||||
if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
|
if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
|
||||||
GST_MAP_WRITE)) {
|
GST_MAP_WRITE)) {
|
||||||
|
|
|
@ -205,7 +205,7 @@ gst_gl_transformation_class_init (GstGLTransformationClass * klass)
|
||||||
"Filter/Effect/Video", "Transform video on the GPU",
|
"Filter/Effect/Video", "Transform video on the GPU",
|
||||||
"Lubosz Sarnecki <lubosz@gmail.com>");
|
"Lubosz Sarnecki <lubosz@gmail.com>");
|
||||||
|
|
||||||
GST_GL_FILTER_CLASS (klass)->supported_gl_api =
|
GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
|
||||||
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
|
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ static void
|
||||||
gst_gl_transformation_reset_gl (GstGLFilter * filter)
|
gst_gl_transformation_reset_gl (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
|
GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
|
||||||
const GstGLFuncs *gl = filter->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
if (transformation->vao) {
|
if (transformation->vao) {
|
||||||
gl->DeleteVertexArrays (1, &transformation->vao);
|
gl->DeleteVertexArrays (1, &transformation->vao);
|
||||||
|
@ -413,7 +413,8 @@ gst_gl_transformation_reset (GstGLFilter * filter)
|
||||||
|
|
||||||
/* blocking call, wait until the opengl thread has destroyed the shader */
|
/* blocking call, wait until the opengl thread has destroyed the shader */
|
||||||
if (transformation->shader)
|
if (transformation->shader)
|
||||||
gst_gl_context_del_shader (filter->context, transformation->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
|
transformation->shader);
|
||||||
transformation->shader = NULL;
|
transformation->shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,10 +423,10 @@ gst_gl_transformation_init_shader (GstGLFilter * filter)
|
||||||
{
|
{
|
||||||
GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
|
GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
|
||||||
|
|
||||||
if (gst_gl_context_get_gl_api (filter->context)) {
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context)) {
|
||||||
/* blocking call, wait until the opengl thread has compiled the shader */
|
/* blocking call, wait until the opengl thread has compiled the shader */
|
||||||
return gst_gl_context_gen_shader (filter->context, cube_v_src, cube_f_src,
|
return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
|
||||||
&transformation->shader);
|
cube_v_src, cube_f_src, &transformation->shader);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -439,7 +440,7 @@ gst_gl_transformation_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
transformation->in_tex = in_tex;
|
transformation->in_tex = in_tex;
|
||||||
|
|
||||||
/* blocking call, use a FBO */
|
/* blocking call, use a FBO */
|
||||||
gst_gl_context_use_fbo_v2 (filter->context,
|
gst_gl_context_use_fbo_v2 (GST_GL_BASE_FILTER (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,
|
filter->fbo, filter->depthbuffer,
|
||||||
|
@ -452,7 +453,8 @@ gst_gl_transformation_filter_texture (GstGLFilter * filter, guint in_tex,
|
||||||
static void
|
static void
|
||||||
_upload_vertices (GstGLTransformation * transformation)
|
_upload_vertices (GstGLTransformation * transformation)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_FILTER (transformation)->context->gl_vtable;
|
const GstGLFuncs *gl =
|
||||||
|
GST_GL_BASE_FILTER (transformation)->context->gl_vtable;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
GLfloat vertices[] = {
|
GLfloat vertices[] = {
|
||||||
|
@ -472,7 +474,8 @@ _upload_vertices (GstGLTransformation * transformation)
|
||||||
static void
|
static void
|
||||||
_bind_buffer (GstGLTransformation * transformation)
|
_bind_buffer (GstGLTransformation * transformation)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_FILTER (transformation)->context->gl_vtable;
|
const GstGLFuncs *gl =
|
||||||
|
GST_GL_BASE_FILTER (transformation)->context->gl_vtable;
|
||||||
|
|
||||||
gl->BindBuffer (GL_ARRAY_BUFFER, transformation->vertex_buffer);
|
gl->BindBuffer (GL_ARRAY_BUFFER, transformation->vertex_buffer);
|
||||||
|
|
||||||
|
@ -491,7 +494,8 @@ _bind_buffer (GstGLTransformation * transformation)
|
||||||
static void
|
static void
|
||||||
_unbind_buffer (GstGLTransformation * transformation)
|
_unbind_buffer (GstGLTransformation * transformation)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_FILTER (transformation)->context->gl_vtable;
|
const GstGLFuncs *gl =
|
||||||
|
GST_GL_BASE_FILTER (transformation)->context->gl_vtable;
|
||||||
|
|
||||||
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
@ -504,13 +508,13 @@ gst_gl_transformation_callback (gpointer stuff)
|
||||||
{
|
{
|
||||||
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
GstGLFilter *filter = GST_GL_FILTER (stuff);
|
||||||
GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
|
GstGLTransformation *transformation = GST_GL_TRANSFORMATION (filter);
|
||||||
GstGLFuncs *gl = filter->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
|
||||||
|
|
||||||
GLushort indices[] = { 0, 1, 2, 3, 0 };
|
GLushort indices[] = { 0, 1, 2, 3, 0 };
|
||||||
|
|
||||||
GLfloat temp_matrix[16];
|
GLfloat temp_matrix[16];
|
||||||
|
|
||||||
gst_gl_context_clear_shader (filter->context);
|
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
|
||||||
gl->BindTexture (GL_TEXTURE_2D, 0);
|
gl->BindTexture (GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
gl->ClearColor (0.f, 0.f, 0.f, 1.f);
|
gl->ClearColor (0.f, 0.f, 0.f, 1.f);
|
||||||
|
@ -563,6 +567,6 @@ gst_gl_transformation_callback (gpointer stuff)
|
||||||
else
|
else
|
||||||
_unbind_buffer (transformation);
|
_unbind_buffer (transformation);
|
||||||
|
|
||||||
gst_gl_context_clear_shader (filter->context);
|
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
|
||||||
transformation->caps_change = FALSE;
|
transformation->caps_change = FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -577,7 +577,7 @@ gst_gl_video_mixer_class_init (GstGLVideoMixerClass * klass)
|
||||||
|
|
||||||
agg_class->sinkpads_type = GST_TYPE_GL_VIDEO_MIXER_PAD;
|
agg_class->sinkpads_type = GST_TYPE_GL_VIDEO_MIXER_PAD;
|
||||||
|
|
||||||
GST_GL_MIXER_CLASS (klass)->supported_gl_api =
|
GST_GL_BASE_MIXER_CLASS (klass)->supported_gl_api =
|
||||||
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
|
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ _update_caps (GstVideoAggregator * vagg, GstCaps * caps)
|
||||||
static gboolean
|
static gboolean
|
||||||
_reset_pad_gl (GstAggregator * agg, GstAggregatorPad * aggpad, gpointer udata)
|
_reset_pad_gl (GstAggregator * agg, GstAggregatorPad * aggpad, gpointer udata)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_MIXER (agg)->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_MIXER (agg)->context->gl_vtable;
|
||||||
GstGLVideoMixerPad *pad = GST_GL_VIDEO_MIXER_PAD (aggpad);
|
GstGLVideoMixerPad *pad = GST_GL_VIDEO_MIXER_PAD (aggpad);
|
||||||
|
|
||||||
if (pad->vertex_buffer) {
|
if (pad->vertex_buffer) {
|
||||||
|
@ -694,7 +694,7 @@ _reset_pad_gl (GstAggregator * agg, GstAggregatorPad * aggpad, gpointer udata)
|
||||||
static void
|
static void
|
||||||
_reset_gl (GstGLContext * context, GstGLVideoMixer * video_mixer)
|
_reset_gl (GstGLContext * context, GstGLVideoMixer * video_mixer)
|
||||||
{
|
{
|
||||||
const GstGLFuncs *gl = GST_GL_MIXER (video_mixer)->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_MIXER (video_mixer)->context->gl_vtable;
|
||||||
|
|
||||||
if (video_mixer->vao) {
|
if (video_mixer->vao) {
|
||||||
gl->DeleteVertexArrays (1, &video_mixer->vao);
|
gl->DeleteVertexArrays (1, &video_mixer->vao);
|
||||||
|
@ -713,15 +713,16 @@ gst_gl_video_mixer_reset (GstGLMixer * mixer)
|
||||||
video_mixer->input_frames = NULL;
|
video_mixer->input_frames = NULL;
|
||||||
|
|
||||||
if (video_mixer->shader)
|
if (video_mixer->shader)
|
||||||
gst_gl_context_del_shader (mixer->context, video_mixer->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_MIXER (mixer)->context,
|
||||||
|
video_mixer->shader);
|
||||||
video_mixer->shader = NULL;
|
video_mixer->shader = NULL;
|
||||||
|
|
||||||
if (video_mixer->checker)
|
if (video_mixer->checker)
|
||||||
gst_gl_context_del_shader (mixer->context, video_mixer->checker);
|
gst_gl_context_del_shader (GST_GL_BASE_MIXER (mixer)->context,
|
||||||
|
video_mixer->checker);
|
||||||
video_mixer->checker = NULL;
|
video_mixer->checker = NULL;
|
||||||
|
|
||||||
if (mixer->context)
|
gst_gl_context_thread_add (GST_GL_BASE_MIXER (mixer)->context,
|
||||||
gst_gl_context_thread_add (mixer->context,
|
|
||||||
(GstGLContextThreadFunc) _reset_gl, mixer);
|
(GstGLContextThreadFunc) _reset_gl, mixer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,10 +732,11 @@ gst_gl_video_mixer_init_shader (GstGLMixer * mixer, GstCaps * outcaps)
|
||||||
GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (mixer);
|
GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (mixer);
|
||||||
|
|
||||||
if (video_mixer->shader)
|
if (video_mixer->shader)
|
||||||
gst_gl_context_del_shader (mixer->context, video_mixer->shader);
|
gst_gl_context_del_shader (GST_GL_BASE_MIXER (mixer)->context,
|
||||||
|
video_mixer->shader);
|
||||||
|
|
||||||
return gst_gl_context_gen_shader (mixer->context, video_mixer_v_src,
|
return gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
|
||||||
video_mixer_f_src, &video_mixer->shader);
|
video_mixer_v_src, video_mixer_f_src, &video_mixer->shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -745,7 +747,7 @@ gst_gl_video_mixer_process_textures (GstGLMixer * mix, GPtrArray * frames,
|
||||||
|
|
||||||
video_mixer->input_frames = frames;
|
video_mixer->input_frames = frames;
|
||||||
|
|
||||||
gst_gl_context_use_fbo_v2 (mix->context,
|
gst_gl_context_use_fbo_v2 (GST_GL_BASE_MIXER (mix)->context,
|
||||||
GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info),
|
GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info),
|
GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info),
|
||||||
mix->fbo, mix->depthbuffer,
|
mix->fbo, mix->depthbuffer,
|
||||||
|
@ -758,7 +760,7 @@ static gboolean
|
||||||
_draw_checker_background (GstGLVideoMixer * video_mixer)
|
_draw_checker_background (GstGLVideoMixer * video_mixer)
|
||||||
{
|
{
|
||||||
GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
|
GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
|
||||||
const GstGLFuncs *gl = mixer->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
|
||||||
gint attr_position_loc = 0;
|
gint attr_position_loc = 0;
|
||||||
|
|
||||||
const GLushort indices[] = {
|
const GLushort indices[] = {
|
||||||
|
@ -775,8 +777,8 @@ _draw_checker_background (GstGLVideoMixer * video_mixer)
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
if (!video_mixer->checker) {
|
if (!video_mixer->checker) {
|
||||||
if (!gst_gl_context_gen_shader (mixer->context, checker_v_src,
|
if (!gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
|
||||||
checker_f_src, &video_mixer->checker))
|
checker_v_src, checker_f_src, &video_mixer->checker))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,7 +812,7 @@ static gboolean
|
||||||
_draw_background (GstGLVideoMixer * video_mixer)
|
_draw_background (GstGLVideoMixer * video_mixer)
|
||||||
{
|
{
|
||||||
GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
|
GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
|
||||||
const GstGLFuncs *gl = mixer->context->gl_vtable;
|
const GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
|
||||||
|
|
||||||
switch (video_mixer->background) {
|
switch (video_mixer->background) {
|
||||||
case GST_GL_VIDEO_MIXER_BACKGROUND_BLACK:
|
case GST_GL_VIDEO_MIXER_BACKGROUND_BLACK:
|
||||||
|
@ -841,7 +843,7 @@ gst_gl_video_mixer_callback (gpointer stuff)
|
||||||
{
|
{
|
||||||
GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (stuff);
|
GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (stuff);
|
||||||
GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
|
GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
|
||||||
GstGLFuncs *gl = mixer->context->gl_vtable;
|
GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
|
||||||
|
|
||||||
GLint attr_position_loc = 0;
|
GLint attr_position_loc = 0;
|
||||||
GLint attr_texture_loc = 0;
|
GLint attr_texture_loc = 0;
|
||||||
|
@ -857,9 +859,10 @@ gst_gl_video_mixer_callback (gpointer stuff)
|
||||||
out_width = GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (stuff)->info);
|
out_width = GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (stuff)->info);
|
||||||
out_height = GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (stuff)->info);
|
out_height = GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (stuff)->info);
|
||||||
|
|
||||||
gst_gl_context_clear_shader (mixer->context);
|
gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
|
||||||
gl->BindTexture (GL_TEXTURE_2D, 0);
|
gl->BindTexture (GL_TEXTURE_2D, 0);
|
||||||
if (gst_gl_context_get_gl_api (mixer->context) & GST_GL_API_OPENGL)
|
if (gst_gl_context_get_gl_api (GST_GL_BASE_MIXER (mixer)->context) &
|
||||||
|
GST_GL_API_OPENGL)
|
||||||
gl->Disable (GL_TEXTURE_2D);
|
gl->Disable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
gl->Disable (GL_DEPTH_TEST);
|
gl->Disable (GL_DEPTH_TEST);
|
||||||
|
@ -986,5 +989,5 @@ gst_gl_video_mixer_callback (gpointer stuff)
|
||||||
|
|
||||||
gl->Disable (GL_BLEND);
|
gl->Disable (GL_BLEND);
|
||||||
|
|
||||||
gst_gl_context_clear_shader (mixer->context);
|
gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,8 +199,6 @@ gst_gl_filter_gl_start (GstGLBaseFilter * base_filter)
|
||||||
gint out_width, out_height;
|
gint out_width, out_height;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
filter->context = base_filter->context;
|
|
||||||
|
|
||||||
out_width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
|
out_width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
|
||||||
out_height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
|
out_height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
|
||||||
|
|
||||||
|
@ -696,13 +694,6 @@ gst_gl_filter_set_caps (GstBaseTransform * bt, GstCaps * incaps,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter->out_caps && !gst_caps_is_equal (filter->out_caps, outcaps)) {
|
|
||||||
if (filter->upload) {
|
|
||||||
gst_object_unref (filter->upload);
|
|
||||||
filter->upload = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_caps_replace (&filter->out_caps, outcaps);
|
gst_caps_replace (&filter->out_caps, outcaps);
|
||||||
|
|
||||||
GST_DEBUG ("set_caps %dx%d", GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
GST_DEBUG ("set_caps %dx%d", GST_VIDEO_INFO_WIDTH (&filter->out_info),
|
||||||
|
|
|
@ -58,9 +58,6 @@ struct _GstGLFilter
|
||||||
{
|
{
|
||||||
GstGLBaseFilter parent;
|
GstGLBaseFilter parent;
|
||||||
|
|
||||||
/* FIXME remove */
|
|
||||||
GstGLContext *context;
|
|
||||||
|
|
||||||
GstBufferPool *pool;
|
GstBufferPool *pool;
|
||||||
|
|
||||||
GstVideoInfo in_info;
|
GstVideoInfo in_info;
|
||||||
|
@ -68,18 +65,10 @@ struct _GstGLFilter
|
||||||
|
|
||||||
GstCaps *out_caps;
|
GstCaps *out_caps;
|
||||||
|
|
||||||
|
/* <private> */
|
||||||
GLuint fbo;
|
GLuint fbo;
|
||||||
GLuint depthbuffer;
|
GLuint depthbuffer;
|
||||||
|
|
||||||
GstGLUpload *upload;
|
|
||||||
GstGLColorConvert *in_convert;
|
|
||||||
GstCaps *in_converted_caps;
|
|
||||||
|
|
||||||
GstGLDownload *download;
|
|
||||||
|
|
||||||
GstBuffer *uploaded_buffer;
|
|
||||||
|
|
||||||
/* <private> */
|
|
||||||
GLuint in_tex_id;
|
GLuint in_tex_id;
|
||||||
GLuint out_tex_id;
|
GLuint out_tex_id;
|
||||||
|
|
||||||
|
@ -111,7 +100,6 @@ struct _GstGLFilter
|
||||||
struct _GstGLFilterClass
|
struct _GstGLFilterClass
|
||||||
{
|
{
|
||||||
GstGLBaseFilterClass parent_class;
|
GstGLBaseFilterClass parent_class;
|
||||||
GstGLAPI supported_gl_api;
|
|
||||||
|
|
||||||
gboolean (*set_caps) (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
|
gboolean (*set_caps) (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
|
||||||
gboolean (*filter) (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);
|
gboolean (*filter) (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);
|
||||||
|
|
Loading…
Reference in a new issue