summaryrefslogtreecommitdiff
path: root/ext/gl/gstgloverlay.c
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-03-13 10:25:35 +0000
committerMatthew Waters <matthew@centricular.com>2015-03-13 12:30:20 +0000
commit34485c99763f025bad644ef6d8de19068cb61f48 (patch)
treef4416e722d937584808ffed407677a25ef36a342 /ext/gl/gstgloverlay.c
parent91b7642c485e0764740f1f0ea77d92584ee63a17 (diff)
gl: get the context from basemixer/basefilter
Diffstat (limited to 'ext/gl/gstgloverlay.c')
-rw-r--r--ext/gl/gstgloverlay.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/ext/gl/gstgloverlay.c b/ext/gl/gstgloverlay.c
index 1371264af..2dd53269f 100644
--- a/ext/gl/gstgloverlay.c
+++ b/ext/gl/gstgloverlay.c
@@ -125,10 +125,11 @@ gst_gl_overlay_init_gl_resources (GstGLFilter * filter)
GstGLOverlay *overlay = GST_GL_OVERLAY (filter);
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,
- overlay_f_src, &overlay->shader);
+ return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+ overlay_v_src, overlay_f_src, &overlay->shader);
}
/* free resources that need a gl context */
@@ -136,10 +137,11 @@ static void
gst_gl_overlay_reset_gl_resources (GstGLFilter * 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) {
- 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;
}
@@ -245,7 +247,7 @@ gst_gl_overlay_class_init (GstGLOverlayClass * klass)
"Filippo Argiolas <filippo.argiolas@gmail.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;
}
@@ -373,7 +375,7 @@ gst_gl_overlay_set_caps (GstGLFilter * filter, GstCaps * incaps,
static void
_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);
@@ -384,7 +386,7 @@ _unbind_buffer (GstGLOverlay * overlay)
static void
_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);
@@ -415,7 +417,7 @@ gst_gl_overlay_callback (gint width, gint height, guint texture, gpointer stuff)
GstMapInfo map_info;
guint image_tex;
gboolean memory_mapped = FALSE;
- const GstGLFuncs *gl = filter->context->gl_vtable;
+ const GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
GLushort indices[] = {
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_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->LoadIdentity ();
}
#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->ActiveTexture (GL_TEXTURE0);
@@ -549,7 +553,7 @@ out:
_unbind_buffer (overlay);
}
- gst_gl_context_clear_shader (filter->context);
+ gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
if (memory_mapped)
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);
overlay->image_memory =
- (GstGLMemory *) gst_gl_memory_alloc (filter->context, NULL, &v_info, 0,
- &v_align);
+ (GstGLMemory *) gst_gl_memory_alloc (GST_GL_BASE_FILTER (filter)->context,
+ NULL, &v_info, 0, &v_align);
if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
GST_MAP_WRITE)) {
@@ -683,7 +687,7 @@ gst_gl_overlay_load_png (GstGLFilter * filter)
png_byte magic[8];
gint n_read;
- if (!filter->context)
+ if (!GST_GL_BASE_FILTER (filter)->context)
return 1;
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);
overlay->image_memory =
- (GstGLMemory *) gst_gl_memory_alloc (filter->context, NULL, &v_info, 0,
- NULL);
+ (GstGLMemory *) gst_gl_memory_alloc (GST_GL_BASE_FILTER (filter)->context,
+ NULL, &v_info, 0, NULL);
if (!gst_memory_map ((GstMemory *) overlay->image_memory, &map_info,
GST_MAP_WRITE)) {