v4l2: 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:38:17 +00:00 committed by GStreamer Marge Bot
parent 74e103e53f
commit f6950b4537
3 changed files with 12 additions and 12 deletions

View file

@ -154,7 +154,7 @@ _v4l2mem_new (GstMemoryFlags flags, GstAllocator * allocator,
{ {
GstV4l2Memory *mem; GstV4l2Memory *mem;
mem = g_slice_new0 (GstV4l2Memory); mem = g_new0 (GstV4l2Memory, 1);
gst_memory_init (GST_MEMORY_CAST (mem), gst_memory_init (GST_MEMORY_CAST (mem),
flags, allocator, parent, maxsize, align, offset, size); flags, allocator, parent, maxsize, align, offset, size);
@ -236,7 +236,7 @@ gst_v4l2_memory_group_free (GstV4l2MemoryGroup * group)
gst_memory_unref (mem); gst_memory_unref (mem);
} }
g_slice_free (GstV4l2MemoryGroup, group); g_free (group);
} }
static GstV4l2MemoryGroup * static GstV4l2MemoryGroup *
@ -248,7 +248,7 @@ gst_v4l2_memory_group_new (GstV4l2Allocator * allocator, guint32 index)
GstV4l2MemoryGroup *group; GstV4l2MemoryGroup *group;
gsize img_size, buf_size; gsize img_size, buf_size;
group = g_slice_new0 (GstV4l2MemoryGroup); group = g_new0 (GstV4l2MemoryGroup, 1);
group->buffer.type = format->type; group->buffer.type = format->type;
group->buffer.index = index; group->buffer.index = index;
@ -268,7 +268,7 @@ gst_v4l2_memory_group_new (GstV4l2Allocator * allocator, guint32 index)
GST_ERROR_OBJECT (allocator, "Buffer index returned by VIDIOC_QUERYBUF " GST_ERROR_OBJECT (allocator, "Buffer index returned by VIDIOC_QUERYBUF "
"didn't match, this indicate the presence of a bug in your driver or " "didn't match, this indicate the presence of a bug in your driver or "
"libv4l2"); "libv4l2");
g_slice_free (GstV4l2MemoryGroup, group); g_free (group);
return NULL; return NULL;
} }
@ -401,7 +401,7 @@ gst_v4l2_allocator_free (GstAllocator * gallocator, GstMemory * gmem)
close (mem->dmafd); close (mem->dmafd);
} }
g_slice_free (GstV4l2Memory, mem); g_free (mem);
} }
static void static void

View file

@ -220,7 +220,7 @@ _unmap_userptr_frame (struct UserPtrData *data)
if (data->buffer) if (data->buffer)
gst_buffer_unref (data->buffer); gst_buffer_unref (data->buffer);
g_slice_free (struct UserPtrData, data); g_free (data);
} }
static GstFlowReturn static GstFlowReturn
@ -244,7 +244,7 @@ gst_v4l2_buffer_pool_import_userptr (GstV4l2BufferPool * pool,
else else
flags = GST_MAP_WRITE; flags = GST_MAP_WRITE;
data = g_slice_new0 (struct UserPtrData); data = g_new0 (struct UserPtrData, 1);
if (finfo && (finfo->format != GST_VIDEO_FORMAT_UNKNOWN && if (finfo && (finfo->format != GST_VIDEO_FORMAT_UNKNOWN &&
finfo->format != GST_VIDEO_FORMAT_ENCODED)) { finfo->format != GST_VIDEO_FORMAT_ENCODED)) {
@ -325,7 +325,7 @@ not_our_buffer:
invalid_buffer: invalid_buffer:
{ {
GST_ERROR_OBJECT (pool, "could not map buffer"); GST_ERROR_OBJECT (pool, "could not map buffer");
g_slice_free (struct UserPtrData, data); g_free (data);
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
non_contiguous_mem: non_contiguous_mem:

View file

@ -46,7 +46,7 @@ gst_v4l2_iterator_new (void)
static const gchar *subsystems[] = { "video4linux", NULL }; static const gchar *subsystems[] = { "video4linux", NULL };
struct _GstV4l2GUdevIterator *it; struct _GstV4l2GUdevIterator *it;
it = g_slice_new0 (struct _GstV4l2GUdevIterator); it = g_new0 (struct _GstV4l2GUdevIterator, 1);
it->client = g_udev_client_new (subsystems); it->client = g_udev_client_new (subsystems);
it->devices = g_udev_client_query_by_subsystem (it->client, "video4linux"); it->devices = g_udev_client_query_by_subsystem (it->client, "video4linux");
@ -92,7 +92,7 @@ gst_v4l2_iterator_free (GstV4l2Iterator * _it)
struct _GstV4l2GUdevIterator *it = (struct _GstV4l2GUdevIterator *) _it; struct _GstV4l2GUdevIterator *it = (struct _GstV4l2GUdevIterator *) _it;
g_list_free_full (it->devices, g_object_unref); g_list_free_full (it->devices, g_object_unref);
gst_object_unref (it->client); gst_object_unref (it->client);
g_slice_free (struct _GstV4l2GUdevIterator, it); g_free (it);
} }
#else /* No GUDEV */ #else /* No GUDEV */
@ -110,7 +110,7 @@ gst_v4l2_iterator_new (void)
{ {
struct _GstV4l2FsIterator *it; struct _GstV4l2FsIterator *it;
it = g_slice_new0 (struct _GstV4l2FsIterator); it = g_new0 (struct _GstV4l2FsIterator, 1);
it->base_idx = 0; it->base_idx = 0;
it->video_idx = -1; it->video_idx = -1;
it->device = NULL; it->device = NULL;
@ -160,7 +160,7 @@ gst_v4l2_iterator_free (GstV4l2Iterator * _it)
{ {
struct _GstV4l2FsIterator *it = (struct _GstV4l2FsIterator *) _it; struct _GstV4l2FsIterator *it = (struct _GstV4l2FsIterator *) _it;
g_free ((gchar *) it->parent.device_path); g_free ((gchar *) it->parent.device_path);
g_slice_free (struct _GstV4l2FsIterator, it); g_free (it);
} }
#endif #endif