gl: Add/fix various annotations

And fix a memory leaks in gst_gl_display_egl_new() error cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
This commit is contained in:
Sebastian Dröge 2022-10-15 12:16:01 +03:00 committed by GStreamer Marge Bot
parent 3827f94574
commit 39591cb13d
17 changed files with 52 additions and 49 deletions

View file

@ -228,7 +228,7 @@ gst_gl_display_cocoa_finalize (GObject * object)
*
* Create a new #GstGLDisplayCocoa.
*
* Returns: (transfer full): a new #GstGLDisplayCocoa or %NULL
* Returns: (transfer full): a new #GstGLDisplayCocoa
*/
GstGLDisplayCocoa *
gst_gl_display_cocoa_new (void)

View file

@ -452,7 +452,7 @@ _destroy_egl_image (GstEGLImage * image, gpointer user_data)
* @gl_mem: a #GstGLMemory
* @attribs: additional attributes to add to the `eglCreateImage`() call.
*
* Returns: (transfer full): a #GstEGLImage wrapping @gl_mem or %NULL on failure
* Returns: (transfer full) (nullable): a #GstEGLImage wrapping @gl_mem or %NULL on failure
*/
GstEGLImage *
gst_egl_image_from_texture (GstGLContext * context, GstGLMemory * gl_mem,
@ -641,7 +641,7 @@ get_egl_stride (const GstVideoInfo * info, gint plane)
* With NV12, two EGL images are created, one with R format, one
* with RG format etc.
*
* Returns: a #GstEGLImage wrapping @dmabuf or %NULL on failure
* Returns: (nullable): a #GstEGLImage wrapping @dmabuf or %NULL on failure
*/
GstEGLImage *
gst_egl_image_from_dmabuf (GstGLContext * context,
@ -927,7 +927,7 @@ gst_egl_image_check_dmabuf_direct (GstGLContext * context,
* is that this function creates one EGL image for all planes, not one for
* a single plane.
*
* Returns: a #GstEGLImage wrapping @dmabuf or %NULL on failure
* Returns: (nullable): a #GstEGLImage wrapping @dmabuf or %NULL on failure
*
* Since: 1.18
*/
@ -1094,7 +1094,7 @@ gst_egl_image_from_dmabuf_direct_target (GstGLContext * context,
* is that this function creates one EGL image for all planes, not one for
* a single plane.
*
* Returns: a #GstEGLImage wrapping @dmabuf or %NULL on failure
* Returns: (nullable): a #GstEGLImage wrapping @dmabuf or %NULL on failure
*/
GstEGLImage *
gst_egl_image_from_dmabuf_direct (GstGLContext * context,

View file

@ -125,7 +125,7 @@ gst_gl_display_egl_finalize (GObject * object)
* %GST_GL_DISPLAY_TYPE_ANY, then @display must be 0. @type must not be
* %GST_GL_DISPLAY_TYPE_NONE.
*
* Returns: A `EGLDisplay` or `EGL_NO_DISPLAY`
* Returns: (nullable): A `EGLDisplay` or `EGL_NO_DISPLAY`
*
* Since: 1.12
*/
@ -248,23 +248,26 @@ default_display:
*
* Create a new #GstGLDisplayEGL using the default EGL_DEFAULT_DISPLAY.
*
* Returns: (transfer full): a new #GstGLDisplayEGL or %NULL
* Returns: (transfer full) (nullable): a new #GstGLDisplayEGL or %NULL
*/
GstGLDisplayEGL *
gst_gl_display_egl_new (void)
{
GstGLDisplayEGL *ret;
gpointer display;
init_debug ();
display = gst_gl_display_egl_get_from_native (GST_GL_DISPLAY_TYPE_ANY, 0);
if (!display) {
GST_INFO ("Failed to open EGL display connection");
return NULL;
}
ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL);
gst_object_ref_sink (ret);
ret->display =
gst_gl_display_egl_get_from_native (GST_GL_DISPLAY_TYPE_ANY, 0);
if (!ret->display) {
GST_INFO ("Failed to open EGL display connection");
}
ret->display = display;
return ret;
}
@ -314,7 +317,7 @@ _ref_if_set (gpointer data, gpointer user_data)
* This function will return the same value for multiple calls with the same
* @display.
*
* Returns: (transfer full): a new #GstGLDisplayEGL
* Returns: (transfer full) (nullable): a new #GstGLDisplayEGL
*
* Since: 1.12
*/

View file

@ -90,7 +90,7 @@ gst_gl_display_egl_device_get_handle (GstGLDisplay * display)
*
* Create a new #GstGLDisplayEGLDevice with an EGLDevice supported device
*
* Returns: (transfer full): a new #GstGLDisplayEGLDevice or %NULL
* Returns: (transfer full) (nullable): a new #GstGLDisplayEGLDevice or %NULL
*
* Since: 1.18
*/

View file

@ -666,7 +666,7 @@ gst_gl_allocation_params_init (GstGLAllocationParams * params,
* @src: the #GstGLAllocationParams to initialize
*
* Returns: (transfer full): a copy of the #GstGLAllocationParams specified by
* @src or %NULL on failure
* @src
*
* Since: 1.8
*/
@ -751,7 +751,7 @@ G_DEFINE_BOXED_TYPE (GstGLAllocationParams, gst_gl_allocation_params,
* @allocator: a #GstGLBaseMemoryAllocator
* @params: the #GstGLAllocationParams to allocate the memory with
*
* Returns: a new #GstGLBaseMemory from @allocator with the requested @params.
* Returns: (transfer full) (nullable): a new #GstGLBaseMemory from @allocator with the requested @params.
*
* Since: 1.8
*/

View file

@ -261,7 +261,7 @@ void gst_gl_allocation_params_copy_data (GstGLAllocationPara
*
* Note: not called with a GL context current
*
* Returns: a newly allocated #GstGLBaseMemory from @allocator and @params
* Returns: (transfer full) (nullable): a newly allocated #GstGLBaseMemory from @allocator and @params
*
* Since: 1.8
*/
@ -318,7 +318,7 @@ typedef void (*GstGLBaseMemoryAllocatorUnmapFunction) (Gst
*
* Also see gst_memory_copy();
*
* Returns: the newly copied #GstGLMemory or %NULL
* Returns: (transfer full) (nullable): the newly copied #GstGLMemory or %NULL
*
* Since: 1.8
*/

View file

@ -388,7 +388,7 @@ gst_gl_buffer_pool_finalize (GObject * object)
* gst_buffer_pool_set_config() will cause this function to return a new
* #GstGLAllocationParams which may or may not contain the same information.
*
* Returns: (transfer full): a copy of the #GstGLAllocationParams being used by the @pool
* Returns: (transfer full) (nullable): a copy of the #GstGLAllocationParams being used by the @pool
*
* Since: 1.20
*/
@ -408,7 +408,7 @@ gst_gl_buffer_pool_get_gl_allocation_params (GstGLBufferPool * pool)
* gst_buffer_pool_config_get_gl_allocation_params:
* @config: a buffer pool config
*
* Returns: (transfer full): the currently set #GstGLAllocationParams or %NULL
* Returns: (transfer full) (nullable): the currently set #GstGLAllocationParams or %NULL
*/
GstGLAllocationParams *
gst_buffer_pool_config_get_gl_allocation_params (GstStructure * config)
@ -425,7 +425,7 @@ gst_buffer_pool_config_get_gl_allocation_params (GstStructure * config)
/**
* gst_buffer_pool_config_set_gl_allocation_params:
* @config: a buffer pool config
* @params: (transfer none): a #GstGLAllocationParams
* @params: (transfer none) (nullable): a #GstGLAllocationParams
*
* Sets @params on @config
*/

View file

@ -1525,7 +1525,7 @@ gst_gl_color_convert_fixate_caps (GstGLContext * context,
* Converts the data contained by @inbuf using the formats specified by the
* #GstCaps passed to gst_gl_color_convert_set_caps()
*
* Returns: (transfer full): a converted #GstBuffer or %NULL
* Returns: (transfer full) (nullable): a converted #GstBuffer or %NULL
*
* Since: 1.4
*/

View file

@ -494,7 +494,7 @@ gst_gl_context_new_wrapped (GstGLDisplay * display, guintptr handle,
* gst_gl_context_get_current_gl_context:
* @context_type: a #GstGLPlatform specifying the type of context to retrieve
*
* Returns: The OpenGL context handle current in the calling thread or %NULL
* Returns: (nullable): The OpenGL context handle current in the calling thread or %NULL
*
* Since: 1.6
*/
@ -543,7 +543,7 @@ gst_gl_context_get_current_gl_context (GstGLPlatform context_type)
*
* See also gst_gl_context_get_proc_address().
*
* Returns: a function pointer for @name, or %NULL
* Returns: (nullable): a function pointer for @name, or %NULL
*
* Since: 1.6
*/
@ -807,7 +807,7 @@ gst_gl_context_activate (GstGLContext * context, gboolean activate)
* gst_gl_context_get_thread:
* @context: a #GstGLContext
*
* Returns: (transfer full): The #GThread, @context is current in or NULL
* Returns: (transfer full) (nullable): The #GThread, @context is current in or NULL
*
* Since: 1.6
*/
@ -877,7 +877,7 @@ gst_gl_context_get_gl_api (GstGLContext * context)
* void (GSTGLAPI *PFN_glGetIntegerv) (GLenum name, GLint * ret)
* ]|
*
* Returns: a function pointer or %NULL
* Returns: (nullable): a function pointer or %NULL
*
* Since: 1.4
*/
@ -908,7 +908,7 @@ gst_gl_context_get_proc_address (GstGLContext * context, const gchar * name)
*
* See also: gst_gl_context_get_proc_address()
*
* Returns: an address pointing to @name or %NULL
* Returns: (nullable): an address pointing to @name or %NULL
*
* Since: 1.4
*/
@ -1770,7 +1770,7 @@ gst_gl_context_check_feature (GstGLContext * context, const gchar * feature)
*
* See also gst_gl_context_activate().
*
* Returns: (transfer none): the #GstGLContext active in the current thread or %NULL
* Returns: (transfer none) (nullable): the #GstGLContext active in the current thread or %NULL
*
* Since: 1.6
*/

View file

@ -168,7 +168,7 @@ gst_gl_display_class_init (GstGLDisplayClass * klass)
* It can be called in any thread and it is emitted with
* display's object lock held.
*
* Returns: (transfer full): the new context.
* Returns: (transfer full) (nullable): the new context.
*/
gst_gl_display_signals[CREATE_CONTEXT] =
g_signal_new ("create-context", G_TYPE_FROM_CLASS (klass),
@ -566,7 +566,7 @@ gst_gl_display_get_handle_type (GstGLDisplay * display)
/**
* gst_context_set_gl_display:
* @context: a #GstContext
* @display: (transfer none): resulting #GstGLDisplay
* @display: (transfer none) (nullable): resulting #GstGLDisplay
*
* Sets @display on @context
*
@ -592,7 +592,7 @@ gst_context_set_gl_display (GstContext * context, GstGLDisplay * display)
/**
* gst_context_get_gl_display:
* @context: a #GstContext
* @display: (out) (transfer full): resulting #GstGLDisplay
* @display: (out) (optional) (nullable) (transfer full): resulting #GstGLDisplay
*
* Returns: Whether @display was in @context
*
@ -622,7 +622,7 @@ gst_context_get_gl_display (GstContext * context, GstGLDisplay ** display)
* @display: a #GstGLDisplay
* @other_context: (transfer none): other #GstGLContext to share resources with.
* @p_context: (transfer full) (out): resulting #GstGLContext
* @error: (allow-none): resulting #GError
* @error: (optional): resulting #GError
*
* It requires the display's object lock to be held.
*
@ -674,7 +674,7 @@ gst_gl_display_create_context (GstGLDisplay * display,
* gst_gl_display_create_window:
* @display: a #GstGLDisplay
*
* Returns: (transfer full): a new #GstGLWindow for @display or %NULL.
* Returns: (transfer full) (nullable): a new #GstGLWindow for @display or %NULL.
*/
/* XXX: previous versions had documentation requiring the OBJECT lock to be
* held when this fuction is called so that needs to always work. */
@ -746,7 +746,7 @@ gst_gl_display_remove_window (GstGLDisplay * display, GstGLWindow * window)
* first argument to @compare_func is the #GstGLWindow being checked and the
* second argument is @data.
*
* Returns: (transfer none): The first #GstGLWindow that causes a match
* Returns: (transfer none) (nullable): The first #GstGLWindow that causes a match
* from @compare_func
*
* Since: 1.12
@ -776,7 +776,7 @@ gst_gl_display_find_window (GstGLDisplay * display, gpointer data,
* first argument to @compare_func is the #GstGLWindow being checked and the
* second argument is @data.
*
* Returns: (transfer full): The first #GstGLWindow that causes a match
* Returns: (transfer full) (nullable): The first #GstGLWindow that causes a match
* from @compare_func
*
* Since: 1.18
@ -852,7 +852,7 @@ _get_gl_context_for_thread_unlocked (GstGLDisplay * display, GThread * thread)
* @display: a #GstGLDisplay
* @thread: a #GThread
*
* Returns: (transfer full): the #GstGLContext current on @thread or %NULL
* Returns: (transfer full) (nullable): the #GstGLContext current on @thread or %NULL
*
* Must be called with the object lock held.
*

View file

@ -495,7 +495,7 @@ gst_gl_format_is_supported (GstGLContext * context, GstGLFormat format)
* gst_gl_texture_target_to_string:
* @target: a #GstGLTextureTarget
*
* Returns: the stringified version of @target or %NULL
* Returns: (nullable): the stringified version of @target or %NULL
*/
const gchar *
gst_gl_texture_target_to_string (GstGLTextureTarget target)
@ -583,7 +583,7 @@ gst_gl_texture_target_from_gl (guint target)
* gst_gl_texture_target_to_buffer_pool_option:
* @target: a #GstGLTextureTarget
*
* Returns: a string representing the @GstBufferPoolOption specified by @target
* Returns: (nullable): a string representing the @GstBufferPoolOption specified by @target
*/
const gchar *
gst_gl_texture_target_to_buffer_pool_option (GstGLTextureTarget target)

View file

@ -266,7 +266,7 @@ _new_with_stages_va_list (GstGLContext * context, GError ** error,
/**
* gst_gl_shader_new_link_with_stages:
* @context: a #GstGLContext
* @error: a #GError
* @error: (optional): a #GError
* @...: a NULL terminated list of #GstGLSLStage's
*
* Each stage will attempt to be compiled and attached to @shader. Then
@ -302,7 +302,7 @@ gst_gl_shader_new_link_with_stages (GstGLContext * context, GError ** error,
/**
* gst_gl_shader_new_with_stages:
* @context: a #GstGLContext
* @error: a #GError
* @error: (optional): a #GError
* @...: a NULL terminated list of #GstGLSLStage's
*
* Each stage will attempt to be compiled and attached to @shader. On error,
@ -344,7 +344,7 @@ gst_gl_shader_new (GstGLContext * context)
/**
* gst_gl_shader_new_default:
* @context: a #GstGLContext
* @error: a #GError that is filled on failure
* @error: (optional): a #GError that is filled on failure
*
* Note: must be called in the GL thread
*
@ -594,7 +594,7 @@ gst_gl_shader_attach (GstGLShader * shader, GstGLSLStage * stage)
* gst_gl_shader_compile_attach_stage:
* @shader: a #GstGLShader
* @stage: a #GstGLSLStage to attach
* @error: a #GError
* @error: (optional): a #GError
*
* Compiles @stage and attaches it to @shader.
*
@ -626,7 +626,7 @@ gst_gl_shader_compile_attach_stage (GstGLShader * shader, GstGLSLStage * stage,
/**
* gst_gl_shader_link:
* @shader: a #GstGLShader
* @error: a #GError
* @error: (optional): a #GError
*
* Links the current list of #GstGLSLStage's in @shader.
*

View file

@ -237,7 +237,7 @@ _is_valid_version_profile (GstGLSLVersion version, GstGLSLProfile profile)
* @version: a #GstGLSLVersion
* @profile: a #GstGLSLVersion
*
* Returns: the combined GLSL `#version` string for @version and @profile
* Returns: (nullable): the combined GLSL `#version` string for @version and @profile
*/
gchar *
gst_glsl_version_profile_to_string (GstGLSLVersion version,

View file

@ -1444,7 +1444,7 @@ gst_gl_view_convert_get_property (GObject * object, guint prop_id,
* Converts the data contained by @inbuf using the formats specified by the
* #GstCaps passed to gst_gl_view_convert_set_caps()
*
* Returns: (transfer full): a converted #GstBuffer or %NULL
* Returns: (transfer full) (nullable): a converted #GstBuffer or %NULL
*
* Since: 1.6
*/

View file

@ -71,7 +71,7 @@ gst_gl_display_viv_fb_finalize (GObject * object)
*
* Create a new #GstGLDisplayVivFB from the FB display index.
*
* Returns: (transfer full): a new #GstGLDisplayVivFB or %NULL
* Returns: (transfer full) (nullable): a new #GstGLDisplayVivFB or %NULL
*/
GstGLDisplayVivFB *
gst_gl_display_viv_fb_new (gint disp_idx)

View file

@ -92,7 +92,7 @@ gst_gl_display_wayland_finalize (GObject * object)
* Create a new #GstGLDisplayWayland from the wayland display name. See `wl_display_connect`()
* for details on what is a valid name.
*
* Returns: (transfer full): a new #GstGLDisplayWayland or %NULL
* Returns: (transfer full) (nullable): a new #GstGLDisplayWayland or %NULL
*/
GstGLDisplayWayland *
gst_gl_display_wayland_new (const gchar * name)

View file

@ -91,7 +91,7 @@ gst_gl_display_x11_finalize (GObject * object)
* Create a new #GstGLDisplayX11 from the x11 display name. See `XOpenDisplay`()
* for details on what is a valid name.
*
* Returns: (transfer full): a new #GstGLDisplayX11 or %NULL
* Returns: (transfer full) (nullable): a new #GstGLDisplayX11 or %NULL
*/
GstGLDisplayX11 *
gst_gl_display_x11_new (const gchar * name)