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");
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");
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");
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");
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");
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");
{
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
{
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");
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");
{
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");
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");
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");
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");
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");
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");
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);
}
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");
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");
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");
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");
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");
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");
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");
"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
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;
}
{
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));
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;
}
}
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);
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 ();
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
{
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;
}
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
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;
}
{
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,
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),
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++) {
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));
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));
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));
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));
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);
"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
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 ();
{
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);
{
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 ();
{
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 ();
{
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 ();
{
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 ();
{
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 ();
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 */
guchar **rows = NULL;
gint filler;
- if (!filter->context)
+ if (!GST_GL_BASE_FILTER (filter)->context)
return TRUE;
if ((fp = fopen (differencematte->location, "rb")) == NULL)
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:
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++) {
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++) {
"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;
}
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;
}
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);
"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;
}
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);
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 ();
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);
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);
}
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
//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;
}
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;
{
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 ();
{
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 ();
"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;
}
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);
/* blocking call, wait the opengl thread has destroyed the 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;
}
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
/* blocking call, wait the opengl thread has compiled the shader */
- return gst_gl_context_gen_shader (filter->context, cube_v_src, cube_f_src,
- &cube_filter->shader);
+ return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+ cube_v_src, cube_f_src, &cube_filter->shader);
}
static gboolean
cube_filter->in_tex = in_tex;
/* 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, _callback, (gpointer) cube_filter);
static void
_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);
static void
_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);
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
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 yrot = 0;
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)->supported_gl_api = GST_GL_API_OPENGL;
+ GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
}
static void
//blocking call, wait the opengl thread has destroyed the 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;
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 = NULL;
}
//blocking call, wait the opengl thread has compiled the shader
ret =
- gst_gl_context_gen_shader (filter->context, glass_vertex_source,
- glass_fragment_source, &glass_filter->shader);
+ gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+ glass_vertex_source, glass_fragment_source, &glass_filter->shader);
if (ret)
ret =
- gst_gl_context_gen_shader (filter->context, passthrough_vertex,
- passthrough_fragment, &glass_filter->passthrough_shader);
+ gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+ passthrough_vertex, passthrough_fragment,
+ &glass_filter->passthrough_shader);
return ret;
}
glass_filter->in_tex = in_tex;
//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,
gst_gl_filter_glass_draw_background_gradient (GstGLFilterGlass * 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* */
gfloat mesh[] = {
gfloat start_alpha, gfloat stop_alpha, gboolean reversed, gfloat rotation)
{
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 bottomy = reversed ? center_y + 1.0f : center_y - 1.0f;
GstGLFilter *filter = GST_GL_FILTER (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 height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
gst_gl_filter_glass_draw_video_plane (filter, width, height, texture,
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_BLEND);
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)->supported_gl_api = GST_GL_API_OPENGL;
+ GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
}
static void
//blocking call, wait the opengl thread has destroyed the 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;
}
GstGLFilterLaplacian *laplacian_filter = GST_GL_FILTER_LAPLACIAN (filter);
//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);
}
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
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,
-1.0, 4.0, -1.0,
"OpenGL Reflected Screen filter", "Filter/Effect/Video",
"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
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)->supported_gl_api =
+ GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api =
GST_GL_API_OPENGL | GST_GL_API_GLES2 | GST_GL_API_OPENGL3;
}
//blocking call, wait the opengl thread has destroyed the shader
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;
}
return FALSE;
//blocking call, wait the opengl thread has compiled the shader
- if (!gst_gl_context_gen_shader (filter->context, text_vertex_shader,
- hfilter_fragment_source, &filtershader->shader0))
+ if (!gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+ text_vertex_shader, hfilter_fragment_source, &filtershader->shader0))
return FALSE;
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
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_filtersobel_init_resources (GstGLFilter * 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;
for (i = 0; i < 2; i++) {
gst_gl_filtersobel_reset_resources (GstGLFilter * 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;
for (i = 0; i < 2; i++) {
"Gstreamer OpenGL Sobel", "Filter/Effect/Video", "Sobel edge detection",
"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
//blocking call, wait the opengl thread has destroyed the shader
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;
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;
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;
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;
}
//blocking call, wait the opengl thread has compiled the shader
ret =
- gst_gl_context_gen_shader (filter->context, 0, desaturate_fragment_source,
- &filtersobel->desat);
+ gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, 0,
+ desaturate_fragment_source, &filtersobel->desat);
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);
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);
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);
return ret;
gpointer 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);
glMatrixMode (GL_PROJECTION);
_negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps)
{
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;
mix->priv->negotiated = TRUE;
- base_mix_class->supported_gl_api = mix_class->supported_gl_api;
gst_caps_replace (&mix->out_caps, caps);
ret = GST_VIDEO_AGGREGATOR_CLASS (parent_class)->negotiated_caps (vagg, caps);
- mix->context = GST_GL_BASE_MIXER (mix)->context;
-
return ret;
}
g_type_class_ref (GST_TYPE_GL_MIXER_PAD);
klass->set_caps = NULL;
- klass->supported_gl_api = GST_GL_API_ANY;
}
static void
gst_query_parse_allocation (query, &caps, NULL);
- mix->context = context;
if (mixer_class->set_caps)
mixer_class->set_caps (mix, caps);
{
GstGLBaseMixer vaggregator;
- GstGLContext *context;
-
GPtrArray *array_buffers;
GPtrArray *frames;
struct _GstGLMixerClass
{
GstGLBaseMixerClass parent_class;
- GstGLAPI supported_gl_api;
GstGLMixerSetCaps set_caps;
GstGLMixerReset 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)->supported_gl_api = GST_GL_API_OPENGL;
+ GST_GL_BASE_MIXER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL;
}
static void
//blocking call, wait the opengl thread has destroyed the 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;
}
GstGLMosaic *mosaic = GST_GL_MOSAIC (mixer);
//blocking call, wait the opengl thread has compiled the shader
- return gst_gl_context_gen_shader (mixer->context, mosaic_v_src, mosaic_f_src,
- &mosaic->shader);
+ return gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
+ mosaic_v_src, mosaic_f_src, &mosaic->shader);
}
static gboolean
mosaic->input_frames = frames;
//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_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info), mix->fbo,
mix->depthbuffer, out_tex, gst_gl_mosaic_callback, (gpointer) mosaic);
{
GstGLMosaic *mosaic = GST_GL_MOSAIC (stuff);
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 yrot = 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->Disable (GL_TEXTURE_2D);
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;
yrot += 0.4f;
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 */
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;
}
"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;
}
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);
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);
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,
};
#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);
_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);
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)) {
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)
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)) {
"Filter/Effect/Video", "Transform video on the GPU",
"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_transformation_reset_gl (GstGLFilter * 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) {
gl->DeleteVertexArrays (1, &transformation->vao);
/* blocking call, wait until the opengl thread has destroyed the 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;
}
{
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 */
- return gst_gl_context_gen_shader (filter->context, cube_v_src, cube_f_src,
- &transformation->shader);
+ return gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context,
+ cube_v_src, cube_f_src, &transformation->shader);
}
return TRUE;
}
transformation->in_tex = in_tex;
/* 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,
static void
_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* */
GLfloat vertices[] = {
static void
_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);
static void
_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);
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
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 };
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->ClearColor (0.f, 0.f, 0.f, 1.f);
else
_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;
}
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;
}
static gboolean
_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);
if (pad->vertex_buffer) {
static void
_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) {
gl->DeleteVertexArrays (1, &video_mixer->vao);
video_mixer->input_frames = NULL;
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;
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;
- if (mixer->context)
- gst_gl_context_thread_add (mixer->context,
- (GstGLContextThreadFunc) _reset_gl, mixer);
+ gst_gl_context_thread_add (GST_GL_BASE_MIXER (mixer)->context,
+ (GstGLContextThreadFunc) _reset_gl, mixer);
}
static gboolean
GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (mixer);
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,
- video_mixer_f_src, &video_mixer->shader);
+ return gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
+ video_mixer_v_src, video_mixer_f_src, &video_mixer->shader);
}
static gboolean
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_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info),
mix->fbo, mix->depthbuffer,
_draw_checker_background (GstGLVideoMixer * 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;
const GLushort indices[] = {
/* *INDENT-ON* */
if (!video_mixer->checker) {
- if (!gst_gl_context_gen_shader (mixer->context, checker_v_src,
- checker_f_src, &video_mixer->checker))
+ if (!gst_gl_context_gen_shader (GST_GL_BASE_MIXER (mixer)->context,
+ checker_v_src, checker_f_src, &video_mixer->checker))
return FALSE;
}
_draw_background (GstGLVideoMixer * 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) {
case GST_GL_VIDEO_MIXER_BACKGROUND_BLACK:
{
GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (stuff);
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_texture_loc = 0;
out_width = GST_VIDEO_INFO_WIDTH (&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);
- 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_DEPTH_TEST);
gl->Disable (GL_BLEND);
- gst_gl_context_clear_shader (mixer->context);
+ gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
}
gint out_width, out_height;
GError *error = NULL;
- filter->context = base_filter->context;
-
out_width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
out_height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
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_DEBUG ("set_caps %dx%d", GST_VIDEO_INFO_WIDTH (&filter->out_info),
{
GstGLBaseFilter parent;
- /* FIXME remove */
- GstGLContext *context;
-
GstBufferPool *pool;
GstVideoInfo in_info;
GstCaps *out_caps;
+ /* <private> */
GLuint fbo;
GLuint depthbuffer;
- GstGLUpload *upload;
- GstGLColorConvert *in_convert;
- GstCaps *in_converted_caps;
-
- GstGLDownload *download;
-
- GstBuffer *uploaded_buffer;
-
- /* <private> */
GLuint in_tex_id;
GLuint out_tex_id;
struct _GstGLFilterClass
{
GstGLBaseFilterClass parent_class;
- GstGLAPI supported_gl_api;
gboolean (*set_caps) (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
gboolean (*filter) (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);