Imaging Control 4 C Library 1.2.0
|
The queue sink is a sink implementation that allows a program to process all images received from a video capture device. More...
Data Structures | |
struct | IC4_QUEUESINK_CALLBACKS |
Contains function pointers used to specify the behavior of a queue sink. More... | |
struct | IC4_QUEUESINK_CONFIG |
Configures the behavior of a queue sink. More... | |
struct | IC4_QUEUESINK_QUEUE_SIZES |
Contains information about the current queue lengths inside the queue sink. More... | |
Functions | |
bool | ic4_queuesink_create (struct IC4_SINK **ppSink, const struct IC4_QUEUESINK_CONFIG *config) |
Creates a new Queue Sink. | |
bool | ic4_queuesink_get_output_image_type (const struct IC4_SINK *pSink, struct IC4_IMAGE_TYPE *image_type) |
Queries the image type of the images the sink is configured to receive. | |
bool | ic4_queuesink_alloc_and_queue_buffers (struct IC4_SINK *pSink, size_t num_buffers) |
Allocates a number of buffers matching the sink's image type and puts them into the free queue. | |
bool | ic4_queuesink_pop_output_buffer (struct IC4_SINK *pSink, struct IC4_IMAGE_BUFFER **ppImageBuffer) |
Retrieves a buffer that was filled with image data from the sink's output queue. | |
bool | ic4_queuesink_is_cancel_requested (const struct IC4_SINK *pSink, bool *cancel_requested) |
Checks whether the data stream this sink is connected to is in the process of being stopped. | |
bool | ic4_queuesink_get_queue_sizes (const struct IC4_SINK *pSink, struct IC4_QUEUESINK_QUEUE_SIZES *sizes) |
Query information about the number of image buffers in the queue sink's queues. | |
The queue sink is a sink implementation that allows a program to process all images received from a video capture device.
A queue sink manages a number of buffers that are organized in two queues:
To create a queue sink, call ic4_queuesink_create().
Usually, the queue sink is interacted with by registering a set of callback functions in IC4_QUEUESINK_CALLBACKS. The callback functions are called at different significant points in the lifetime of a queue sink:
To retrieve the oldest available image from the output queue, call ic4_queuesink_pop_output_buffer(). The caller owns the IC4_IMAGE_BUFFER that is returned. It is responsible to call ic4_imagebuffer_unref() at a later time to return the buffer to the sink's free queue.
A program does not necessarily have to requeue all image buffers immediately; it can choose to store references to a number of them in its own data structures. However, please note that if there are no buffers in the free queue when the device tries to deliver a frame, the frame will be dropped. Use ic4_grabber_get_stream_stats() to find out whether a buffer underrun occurred.
bool ic4_queuesink_alloc_and_queue_buffers | ( | struct IC4_SINK * | pSink, |
size_t | num_buffers | ||
) |
Allocates a number of buffers matching the sink's image type and puts them into the free queue.
[in] | pSink | A queue sink |
[in] | num_buffers | Number of buffers to allocate |
true
on success, otherwise false
.bool ic4_queuesink_create | ( | struct IC4_SINK ** | ppSink, |
const struct IC4_QUEUESINK_CONFIG * | config | ||
) |
Creates a new Queue Sink.
[in] | ppSink | Pointer to a sink handle to receive the new queue sink. |
[in] | config | Pointer to a structure containing the sink configuration |
true
on success, otherwise false
.The image type of the images the sink receives is determined when the data stream to the sink is created in a call to ic4_grabber_stream_setup() using the following steps:
0
, the device format is selected.bool ic4_queuesink_get_output_image_type | ( | const struct IC4_SINK * | pSink, |
struct IC4_IMAGE_TYPE * | image_type | ||
) |
Queries the image type of the images the sink is configured to receive.
[in] | pSink | A queue sink |
[out] | image_type | A structure receiving the image type information |
true
on success, otherwise false
.bool ic4_queuesink_get_queue_sizes | ( | const struct IC4_SINK * | pSink, |
struct IC4_QUEUESINK_QUEUE_SIZES * | sizes | ||
) |
Query information about the number of image buffers in the queue sink's queues.
[in] | pSink | A queue sink |
[out] | sizes | A pointer to a structure to receive the queue lengths |
true
on success, otherwise false
.bool ic4_queuesink_is_cancel_requested | ( | const struct IC4_SINK * | pSink, |
bool * | cancel_requested | ||
) |
Checks whether the data stream this sink is connected to is in the process of being stopped.
This function can be used to cancel a long-running operation in the IC4_QUEUESINK_CALLBACKS::frames_queued callback.
[in] | pSink | A queue sink |
[out] | cancel_requested | Pointer to a flag that receives the cancel request |
true
on success, otherwise false
.bool ic4_queuesink_pop_output_buffer | ( | struct IC4_SINK * | pSink, |
struct IC4_IMAGE_BUFFER ** | ppImageBuffer | ||
) |
Retrieves a buffer that was filled with image data from the sink's output queue.
[in] | pSink | A queue sink |
[out] | ppImageBuffer | A pointer to a frame handle to receive the newly-filled image |
true
if a buffer was successfully dequeued, otherwise false
.ppImageBuffer
owns the frame object.