IC4_SNAPSINK_CONFIG Struct Reference

Configures the behavior of a snap sink. More...

Data Fields

enum IC4_SNAPSINK_ALLOCATION_STRATEGY strategy

Specifies the sink's buffer allocation strategy.

size_t num_buffers_alloc_on_connect

Defines the number of buffers to auto-allocate when the stream is set up.

size_t num_buffers_allocation_threshold

Defines the minimum number of required free buffers.

size_t num_buffers_free_threshold

Defines the maximum number of free buffers.

size_t num_buffers_max

Defines the maximum total number of buffers this sink will allocate.

enum IC4_PIXEL_FORMATpixel_formats

An array of possible pixel formats that the sink can receive.

size_t num_pixel_formats

Length of the pixel_formats array.

struct IC4_ALLOCATOR_CALLBACKS allocator

A structure containing function pointers to customize the sink's allocator.

void * allocator_context

A user-defined value that is passed to the allocator callbacks.

Detailed Description

Configures the behavior of a snap sink.

A pointer to a IC4_SNAPSINK_CONFIG is passed to ic4_snapsink_create().

Field Documentation

◆ allocator

struct IC4_ALLOCATOR_CALLBACKS allocator

A structure containing function pointers to customize the sink's allocator.

This parameter is optional, set all callback functions to to use the default allocator.

If IC4_ALLOCATOR_CALLBACKS::allocate_buffer is set, IC4_ALLOCATOR_CALLBACKS::free_buffer must be set as well.

◆ allocator_context

void* allocator_context

A user-defined value that is passed to the allocator callbacks.

If callback_context points to a memory location, and callback functions access that memory, the program has to make sure that the memory is valid until the IC4_ALLOCATOR_CALLBACKS::release callback is executed.

◆ num_buffers_alloc_on_connect

size_t num_buffers_alloc_on_connect

Defines the number of buffers to auto-allocate when the stream is set up.

This value is ignored unless strategy is set to IC4_SNAPSINK_ALLOCATION_STRATEGY_CUSTOM.

◆ num_buffers_allocation_threshold

size_t num_buffers_allocation_threshold

Defines the minimum number of required free buffers.

If the number of free buffers falls below this, new buffers are allocated.

This value is ignored unless strategy is set to IC4_SNAPSINK_ALLOCATION_STRATEGY_CUSTOM.

◆ num_buffers_free_threshold

size_t num_buffers_free_threshold

Defines the maximum number of free buffers.

If the number of free buffers grows above this, buffers are freed.

If set to 0, buffers are not freed automatically.

This value is ignored unless strategy is set to IC4_SNAPSINK_ALLOCATION_STRATEGY_CUSTOM.

Note
If num_buffers_free_threshold is not 0, it must be larger than num_buffers_allocation_threshold + 2.

◆ num_buffers_max

size_t num_buffers_max

Defines the maximum total number of buffers this sink will allocate.

This includes both free buffers managed by the sink and filled buffers owned by the program.

If set to 0, there is no limit to the total number of buffers.

This value is ignored unless strategy is set to IC4_SNAPSINK_ALLOCATION_STRATEGY_CUSTOM.

◆ num_pixel_formats

size_t num_pixel_formats

Length of the pixel_formats array.

If this value is 0, the sink will accept any pixel format.

◆ pixel_formats

enum IC4_PIXEL_FORMAT* pixel_formats

An array of possible pixel formats that the sink can receive.

The image types can be partially specified.

◆ strategy

Specifies the sink's buffer allocation strategy.

The buffer allocation strategy defines how many buffers are pre-allocated, when additional buffers are created, and when excess buffers are reclaimed.