FrameNotificationSink

The FrameNotificationSink is a sink type that gives direct access to image data as it becomes available to the application, before even being copied into a dedicated image buffer.

This sink is most useful when the application needs to copy the image data into buffers of a third-party image processing library, because it it possible to avoid a copy operation.

A simple setup example is shown here:

class listener : public FrameNotificationSinkListener
{
public:
    virtual void sinkConnected( const FrameTypeInfo& frameType ) override   {}
    virtual void sinkDisconnected() override                                {}
    virtual void frameReceived( IFrame& frame ) override
    {
        // do something with frame
    }
};
listener listener_instance;
tFrameNotificationSinkPtr pSink = FrameNotificationSink::create( listener_instance );
grabber.setSinkType( pSink );

The sink creation function create is passed an instance of a class derived from FrameNotificationSinkListener. When images are received from the device, the listener's frameReceived method is called.

Because there is no buffering in the sink, it is imperative for the code inside the frameReceived function to return quickly. There is no guarantee for it to be called for every frame if the system load is high, or the function takes a long time to complete relative to the frame interval.

A more complex example implementing ZeroCopy is located in %TOPLEVEL%\Samples\VC\ZeroCopyThirdParty.

Information

    Header File: tisudshl.h
    Namespace: DShowLib
    Introduced in version 3.5

Inheritance

    GrabberSinkType
            FrameNotificationSink

Methods

Method Description
create

Creates a new FrameNotificationSink.

getOutputFrameType

Retrieves the FrameTypeInfo of the current connection.

isConnected

Returns if the sink is currently connected.

<< Classes