FrameSnapSink::create Method

Creates a new FrameSnapSink.
Syntax:
static tFrameSnapSinkPtr   create( size_t bufferCountToAllocateAfterConnect = 0 );
static tFrameSnapSinkPtr   create( const FrameTypeInfo& type, size_t bufferCountToAllocateAfterConnect = 0 );
static tFrameSnapSinkPtr   create( const FrameTypeInfoArray& acceptedFrameTypes, size_t bufferCountToAllocateAfterConnect = 0 );

Parameter Description
bufferCountToAllocateAfterConnect

Specifies the count of buffers to pre-allocate, when this sink gets connected in a Grabber object.

type

Specifies the FrameTypeInfo of the sink itself.

acceptedFrameTypes

Specifies a list of acceptable frame types for the sink.

Return Value:

A pointer to the new FrameSnapSink, or NULL,if an error occurred.

Examples:

This is a simple example on how to create and use a FrameSnapSink to snap a single image and save it to a file.

// Create a FrameSnapSink, specify buffer type as RGB32, pre-allocate one buffer on connect
auto pSink = FrameSnapSink::create( MEDIASUBTYPE_RGB32, 1 );
// Use the sink and start grabber
grabber.setSinkType( pSink );
grabber.startLive();
// Snap 1 image with 3 second timeout
auto pBuffer = pSink->snapSingle( 3000 );
// Save image
saveToFileBMP( *pBuffer, "test.bmp" );

See also: FrameSnapSink, tFrameSnapSinkPtr, FrameTypeInfo, FrameTypeInfoArray

<< FrameSnapSink