gl*memory*: reverse the parameter order of user_data and destroy notify
authorMatthew Waters <matthew@centricular.com>
Thu, 17 Dec 2015 04:23:13 +0000 (15:23 +1100)
committerMatthew Waters <matthew@centricular.com>
Thu, 17 Dec 2015 04:44:22 +0000 (15:44 +1100)
The convention is to have the destroy notify last after any user data

gst-libs/gst/gl/gstglbasememory.c
gst-libs/gst/gl/gstglbasememory.h
gst-libs/gst/gl/gstglbuffer.c
gst-libs/gst/gl/gstglmemory.c
gst-libs/gst/gl/gstglmemory.h
gst-libs/gst/gl/gstglmemorypbo.c
gst-libs/gst/gl/gstgloverlaycompositor.c
gst-libs/gst/gl/gstglupload.c
sys/applemedia/iosurfacememory.c
sys/applemedia/videotexturecache.m
tests/check/libs/gstglcolorconvert.c

index 27abd44..a93ffb8 100644 (file)
@@ -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);
index b6d1cab..6ecf40b 100644 (file)
@@ -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,
index d1452da..86cf8be 100644 (file)
@@ -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;
   }
index 1165aec..466ce4d 100644 (file)
@@ -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;
   }
index 3f3c41c..7185a2d 100644 (file)
@@ -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,
index 7fd5612..90f0553 100644 (file)
@@ -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)
index 17011e0..2f0a56b 100644 (file)
@@ -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,
index 7c5b218..447c998 100644 (file)
@@ -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);
index 2736a27..04acc51 100644 (file)
@@ -170,7 +170,7 @@ _io_surface_memory_new (GstGLContext * context,
 
   mem = g_slice_new0 (GstIOSurfaceMemory);
   gst_gl_memory_init (&mem->gl_mem, _io_surface_memory_allocator, NULL, context,
-      target, NULL, info, plane, valign, notify, user_data);
+      target, NULL, info, plane, valign, user_data, notify);
 
   GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY);
   GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_NO_SHARE);
index 18808c0..223b40e 100644 (file)
@@ -175,8 +175,8 @@ gl_mem_from_buffer (GstVideoTextureCache * cache,
         gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
         params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx,
             NULL, &cache->input_info, 0, NULL, gl_target,
-            CVOpenGLESTextureGetName (texture), (GDestroyNotify) CFRelease,
-            texture);
+            CVOpenGLESTextureGetName (texture), texture,
+            (GDestroyNotify) CFRelease);
 
         *mem1 = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
             (GstGLAllocationParams *) params);
@@ -201,8 +201,8 @@ gl_mem_from_buffer (GstVideoTextureCache * cache,
         gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
         params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx,
             NULL, &cache->input_info, 0, NULL, gl_target,
-            CVOpenGLESTextureGetName (texture), (GDestroyNotify) CFRelease,
-            texture);
+            CVOpenGLESTextureGetName (texture), texture,
+            (GDestroyNotify) CFRelease);
 
         *mem1 = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
             (GstGLAllocationParams *) params);
@@ -222,8 +222,8 @@ gl_mem_from_buffer (GstVideoTextureCache * cache,
         gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
         params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx,
             NULL, &cache->input_info, 1, NULL, gl_target,
-            CVOpenGLESTextureGetName (texture), (GDestroyNotify) CFRelease,
-            texture);
+            CVOpenGLESTextureGetName (texture), texture,
+            (GDestroyNotify) CFRelease);
 
         *mem2 = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
             (GstGLAllocationParams *) params);
index 4577df9..9ee3fe9 100644 (file)
@@ -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);