From 09c8c238427b8f9f1762b7543e9618ec0c3cdb56 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 17 Dec 2015 15:23:13 +1100 Subject: [PATCH] gl*memory*: reverse the parameter order of user_data and destroy notify The convention is to have the destroy notify last after any user data --- gst-libs/gst/gl/gstglbasememory.c | 16 +++++++-------- gst-libs/gst/gl/gstglbasememory.h | 10 ++++----- gst-libs/gst/gl/gstglbuffer.c | 2 +- gst-libs/gst/gl/gstglmemory.c | 26 ++++++++++++------------ gst-libs/gst/gl/gstglmemory.h | 16 +++++++-------- gst-libs/gst/gl/gstglmemorypbo.c | 16 +++++++-------- gst-libs/gst/gl/gstgloverlaycompositor.c | 2 +- gst-libs/gst/gl/gstglupload.c | 4 ++-- tests/check/libs/gstglcolorconvert.c | 2 +- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/gst-libs/gst/gl/gstglbasememory.c b/gst-libs/gst/gl/gstglbasememory.c index 27abd44d0c..a93ffb81f4 100644 --- a/gst-libs/gst/gl/gstglbasememory.c +++ b/gst-libs/gst/gl/gstglbasememory.c @@ -99,15 +99,15 @@ _mem_create_gl (GstGLContext * context, struct create_data *transfer) * @context: the #GstGLContext to initialize with * @params: (allow-none): the @GstAllocationParams to initialize with * @size: the number of bytes to be allocated - * @notify: (allow-none): a #GDestroyNotify * @user_data: (allow-none): user data to call @notify with + * @notify: (allow-none): a #GDestroyNotify * * Initializes @mem with the required parameters */ void gst_gl_base_memory_init (GstGLBaseMemory * mem, GstAllocator * allocator, GstMemory * parent, GstGLContext * context, GstAllocationParams * params, - gsize size, GDestroyNotify notify, gpointer user_data) + gsize size, gpointer user_data, GDestroyNotify notify) { gsize align = gst_memory_alignment, offset = 0, maxsize = size; GstMemoryFlags flags = 0; @@ -543,10 +543,10 @@ gst_gl_base_memory_memcpy (GstGLBaseMemory * src, GstGLBaseMemory * dest, * @context: (transfer none): a #GstGLContext * @alloc_size: the number of bytes to allocate. * @alloc_params: (transfer none) (allow-none): a #GstAllocationParams to apply - * @notify: (allow-none): a #GDestroyNotify - * @user_data: (transfer none) (allow-none): user data to call @notify with * @wrapped_data: (transfer none) (allow-none): a sysmem data pointer to initialize the allocation with * @gl_handle: (transfer none): a GL handle to initialize the allocation with + * @user_data: (transfer none) (allow-none): user data to call @notify with + * @notify: (allow-none): a #GDestroyNotify * * @notify will be called once for each allocated memory using these @params * when freeing the memory. @@ -558,8 +558,8 @@ gst_gl_allocation_params_init (GstGLAllocationParams * params, gsize struct_size, guint alloc_flags, GstGLAllocationParamsCopyFunc copy, GstGLAllocationParamsFreeFunc free, GstGLContext * context, gsize alloc_size, GstAllocationParams * alloc_params, - GDestroyNotify notify, gpointer user_data, gpointer wrapped_data, - guint gl_handle) + gpointer wrapped_data, guint gl_handle, gpointer user_data, + GDestroyNotify notify) { memset (params, 0, sizeof (*params)); @@ -635,8 +635,8 @@ gst_gl_allocation_params_copy_data (GstGLAllocationParams * src, GstGLAllocationParams * dest) { gst_gl_allocation_params_init (dest, src->struct_size, src->alloc_flags, - src->copy, src->free, NULL, src->alloc_size, NULL, src->notify, - src->user_data, src->wrapped_data, src->gl_handle); + src->copy, src->free, NULL, src->alloc_size, NULL, src->wrapped_data, + src->gl_handle, src->user_data, src->notify); if (src->context) dest->context = gst_object_ref (src->context); diff --git a/gst-libs/gst/gl/gstglbasememory.h b/gst-libs/gst/gl/gstglbasememory.h index b6d1cabe8c..6ecf40bd3f 100644 --- a/gst-libs/gst/gl/gstglbasememory.h +++ b/gst-libs/gst/gl/gstglbasememory.h @@ -140,10 +140,10 @@ gboolean gst_gl_allocation_params_init (GstGLAllocationPara GstGLContext * context, gsize alloc_size, GstAllocationParams * alloc_params, - GDestroyNotify notify, - gpointer user_data, gpointer wrapped_data, - guint gl_handle); + guint gl_handle, + gpointer user_data, + GDestroyNotify notify); /* free with gst_gl_allocation_params_free */ GstGLAllocationParams * gst_gl_allocation_params_copy (GstGLAllocationParams * src); @@ -220,8 +220,8 @@ void gst_gl_base_memory_init (GstGLBaseMemory * mem, GstGLContext * context, GstAllocationParams * params, gsize maxsize, - GDestroyNotify notify, - gpointer user_data); + gpointer user_data, + GDestroyNotify notify); gboolean gst_gl_base_memory_alloc_data (GstGLBaseMemory * gl_mem); gboolean gst_gl_base_memory_memcpy (GstGLBaseMemory * src, diff --git a/gst-libs/gst/gl/gstglbuffer.c b/gst-libs/gst/gl/gstglbuffer.c index d1452da6dd..86cf8be7bd 100644 --- a/gst-libs/gst/gl/gstglbuffer.c +++ b/gst-libs/gst/gl/gstglbuffer.c @@ -350,7 +350,7 @@ gst_gl_buffer_allocation_params_new (GstGLContext * context, gsize alloc_size, _gst_gl_buffer_allocation_params_copy_data, (GstGLAllocationParamsFreeFunc) _gst_gl_buffer_allocation_params_free_data, context, alloc_size, - alloc_params, NULL, NULL, NULL, 0)) { + alloc_params, NULL, 0, NULL, NULL)) { g_free (params); return NULL; } diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index 1165aeccef..466ce4de35 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -277,7 +277,7 @@ void gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent, GstGLContext * context, GstGLTextureTarget target, GstAllocationParams * params, GstVideoInfo * info, guint plane, - GstVideoAlignment * valign, GDestroyNotify notify, gpointer user_data) + GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify) { const gchar *target_str; gsize size; @@ -316,7 +316,7 @@ gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator, _calculate_unpack_length (mem, context); gst_gl_base_memory_init ((GstGLBaseMemory *) mem, allocator, parent, context, - params, size, notify, user_data); + params, size, user_data, notify); target_str = gst_gl_texture_target_to_string (target); GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture context:%" @@ -750,8 +750,8 @@ _default_gl_tex_alloc (GstGLMemoryAllocator * allocator, gst_gl_memory_init (mem, GST_ALLOCATOR_CAST (allocator), NULL, params->parent.context, params->target, params->parent.alloc_params, - params->v_info, params->plane, params->valign, params->parent.notify, - params->parent.user_data); + params->v_info, params->plane, params->valign, params->parent.user_data, + params->parent.notify); if (params->parent. alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) { @@ -946,8 +946,8 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params, GstGLAllocationParamsFreeFunc free, GstGLContext * context, GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane, GstVideoAlignment * valign, GstGLTextureTarget target, - gpointer wrapped_data, guint gl_handle, GDestroyNotify notify, - gpointer user_data) + gpointer wrapped_data, guint gl_handle, gpointer user_data, + GDestroyNotify notify) { guint i; @@ -961,7 +961,7 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params, if (!gst_gl_allocation_params_init ((GstGLAllocationParams *) params, struct_size, alloc_flags, copy, free, context, 0, alloc_params, - notify, user_data, wrapped_data, gl_handle)) + wrapped_data, gl_handle, user_data, notify)) return FALSE; params->v_info = g_new0 (GstVideoInfo, 1); @@ -1020,8 +1020,8 @@ gst_gl_video_allocation_params_new (GstGLContext * context, * @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @wrapped_data * @target: the #GstGLTextureTarget for @wrapped_data * @wrapped_data: the data pointer to wrap - * @notify: (allow-none): a #GDestroyNotify * @user_data: (allow-none): user data to call @notify with + * @notify: (allow-none): a #GDestroyNotify * * Returns: a new #GstGLVideoAllocationParams for wrapping @wrapped_data */ @@ -1029,7 +1029,7 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context, GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane, GstVideoAlignment * valign, GstGLTextureTarget target, - gpointer wrapped_data, GDestroyNotify notify, gpointer user_data) + gpointer wrapped_data, gpointer user_data, GDestroyNotify notify) { GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1); @@ -1041,7 +1041,7 @@ gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context, gst_gl_video_allocation_params_copy_data, (GstGLAllocationParamsFreeFunc) gst_gl_video_allocation_params_free_data, context, alloc_params, - v_info, plane, valign, target, wrapped_data, 0, notify, user_data)) { + v_info, plane, valign, target, wrapped_data, 0, user_data, notify)) { g_free (params); return NULL; } @@ -1058,8 +1058,8 @@ gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context, * @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @tex_id * @target: the #GstGLTextureTarget for @tex_id * @tex_id: the GL texture to wrap - * @notify: (allow-none): a #GDestroyNotify * @user_data: (allow-none): user data to call @notify with + * @notify: (allow-none): a #GDestroyNotify * * Returns: a new #GstGLVideoAllocationParams for wrapping @tex_id */ @@ -1067,7 +1067,7 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context, GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane, GstVideoAlignment * valign, GstGLTextureTarget target, - guint tex_id, GDestroyNotify notify, gpointer user_data) + guint tex_id, gpointer user_data, GDestroyNotify notify) { GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1); @@ -1079,7 +1079,7 @@ gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context, gst_gl_video_allocation_params_copy_data, (GstGLAllocationParamsFreeFunc) gst_gl_video_allocation_params_free_data, context, alloc_params, - v_info, plane, valign, target, NULL, tex_id, notify, user_data)) { + v_info, plane, valign, target, NULL, tex_id, user_data, notify)) { g_free (params); return NULL; } diff --git a/gst-libs/gst/gl/gstglmemory.h b/gst-libs/gst/gl/gstglmemory.h index 3f3c41c320..7185a2d7bc 100644 --- a/gst-libs/gst/gl/gstglmemory.h +++ b/gst-libs/gst/gl/gstglmemory.h @@ -107,8 +107,8 @@ gboolean gst_gl_video_allocation_params_init_full (GstGLVideoAlloc GstGLTextureTarget target, gpointer wrapped_data, guint gl_handle, - GDestroyNotify notify, - gpointer user_data); + gpointer user_data, + GDestroyNotify notify); GstGLVideoAllocationParams * gst_gl_video_allocation_params_new (GstGLContext * context, GstAllocationParams * alloc_params, GstVideoInfo * v_info, @@ -122,8 +122,8 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data GstVideoAlignment * valign, GstGLTextureTarget target, gpointer wrapped_data, - GDestroyNotify notify, - gpointer user_data); + gpointer user_data, + GDestroyNotify notify); GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context, GstAllocationParams * alloc_params, @@ -132,8 +132,8 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture GstVideoAlignment * valign, GstGLTextureTarget target, guint tex_id, - GDestroyNotify notify, - gpointer user_data); + gpointer user_data, + GDestroyNotify notify); /* subclass usage */ void gst_gl_video_allocation_params_free_data (GstGLVideoAllocationParams * params); @@ -186,8 +186,8 @@ void gst_gl_memory_init (GstGLMemory * mem, GstVideoInfo * info, guint plane, GstVideoAlignment *valign, - GDestroyNotify notify, - gpointer user_data); + gpointer user_data, + GDestroyNotify notify); gboolean gst_gl_memory_copy_into (GstGLMemory *gl_mem, guint tex_id, diff --git a/gst-libs/gst/gl/gstglmemorypbo.c b/gst-libs/gst/gl/gstglmemorypbo.c index 7fd56129f2..90f0553a00 100644 --- a/gst-libs/gst/gl/gstglmemorypbo.c +++ b/gst-libs/gst/gl/gstglmemorypbo.c @@ -265,26 +265,26 @@ static void _gl_mem_init (GstGLMemoryPBO * mem, GstAllocator * allocator, GstMemory * parent, GstGLContext * context, GstGLTextureTarget target, GstAllocationParams * params, GstVideoInfo * info, - guint plane, GstVideoAlignment * valign, GDestroyNotify notify, - gpointer user_data) + guint plane, GstVideoAlignment * valign, gpointer user_data, + GDestroyNotify notify) { gst_gl_memory_init ((GstGLMemory *) mem, allocator, parent, - context, target, params, info, plane, valign, notify, user_data); + context, target, params, info, plane, valign, user_data, notify); } static GstGLMemoryPBO * _gl_mem_new (GstAllocator * allocator, GstMemory * parent, GstGLContext * context, GstGLTextureTarget target, GstAllocationParams * params, GstVideoInfo * info, - guint plane, GstVideoAlignment * valign, GDestroyNotify notify, - gpointer user_data) + guint plane, GstVideoAlignment * valign, gpointer user_data, + GDestroyNotify notify) { GstGLMemoryPBO *mem; mem = g_slice_new0 (GstGLMemoryPBO); mem->mem.texture_wrapped = FALSE; _gl_mem_init (mem, allocator, parent, context, target, params, info, plane, - valign, notify, user_data); + valign, user_data, notify); return mem; } @@ -727,8 +727,8 @@ _gl_mem_pbo_alloc (GstGLBaseMemoryAllocator * allocator, _gl_mem_init (mem, GST_ALLOCATOR_CAST (allocator), NULL, params->parent.context, params->target, params->parent.alloc_params, - params->v_info, params->plane, params->valign, params->parent.notify, - params->parent.user_data); + params->v_info, params->plane, params->valign, params->parent.user_data, + params->parent.notify); if (params-> parent.alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) diff --git a/gst-libs/gst/gl/gstgloverlaycompositor.c b/gst-libs/gst/gl/gstgloverlaycompositor.c index 17011e0c0a..2f0a56b5a9 100644 --- a/gst-libs/gst/gl/gstgloverlaycompositor.c +++ b/gst-libs/gst/gl/gstgloverlaycompositor.c @@ -355,7 +355,7 @@ gst_gl_composition_overlay_upload (GstGLCompositionOverlay * overlay, params = gst_gl_video_allocation_params_new_wrapped_data (overlay->context, NULL, &comp_frame->info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, - comp_frame->data[0], _video_frame_unmap_and_free, comp_frame); + comp_frame->data[0], comp_frame, _video_frame_unmap_and_free); comp_gl_memory = (GstGLMemory *) gst_gl_base_memory_alloc (mem_allocator, diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index 7c5b218d3f..447c9980db 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -891,8 +891,8 @@ _raw_data_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps, if (!(raw->params = gst_gl_video_allocation_params_new_wrapped_data (raw->upload->context, NULL, &raw->upload->priv->in_info, -1, NULL, - GST_GL_TEXTURE_TARGET_2D, NULL, - (GDestroyNotify) _raw_upload_frame_unref, raw->in_frame))) + GST_GL_TEXTURE_TARGET_2D, NULL, raw->in_frame, + (GDestroyNotify) _raw_upload_frame_unref))) return FALSE; return (raw->in_frame != NULL); diff --git a/tests/check/libs/gstglcolorconvert.c b/tests/check/libs/gstglcolorconvert.c index 4577df9685..9ee3fe9797 100644 --- a/tests/check/libs/gstglcolorconvert.c +++ b/tests/check/libs/gstglcolorconvert.c @@ -147,7 +147,7 @@ check_conversion (TestFrame * frames, guint size) ref_count++; params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL, &in_info, j, NULL, GST_GL_TEXTURE_TARGET_2D, frames[i].data[j], - _frame_unref, &ref_count); + &ref_count, _frame_unref); mem = gst_gl_base_memory_alloc (base_mem_alloc, (GstGLAllocationParams *) params);