Commit 92f0aa9b authored by Matthew Waters's avatar Matthew Waters 🐨 Committed by Tim-Philipp Müller

gl: get the context from basemixer/basefilter

parent 51620950
......@@ -30,7 +30,7 @@ gst_gl_effects_bulge_callback (gint width, gint height, guint texture,
GstGLShader *shader;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
#if GST_GL_HAVE_OPENGL
......
......@@ -31,7 +31,7 @@ gst_gl_effects_luma_to_curve (GstGLEffects * effects,
{
GstGLShader *shader;
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLFilter *filter = GST_GL_FILTER (data);
GstGLEffects *effects = GST_GL_EFFECTS (filter);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
shader = g_hash_table_lookup (effects->shaderstable, "mirror0");
......
......@@ -31,7 +31,7 @@ gst_gl_effects_rgb_to_curve (GstGLEffects * effects,
{
GstGLShader *shader;
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLFilter *filter = GST_GL_FILTER (data);
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
shader = g_hash_table_lookup (effects->shaderstable, "twirl0");
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);
}
......
......@@ -45,7 +45,7 @@ gst_gl_effects_xray_step_two (gint width, gint height, guint texture,
GstGLShader *shader;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
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>, "
"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
......
......@@ -104,7 +104,7 @@ gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
filter_class->filter_texture = gst_gl_colorscale_filter_texture;
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;
}
......@@ -156,13 +156,13 @@ gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter)
{
GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
if (gst_gl_context_get_gl_api (filter->context) & (GST_GL_API_GLES2 |
GST_GL_API_OPENGL3)) {
gst_gl_context_thread_add (filter->context,
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
(GST_GL_API_GLES2 | GST_GL_API_OPENGL3)) {
gst_gl_context_thread_add (GST_GL_BASE_FILTER (filter)->context,
(GstGLContextThreadFunc) _compile_identity_shader, colorscale);
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");
GST_ELEMENT_ERROR (colorscale, RESOURCE, NOT_FOUND, ("%s",
gst_gl_context_get_error ()), (NULL));
......@@ -179,7 +179,8 @@ gst_gl_colorscale_del_gl_resources (GstGLFilter * filter)
GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter);
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;
}
}
......@@ -192,12 +193,13 @@ gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex,
colorscale = GST_GL_COLORSCALE (filter);
if (gst_gl_context_get_gl_api (filter->context) & (GST_GL_API_GLES2 |
GST_GL_API_OPENGL3))
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
(GST_GL_API_GLES2 | GST_GL_API_OPENGL3))
gst_gl_filter_render_to_target_with_shader (filter, TRUE, in_tex, out_tex,
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_colorscale_callback, colorscale);
......@@ -211,8 +213,9 @@ gst_gl_colorscale_callback (gint width, gint height, guint texture,
GstGLFilter *filter = GST_GL_FILTER (stuff);
#if GST_GL_HAVE_OPENGL
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
const GstGLFuncs *gl = filter->context->gl_vtable;
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
GST_GL_API_OPENGL) {
const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
gl->MatrixMode (GL_PROJECTION);
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)->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
......@@ -185,13 +185,12 @@ gst_gl_deinterlace_reset (GstGLFilter * filter)
{
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (filter);
if (deinterlace_filter->prev_buffer) {
gst_buffer_unref (deinterlace_filter->prev_buffer);
deinterlace_filter->prev_buffer = NULL;
}
gst_buffer_replace (&deinterlace_filter->prev_buffer, NULL);
//blocking call, wait the opengl thread has destroyed the 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;
}
......@@ -227,8 +226,8 @@ gst_gl_deinterlace_init_shader (GstGLFilter * filter)
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (filter);
//blocking call, wait the opengl thread has compiled the shader
return gst_gl_context_gen_shader (filter->context, 0, greedyh_fragment_source,
&deinterlace_filter->shader);
return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
greedyh_fragment_source, &deinterlace_filter->shader);
}
static gboolean
......@@ -252,10 +251,7 @@ gst_gl_deinterlace_filter (GstGLFilter * filter, GstBuffer * inbuf,
gst_gl_filter_filter_texture (filter, inbuf, outbuf);
if (deinterlace_filter->prev_buffer) {
gst_buffer_unref (deinterlace_filter->prev_buffer);
}
deinterlace_filter->prev_buffer = gst_buffer_ref (filter->uploaded_buffer);
gst_buffer_replace (&deinterlace_filter->prev_buffer, inbuf);
return TRUE;
}
......@@ -267,7 +263,7 @@ gst_gl_deinterlace_callback (gint width, gint height, guint texture,
{
GstGLDeinterlace *deinterlace_filter = GST_GL_DEINTERLACE (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;
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);
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,
GST_VIDEO_INFO_FORMAT (&filter->out_info),
GST_VIDEO_INFO_WIDTH (&filter->out_info),
......
......@@ -81,7 +81,7 @@ static void
gst_gl_differencematte_init_gl_resources (GstGLFilter * 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;
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_WRAP_S, 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],
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");
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
("%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],
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");
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
("%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],
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");
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
("%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],
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");
GST_ELEMENT_ERROR (differencematte, RESOURCE, NOT_FOUND,
("%s", gst_gl_context_get_error ()), (NULL));
......@@ -140,7 +141,7 @@ static void
gst_gl_differencematte_reset_gl_resources (GstGLFilter * 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;
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",
"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
......@@ -265,7 +266,7 @@ gst_gl_differencematte_save_texture (gint width, gint height, guint texture,
gpointer 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->LoadIdentity ();
......@@ -278,7 +279,7 @@ init_pixbuf_texture (GstGLContext * context, gpointer data)
{
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (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->GenTextures (1, &differencematte->newbgtexture);
......@@ -311,7 +312,7 @@ gst_gl_differencematte_diff (gint width, gint height, guint texture,
{
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (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->LoadIdentity ();
......@@ -341,7 +342,7 @@ gst_gl_differencematte_hblur (gint width, gint height, guint texture,
{
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (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->LoadIdentity ();
......@@ -368,7 +369,7 @@ gst_gl_differencematte_vblur (gint width, gint height, guint texture,
{
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (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->LoadIdentity ();
......@@ -395,7 +396,7 @@ gst_gl_differencematte_interp (gint width, gint height, guint texture,
{
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (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);
glLoadIdentity ();
......@@ -432,7 +433,7 @@ gst_gl_differencematte_identity (gint width, gint height, guint texture,
{
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
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->LoadIdentity ();
......@@ -454,8 +455,8 @@ gst_gl_differencematte_filter_texture (GstGLFilter * filter, guint in_tex,
differencematte->pixbuf = NULL;
/* if loader failed then context is turned off */
gst_gl_context_thread_add (filter->context, init_pixbuf_texture,
differencematte);
gst_gl_context_thread_add (GST_GL_BASE_FILTER (filter)->context,
init_pixbuf_texture, differencematte);
/* save current frame, needed to calculate difference between
* this frame and next ones */
......@@ -517,7 +518,7 @@ gst_gl_differencematte_loader (GstGLFilter * filter)
guchar **rows = NULL;
gint filler;
if (!filter->context)
if (!GST_GL_BASE_FILTER (filter)->context)
return TRUE;
if ((fp = fopen (differencematte->location, "rb")) == NULL)
......
......@@ -130,8 +130,8 @@ gst_gl_effects_effect_get_type (void)
static void
gst_gl_effects_set_effect (GstGLEffects * effects, gint effect_type)
{
GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (effects);
GstGLContext *context = GST_GL_FILTER (effects)->context;
GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (effects);
GstGLContext *context = GST_GL_BASE_FILTER (effects)->context;
switch (effect_type) {
case GST_GL_EFFECT_IDENTITY:
......@@ -232,7 +232,7 @@ static void
gst_gl_effects_init_gl_resources (GstGLFilter * 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;
for (i = 0; i < NEEDED_TEXTURES; i++) {
......@@ -260,7 +260,7 @@ static void
gst_gl_effects_reset_gl_resources (GstGLFilter * 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;
for (i = 0; i < NEEDED_TEXTURES; i++) {
......@@ -313,7 +313,7 @@ gst_gl_effects_class_init (GstGLEffectsClass * klass)
"GL Shading Language effects",
"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;
}
......@@ -349,7 +349,7 @@ gst_gl_effects_ghash_func_clean (gpointer key, gpointer value, gpointer data)
GstGLFilter *filter = (GstGLFilter *) data;
//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;
}
......@@ -440,7 +440,8 @@ gst_gl_effects_filter_texture (GstGLFilter * filter, guint in_tex,
effects->outtexture = out_tex;
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);
......
......@@ -112,7 +112,7 @@ gst_gl_filter_app_class_init (GstGLFilterAppClass * klass)
"Use client callbacks to define the scene",
"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;
}
......@@ -196,7 +196,7 @@ gst_gl_filter_app_filter_texture (GstGLFilter * filter, guint in_tex,
cb.height = GST_VIDEO_INFO_HEIGHT (&filter->in_info);
//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_HEIGHT (&filter->out_info),
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);
#if GST_GL_HAVE_OPENGL
if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) {
GstGLFuncs *gl = filter->context->gl_vtable;
if (gst_gl_context_get_gl_api (GST_GL_BASE_FILTER (filter)->context) &
GST_GL_API_OPENGL) {
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
gl->MatrixMode (GL_PROJECTION);
gl->LoadIdentity ();
......
......@@ -67,7 +67,7 @@ static void
gst_gl_filterblur_init_resources (GstGLFilter * 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->BindTexture (GL_TEXTURE_2D, filterblur->midtexture);
......@@ -85,7 +85,7 @@ static void
gst_gl_filterblur_reset_resources (GstGLFilter * 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);
}
......@@ -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)->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
......@@ -137,12 +137,14 @@ gst_gl_filter_filterblur_reset (GstGLFilter * filter)
//blocking call, wait the opengl thread has destroyed the shader
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;
//blocking call, wait the opengl thread has destroyed the shader
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;
}
......@@ -178,13 +180,13 @@ gst_gl_filterblur_init_shader (GstGLFilter * filter)
GstGLFilterBlur *blur_filter = GST_GL_FILTERBLUR (filter);
//blocking call, wait the opengl thread has compiled the shader
if (!gst_gl_context_gen_shader (filter->context, 0, hconv7_fragment_source,
&blur_filter->shader0))
if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
hconv7_fragment_source, &blur_filter->shader0))
return FALSE;
//blocking call, wait the opengl thread has compiled the shader
if (!gst_gl_context_gen_shader (filter->context, 0, vconv7_fragment_source,
&blur_filter->shader1))
if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
vconv7_fragment_source, &blur_filter->shader1))
return FALSE;
return TRUE;
......@@ -211,7 +213,7 @@ gst_gl_filterblur_hcallback (gint width, gint height, guint texture,
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
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->LoadIdentity ();
......@@ -238,7 +240,7 @@ gst_gl_filterblur_vcallback (gint width, gint height, guint texture,
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
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->LoadIdentity ();
......
......@@ -180,7 +180,7 @@ gst_gl_filter_cube_class_init (GstGLFilterCubeClass * klass)
"Filter/Effect/Video", "Map input texture on the 6 cube faces",
"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;
}
......@@ -279,7 +279,7 @@ static void
gst_gl_filter_cube_reset_gl (GstGLFilter * 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) {
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 */
if (cube_filter->shader)