IC4_ALLOCATOR_CALLBACKS Struct Reference
Contains function pointers used to configure a custom allocator for image buffers. More...
Data Fields
void(* | release )(void *context) Notifies the user that the allocator will not receive any additional callback function calls. |
bool(* | allocate_buffer )(void *context, size_t buffer_size, size_t alignment, void **buffer_ptr, void **user_data) Requests the allocator to allocate a memory buffer. |
void(* | free_buffer )(void *context, void *buffer_ptr, void *user_data Requests the allocator to free a previously-allocated memory buffer. |
Detailed Description
Contains function pointers used to configure a custom allocator for image buffers.
Field Documentation
◆ allocate_buffer
bool(* allocate_buffer) (void *context, size_t buffer_size, size_t alignment, void **buffer_ptr, void **user_data) |
Requests the allocator to allocate a memory buffer.
- Parameters
-
[in] context The allocator_context
parameter that was passed to the sink creation function[in] buffer_size The size of the requested memory buffer [in] alignment Requests memory to be allocated on a specific alignment boundary.
This value is always a power of 2.[out] buffer_ptr A pointer to a pointer that receives the address of the newly-allocated buffer [out] user_data User data to attach to the buffer. The user data is passed to free_buffer when the allocated memory is freed again.
- Returns
true
on success. If the allocation could not be performed, returnfalse
.
◆ free_buffer
void(* free_buffer) (void *context, void *buffer_ptr, void *user_data) |
Requests the allocator to free a previously-allocated memory buffer.
- Parameters
-
[in] context The allocator_context
parameter that was passed to the sink creation function[in] buffer_ptr Pointer to the memory buffer to be freed [in] user_data The user data that was returned from allocate_buffer when the memory buffer was allocated
◆ release
void(* release) (void *context) |
Notifies the user that the allocator will not receive any additional callback function calls.
Any resources attached to the context
parameter can be released.
- Parameters
-
[in] context The allocator_context
parameter that was passed to the sink creation function.
- Note
- The
release
callback function is executed on the thread that destroys the sink using the final call to ic4_sink_unref().