};
static void gst_gl_buffer_pool_finalize (GObject * object);
+static void gst_gl_buffer_pool_dispose (GObject * object);
GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_BUFFER_POOL);
#define GST_CAT_DEFAULT GST_CAT_GL_BUFFER_POOL
g_type_class_add_private (klass, sizeof (GstGLBufferPoolPrivate));
gobject_class->finalize = gst_gl_buffer_pool_finalize;
+ gobject_class->dispose = gst_gl_buffer_pool_dispose;
gstbufferpool_class->get_options = gst_gl_buffer_pool_get_options;
gstbufferpool_class->set_config = gst_gl_buffer_pool_set_config;
}
static void
+gst_gl_buffer_pool_dispose (GObject * object)
+{
+ GstGLBufferPool *pool = GST_GL_BUFFER_POOL_CAST (object);
+
+ if (pool->display) {
+ gst_object_unref (pool->display);
+ pool->display = NULL;
+ }
+
+ G_OBJECT_CLASS (gst_gl_buffer_pool_parent_class)->dispose (object);
+}
+
+static void
gst_gl_buffer_pool_finalize (GObject * object)
{
GstGLBufferPool *pool = GST_GL_BUFFER_POOL_CAST (object);
download = g_object_new (GST_TYPE_GL_DOWNLOAD, NULL);
- download->display = g_object_ref (display);
+ download->display = gst_object_ref (display);
priv = download->priv;
#if GST_GL_HAVE_OPENGL
download->depth_buffer = 0;
}
if (download->shader) {
- g_object_unref (G_OBJECT (download->shader));
+ gst_object_unref (download->shader);
download->shader = NULL;
}
if (download->display) {
- g_object_unref (G_OBJECT (download->display));
+ gst_object_unref (download->display);
download->display = NULL;
}
g_mutex_clear (&download->lock);
+
+ G_OBJECT_CLASS (gst_gl_download_parent_class)->finalize (object);
}
static inline gboolean
gst_gl_display_set_error (display, "%s", error->message);
g_error_free (error);
gst_gl_display_clear_shader (display);
- g_object_unref (G_OBJECT (shader));
+ gst_object_unref (shader);
return FALSE;
}
}
//blocking call, delete the FBO
gst_gl_display_del_fbo (filter->display, filter->fbo, filter->depthbuffer);
- g_object_unref (filter->display);
+ gst_object_unref (filter->display);
filter->display = NULL;
}
if (G_VALUE_HOLDS_POINTER (id_value))
/* at least one gl element is after in our gl chain */
filter->display =
- g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
+ gst_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
else {
GstGLWindow *window;
GError *error = NULL;
filter->display = gst_gl_display_new ();
window = gst_gl_window_new (filter->display);
gst_gl_display_set_window (filter->display, window);
- g_object_unref (window);
+ gst_object_unref (window);
if (!gst_gl_window_create_context (window, 0, &error)) {
GST_ELEMENT_ERROR (filter, RESOURCE, NOT_FOUND,
gst_gl_upload_perform_with_data (filter->upload, in_tex, in_frame.data);
}
+ GST_DEBUG ("calling filter_texture with textures in:%i out:%i", in_tex,
+ out_tex);
+
g_assert (filter_class->filter_texture);
ret = filter_class->filter_texture (filter, in_tex, out_tex);
GST_GL_MIXER_LOCK (mix);
if ((obj = g_slist_nth_data (mix->sinkpads, index)))
- g_object_ref (obj);
+ gst_object_ref (obj);
GST_GL_MIXER_UNLOCK (mix);
return obj;
}
id_value = gst_structure_get_value (structure, "gstgldisplay");
if (G_VALUE_HOLDS_POINTER (id_value))
mix->display =
- g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
+ gst_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
else {
GstGLWindow *window;
GError *error = NULL;
mix->display = gst_gl_display_new ();
window = gst_gl_window_new (mix->display);
gst_gl_display_set_window (mix->display, window);
- g_object_unref (window);
+ gst_object_unref (window);
if (!gst_gl_window_create_context (window, 0, &error)) {
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
mix->depthbuffer = 0;
}
if (mix->download) {
- g_object_unref (mix->download);
+ gst_object_unref (mix->download);
mix->download = NULL;
}
GstGLMixerPad *pad = (GstGLMixerPad *) (walk->data);
if (pad->upload) {
- g_object_unref (pad->upload);
+ gst_object_unref (pad->upload);
pad->upload = NULL;
}
}
if (mix->display) {
- g_object_unref (mix->display);
+ gst_object_unref (mix->display);
mix->display = NULL;
}
break;
G_DEFINE_TYPE_WITH_CODE (GstGLShader, gst_gl_shader, G_TYPE_OBJECT, DEBUG_INIT);
static void
+gst_gl_shader_dispose (GObject * object)
+{
+ GstGLShader *shader;
+
+ shader = GST_GL_SHADER (object);
+
+ if (shader->display) {
+ gst_object_unref (shader->display);
+ shader->display = NULL;
+ }
+
+ G_OBJECT_CLASS (gst_gl_shader_parent_class)->dispose (object);
+}
+
+static void
gst_gl_shader_finalize (GObject * object)
{
GstGLShader *shader;
g_type_class_add_private (klass, sizeof (GstGLShaderPrivate));
obj_class->finalize = gst_gl_shader_finalize;
+ obj_class->dispose = gst_gl_shader_dispose;
obj_class->set_property = gst_gl_shader_set_property;
obj_class->get_property = gst_gl_shader_get_property;
g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL);
shader = g_object_new (GST_GL_TYPE_SHADER, NULL);
- shader->display = display;
+ shader->display = gst_object_ref (display);
if (!_fill_vtable (shader, display))
return NULL;
upload = g_object_new (GST_TYPE_GL_UPLOAD, NULL);
- upload->display = g_object_ref (display);
+ upload->display = gst_object_ref (display);
priv = upload->priv;
g_mutex_init (&upload->lock);
upload->depth_buffer = 0;
}
if (upload->shader) {
- g_object_unref (G_OBJECT (upload->shader));
+ gst_object_unref (upload->shader);
upload->shader = NULL;
}
if (upload->display) {
- g_object_unref (G_OBJECT (upload->display));
+ gst_object_unref (upload->display);
upload->display = NULL;
}
+
+ G_OBJECT_CLASS (gst_gl_upload_parent_class)->finalize (object);
}
/**
gst_gl_display_set_error (display, "%s", error->message);
g_error_free (error);
gst_gl_display_clear_shader (display);
- g_object_unref (G_OBJECT (shader));
+ gst_object_unref (shader);
return FALSE;
}
static GLuint gen_texture_height;
static GstVideoFormat gen_texture_video_format;
+static GLuint *del_texture;
+
/* filter gen fbo */
static GLuint gen_fbo_width;
static GLuint gen_fbo_height;
}
void
-gst_gl_display_del_texture_thread (GstGLDisplay * display, GLuint * pTexture)
+gst_gl_display_del_texture_window_cb (GstGLDisplay * display)
{
- //glDeleteTextures (1, pTexture);
+ glDeleteTextures (1, del_texture);
}
/* called in the gl thread */
void
gst_gl_display_del_texture (GstGLDisplay * display, GLuint * pTexture)
{
+ GstGLWindow *window;
+
gst_gl_display_lock (display);
- if (*pTexture) {
- gst_gl_display_del_texture_thread (display, pTexture);
+
+ window = gst_gl_display_get_window_unlocked (display);
+ if (gst_gl_window_is_running (window) && *pTexture) {
+ del_texture = pTexture;
+ gst_gl_window_send_message (window,
+ GST_GL_WINDOW_CB (gst_gl_display_del_texture_window_cb), display);
}
+
+ gst_object_unref (window);
+
gst_gl_display_unlock (display);
}
g_error_free (error);
error = NULL;
gst_gl_display_clear_shader (display);
- g_object_unref (G_OBJECT (gen_shader));
+ gst_object_unref (gen_shader);
gen_shader = NULL;
}
}
GST_TRACE ("Deleting shader %" GST_PTR_FORMAT, del_shader);
if (del_shader) {
- g_object_unref (G_OBJECT (del_shader));
+ gst_object_unref (del_shader);
del_shader = NULL;
}
}
GST_INFO ("quit sent to gl window loop");
+ GST_GL_WINDOW_UNLOCK (window);
+
g_cond_wait (&window->priv->cond_destroy_context, &window->priv->render_lock);
GST_INFO ("quit received from gl window");
-
- GST_GL_WINDOW_UNLOCK (window);
}
void
window->priv->alive = FALSE;
-// g_object_unref (G_OBJECT (display->gl_window));
-
-// display->gl_window = NULL;
-
g_cond_signal (&window->priv->cond_destroy_context);
g_mutex_unlock (&window->priv->render_lock);
void
teardown (void)
{
- g_object_unref (display);
+ gst_object_unref (display);
}
GST_START_TEST (test_basic)