GstVisualGL *visual = GST_VISUAL_GL (object);
if (visual->adapter) {
- g_object_unref (visual->adapter);
+ gst_object_unref (visual->adapter);
visual->adapter = NULL;
}
if (G_VALUE_HOLDS_POINTER (id_value))
/* at least one gl element is after in our gl chain */
visual->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 {
/* this gl filter is a sink in terms of the gl chain */
visual->display = gst_gl_display_new ();
visual->midtexture = 0;
}
if (visual->display) {
- g_object_unref (visual->display);
+ gst_object_unref (visual->display);
visual->display = NULL;
}
};
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);
gl->DeleteTextures (1, &differencematte->newbgtexture);
for (i = 0; i < 4; i++) {
if (differencematte->shader[i]) {
- g_object_unref (differencematte->shader[i]);
+ gst_object_unref (differencematte->shader[i]);
differencematte->shader[i] = NULL;
}
if (differencematte->midtexture[i]) {
("%s", error->message), (NULL));
if (glimage_sink->display) {
- g_object_unref (glimage_sink->display);
+ gst_object_unref (glimage_sink->display);
glimage_sink->display = NULL;
}
gst_object_unref (window);
glimage_sink->stored_buffer = NULL;
}
if (glimage_sink->upload) {
- g_object_unref (glimage_sink->upload);
+ gst_object_unref (glimage_sink->upload);
glimage_sink->upload = NULL;
}
gst_gl_window_set_draw_callback (window, NULL, NULL);
gst_gl_window_set_close_callback (window, NULL, NULL);
- g_object_unref (window);
- g_object_unref (glimage_sink->display);
+ gst_object_unref (window);
+ gst_object_unref (glimage_sink->display);
glimage_sink->display = NULL;
}
break;
gst_object_unref (window);
}
- //the buffer is cleared when an other comes in
- if (glimage_sink->stored_buffer) {
- gst_buffer_unref (glimage_sink->stored_buffer);
- }
- //store current buffer
- glimage_sink->stored_buffer = gst_buffer_ref (buf);
+
+ gst_buffer_replace (&glimage_sink->stored_buffer, buf);
GST_TRACE ("redisplay texture:%u of size:%ux%u, window size:%ux%u", tex_id,
GST_VIDEO_INFO_WIDTH (&glimage_sink->info),
{
#if GST_GL_HAVE_GLES2
if (gl_sink->redisplay_shader) {
- g_object_unref (G_OBJECT (gl_sink->redisplay_shader));
+ gst_object_unref (gl_sink->redisplay_shader);
gl_sink->redisplay_shader = NULL;
}
#endif
if (G_VALUE_HOLDS_POINTER (id_value))
/* at least one gl element is after in our gl chain */
src->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;
src->display = gst_gl_display_new ();
window = gst_gl_window_new (src->display);
gst_gl_display_set_window (src->display, window);
- g_object_unref (window);
+ gst_object_unref (window);
if (!gst_gl_window_create_context (window, 0, &error)) {
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
}
if (src->download) {
- g_object_unref (src->download);
+ gst_object_unref (src->download);
src->download = NULL;
}
//blocking call, delete the FBO
gst_gl_display_del_fbo (src->display, src->fbo, src->depthbuffer);
- g_object_unref (src->display);
+ gst_object_unref (src->display);
src->display = NULL;
}
void
teardown (void)
{
- g_object_unref (display);
+ gst_object_unref (display);
}
GST_START_TEST (test_basic)
clutter_main ();
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- g_object_unref (pipeline);
+ gst_object_unref (pipeline);
return 0;
}
clutter_main ();
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- g_object_unref (pipeline);
+ gst_object_unref (pipeline);
return 0;
}
glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "glfiltercube0");
g_object_set (G_OBJECT (glfilter), "external-opengl-context",
clutter_gl_context, NULL);
- g_object_unref (glfilter);
+ gst_object_unref (glfilter);
/* NULL to PAUSED state pipeline to make sure the gst opengl context is created and
* shared with the clutter one */
g_object_set (G_OBJECT (fakesink), "signal-handoffs", TRUE, NULL);
g_signal_connect (fakesink, "handoff", G_CALLBACK (on_gst_buffer),
clutter_texture);
- g_object_unref (fakesink);
+ gst_object_unref (fakesink);
/* play gst */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
/* stop and clean up the pipeline */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- g_object_unref (pipeline);
+ gst_object_unref (pipeline);
/* make sure there is no pending gst gl buffer in the communication queues
* between clutter and gst-gl
glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "gleffects0");
g_object_set (G_OBJECT (glfilter), "external-opengl-context",
sdl_gl_context, NULL);
- g_object_unref (glfilter);
+ gst_object_unref (glfilter);
/* NULL to PAUSED state pipeline to make sure the gst opengl context is created and
* shared with the sdl one */
g_object_set_data (G_OBJECT (fakesink), "queue_input_buf", queue_input_buf);
g_object_set_data (G_OBJECT (fakesink), "queue_output_buf", queue_output_buf);
g_object_set_data (G_OBJECT (fakesink), "loop", loop);
- g_object_unref (fakesink);
+ gst_object_unref (fakesink);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
#endif
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
- g_object_unref (pipeline);
+ gst_object_unref (pipeline);
/* turn on back sdl opengl context */
#ifdef WIN32