QueueSinkListener Class Referenceceabstract

Abstract base class for QueueSink notifications. More...

Public Member Functions

virtual bool  sinkConnected (QueueSink &sink, const ImageType &imageType, size_t min_buffers_required)

Called when the data stream to the sink is created.

virtual void sinkDisconnected (QueueSink &sink)

Called when the data stream to the sink is stopped.

virtual void framesQueued (QueueSink &sink)=0

Called when new images were added to the sink's queue of filled buffers.

Detailed Description

Abstract base class for QueueSink notifications.

Member Function Documentation

◆ framesQueued()

virtual void framesQueued ( QueueSink sink)
pure virtual

Called when new images were added to the sink's queue of filled buffers.

This callback usually calls QueueSink::popOutputBuffer() to access the filled image buffers.

Parameters
[in]sinkThe sink object
Note
If this callback function performs a lengthy operation, it is recommended to regularly check QueueSink::isCancelRequested() to determine whether the data stream is being stopped.
The function is executed on dedicated thread managed by the sink.
Warning
When the data stream to the sink is stopped, the Grabber::streamStop() call wait until this function returns. This can quickly lead to a deadlock, if code in the framesQueued callback performs an operation that unconditionally requires activity on the thread that called Grabber::streamStop().

◆ sinkConnected()

virtual bool sinkConnected ( QueueSink sink,
const ImageType imageType,
size_t  min_buffers_required 
)
inlinevirtual

Called when the data stream to the sink is created.

Parameters
[in]sinkThe sink object
[in]imageTypeThe negotiated image type that the sink will receive
[in]min_buffers_requiredThe minimum number of buffers required by the device to start a stream
Returns
true, if the data stream should be created. If false is returned the call to Grabber::streamSetup() will fail.
Note
The function is executed on the thread that calls Grabber::streamSetup().
If the callback function does not allocate any buffers, the sink will automatically allocate the minimum number of buffers required.

◆ sinkDisconnected()

virtual void sinkDisconnected ( QueueSink sink)
inlinevirtual

Called when the data stream to the sink is stopped.

Parameters
[in]sinkThe sink object
Note
The function is executed on the thread that calls Grabber::streamStop().