libs: gl: drop use of GSlice

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
This commit is contained in:
Tim-Philipp Müller 2023-01-08 17:13:43 +00:00 committed by GStreamer Marge Bot
parent d56648ccdb
commit 13f3feed04
5 changed files with 15 additions and 15 deletions

View file

@ -363,7 +363,7 @@ gst_gl_gbm_drm_fb_destroy_callback (struct gbm_bo *bo, void *data)
if (fb->fb_id) if (fb->fb_id)
drmModeRmFB (drm_fd, fb->fb_id); drmModeRmFB (drm_fd, fb->fb_id);
g_slice_free1 (sizeof (GstGLDRMFramebuffer), fb); g_free (fb);
} }
@ -400,7 +400,7 @@ gst_gl_gbm_drm_fb_get_from_bo (struct gbm_bo *bo)
drm_fd = gbm_device_get_fd (gbm_bo_get_device (bo)); drm_fd = gbm_device_get_fd (gbm_bo_get_device (bo));
fb = g_slice_alloc0 (sizeof (GstGLDRMFramebuffer)); fb = g_new0 (GstGLDRMFramebuffer, 1);
fb->bo = bo; fb->bo = bo;
width = gbm_bo_get_width (bo); width = gbm_bo_get_width (bo);
@ -423,7 +423,7 @@ gst_gl_gbm_drm_fb_get_from_bo (struct gbm_bo *bo)
if (ret != 0) { if (ret != 0) {
GST_ERROR ("Failed to add GBM BO as scanout framebuffer: %s (%d)", GST_ERROR ("Failed to add GBM BO as scanout framebuffer: %s (%d)",
g_strerror (errno), errno); g_strerror (errno), errno);
g_slice_free1 (sizeof (GstGLDRMFramebuffer), fb); g_free (fb);
return NULL; return NULL;
} }

View file

@ -289,7 +289,7 @@ gst_gl_context_init (GstGLContext * context)
context->priv = gst_gl_context_get_instance_private (context); context->priv = gst_gl_context_get_instance_private (context);
context->window = NULL; context->window = NULL;
context->gl_vtable = g_slice_alloc0 (sizeof (GstGLFuncs)); context->gl_vtable = g_new0 (GstGLFuncs, 1);
g_mutex_init (&context->priv->render_lock); g_mutex_init (&context->priv->render_lock);
@ -727,7 +727,7 @@ gst_gl_context_finalize (GObject * object)
} }
if (context->gl_vtable) { if (context->gl_vtable) {
g_slice_free (GstGLFuncs, context->gl_vtable); g_free (context->gl_vtable);
context->gl_vtable = NULL; context->gl_vtable = NULL;
} }

View file

@ -333,7 +333,7 @@ _video_frame_unmap_and_free (gpointer user_data)
GstVideoFrame *frame = user_data; GstVideoFrame *frame = user_data;
gst_video_frame_unmap (frame); gst_video_frame_unmap (frame);
g_slice_free (GstVideoFrame, frame); g_free (frame);
} }
static void static void
@ -367,7 +367,7 @@ gst_gl_composition_overlay_upload (GstGLCompositionOverlay * overlay,
gst_video_overlay_rectangle_get_pixels_unscaled_argb (overlay->rectangle, gst_video_overlay_rectangle_get_pixels_unscaled_argb (overlay->rectangle,
alpha_flags); alpha_flags);
comp_frame = g_slice_new (GstVideoFrame); comp_frame = g_new (GstVideoFrame, 1);
vmeta = gst_buffer_get_video_meta (comp_buffer); vmeta = gst_buffer_get_video_meta (comp_buffer);
gst_video_info_set_format (&vinfo, vmeta->format, vmeta->width, gst_video_info_set_format (&vinfo, vmeta->format, vmeta->width,
@ -417,7 +417,7 @@ gst_gl_composition_overlay_upload (GstGLCompositionOverlay * overlay,
GST_DEBUG ("uploaded overlay texture %d", overlay->texture_id); GST_DEBUG ("uploaded overlay texture %d", overlay->texture_id);
} else { } else {
g_slice_free (GstVideoFrame, comp_frame); g_free (comp_frame);
} }
} }

View file

@ -1252,12 +1252,12 @@ _raw_upload_frame_new (struct RawUpload *raw, GstBuffer * buffer)
if (!buffer) if (!buffer)
return NULL; return NULL;
frame = g_slice_new (struct RawUploadFrame); frame = g_new (struct RawUploadFrame, 1);
frame->ref_count = 1; frame->ref_count = 1;
if (!gst_video_frame_map (&frame->frame, &raw->upload->priv->in_info, if (!gst_video_frame_map (&frame->frame, &raw->upload->priv->in_info,
buffer, GST_MAP_READ)) { buffer, GST_MAP_READ)) {
g_slice_free (struct RawUploadFrame, frame); g_free (frame);
return NULL; return NULL;
} }
@ -1285,7 +1285,7 @@ _raw_upload_frame_unref (struct RawUploadFrame *frame)
{ {
if (g_atomic_int_dec_and_test (&frame->ref_count)) { if (g_atomic_int_dec_and_test (&frame->ref_count)) {
gst_video_frame_unmap (&frame->frame); gst_video_frame_unmap (&frame->frame);
g_slice_free (struct RawUploadFrame, frame); g_free (frame);
} }
} }

View file

@ -418,7 +418,7 @@ static void
_free_swh_cb (GstSetWindowHandleCb * data) _free_swh_cb (GstSetWindowHandleCb * data)
{ {
gst_object_unref (data->window); gst_object_unref (data->window);
g_slice_free (GstSetWindowHandleCb, data); g_free (data);
} }
/** /**
@ -442,7 +442,7 @@ gst_gl_window_set_window_handle (GstGLWindow * window, guintptr handle)
window_class = GST_GL_WINDOW_GET_CLASS (window); window_class = GST_GL_WINDOW_GET_CLASS (window);
g_return_if_fail (window_class->set_window_handle != NULL); g_return_if_fail (window_class->set_window_handle != NULL);
data = g_slice_new (GstSetWindowHandleCb); data = g_new (GstSetWindowHandleCb, 1);
data->window = gst_object_ref (window); data->window = gst_object_ref (window);
data->handle = handle; data->handle = handle;
@ -704,7 +704,7 @@ _run_message_async (GstGLAsyncMessage * message)
if (message->destroy) if (message->destroy)
message->destroy (message->data); message->destroy (message->data);
g_slice_free (GstGLAsyncMessage, message); g_free (message);
return FALSE; return FALSE;
} }
@ -713,7 +713,7 @@ static void
gst_gl_window_default_send_message_async (GstGLWindow * window, gst_gl_window_default_send_message_async (GstGLWindow * window,
GstGLWindowCB callback, gpointer data, GDestroyNotify destroy) GstGLWindowCB callback, gpointer data, GDestroyNotify destroy)
{ {
GstGLAsyncMessage *message = g_slice_new (GstGLAsyncMessage); GstGLAsyncMessage *message = g_new (GstGLAsyncMessage, 1);
message->callback = callback; message->callback = callback;
message->data = data; message->data = data;