IC4_QUEUESINK_CALLBACKS Struct Reference
Contains function pointers used to specify the behavior of a queue sink. More...
Data Fields
void(* | release )(void *context) Notifies the user that the sink will not call any additional callback functions. |
bool(* | sink_connected )(struct IC4_SINK *sink, void *context, const struct IC4_IMAGE_TYPE *image_type, size_t min_buffers_required) Called when the data stream to the sink is created. |
void(* | sink_disconnected )(struct IC4_SINK *sink, void *context) Called when the data stream to the sink is stopped. |
void(* | frames_queued )(struct IC4_SINK *sink, void *context) Called when new images were added to the sink's queue of filled buffers. |
Detailed Description
Contains function pointers used to specify the behavior of a queue sink.
Field Documentation
◆ frames_queued
void(* frames_queued) (struct IC4_SINK *sink, void *context) |
Called when new images were added to the sink's queue of filled buffers.
This callback usually calls ic4_queuesink_pop_output_buffer() to access the image buffers.
- Parameters
-
[in] sink The sink object [in] context The context
parameter that was passed to ic4_queuesink_create() when the sink was created
- Note
- If this callback function performs a lengthy operation, it is recommended to regularly check ic4_queuesink_is_cancel_requested() to determine whether the data stream is being stopped.
- The frames_queued function is executed on a dedicated thread managed by the sink.
- Warning
- When the data stream to ths sink is stopped, the ic4_grabber_stream_stop() call wait until this function returns. This can quickly lead to a deadlock, if code in the
frames_queued
callback performs an operation that unconditionally requires activity on the thread that calledic4_grabber_stream_stop
.
◆ release
void(* release) (void *context) |
Notifies the user that the sink will not call any additional callback functions.
Any resources attached to the context
parameter can be released.
- Parameters
-
[in] context The context
parameter that was passed to ic4_queuesink_create() when the sink was created
- Note
- The
release
callback function is executed on the thread that destroys the sink using the final call to ic4_sink_unref().
◆ sink_connected
bool(* sink_connected) (struct IC4_SINK *sink, void *context, const struct IC4_IMAGE_TYPE *image_type, size_t min_buffers_required) |
Called when the data stream to the sink is created.
- Parameters
-
[in] sink The sink object [in] context The context
parameter that was passed to ic4_queuesink_create() when the sink was created[in] image_type The negotiated image type that the sink will receive [in] min_buffers_required The minimum number of buffers required by the device to start a stream
- Returns
true
, if the data stream should be created. Iffalse
is returned the call to ic4_grabber_stream_setup() will fail.
- Note
- min_buffers_required buffers have to be allocated and queued in order for the sink to begin operating. If the function does call ic4_queuesink_alloc_and_queue_buffers(), the required number of buffers will be created automatically after the function returns. If the function does allocate buffers, but the number is lower than required, ic4_grabber_stream_setup() will fail.
- The queuesink_sink_connected function is executed on the thread that calls ic4_grabber_stream_setup().
◆ sink_disconnected
void(* sink_disconnected) (struct IC4_SINK *sink, void *context) |
Called when the data stream to the sink is stopped.
- Parameters
-
[in] sink The sink object [in] context The context
parameter that was passed to ic4_queuesink_create() when the sink was created
- Note
- The sink_disconnected function is executed on the thread that calls ic4_grabber_stream_stop().
- Warning
- When the data stream to ths sink is stopped, the ic4_grabber_stream_stop() call wait until this function returns. This can quickly lead to a deadlock, if code in the sink_disconnected callback performs an operation that unconditionally requires activity on the thread that called ic4_grabber_stream_stop().