Video Effects SDK 2.6.0.118490
AI-powered SDK for real-time video enhancement.
Loading...
Searching...
No Matches
tsvb::IReplacementController Class Referenceabstract

Controls the custom background of background replacement. More...

#include <vb_sdk/pipeline.h>

Inheritance diagram for tsvb::IReplacementController:
[legend]

Public Member Functions

virtual void setBackgroundImage (const IFrame *image)=0
 Sets a custom background image.
virtual void clearBackgroundImage ()=0
 Clears the custom background image, the background becomes transparent.
Public Member Functions inherited from tsvb::IRelease
virtual void release ()=0
 Releases the memory that was allocated for the object.

Detailed Description

Controls the custom background of background replacement.

Obtained with IPipeline::enableReplaceBackground().

Thread-safe: its methods may be called from any thread.

Member Function Documentation

◆ clearBackgroundImage()

virtual void tsvb::IReplacementController::clearBackgroundImage ( )
pure virtual

Clears the custom background image, the background becomes transparent.

◆ setBackgroundImage()

virtual void tsvb::IReplacementController::setBackgroundImage ( const IFrame * image)
pure virtual

Sets a custom background image.

The image is held, not copied. If it was created with makeCopy false, don't release it while it is the background: set another image or call clearBackgroundImage() before releasing it. Changing its data, in memory or in its CVPixelBuffer, while a frame is processed may cause a data race. The pipeline may not see changes made other than through IFrame::lock() with FrameLock::write or FrameLock::readWrite: after such changes, call this method again.

When this call or clearBackgroundImage() is made while a frame is processed, that processing may still read the previous image: if it was created with makeCopy false, don't change or free its data until that processing is done. An image backed by a CVPixelBuffer needs no such care: the pipeline retains the buffer itself while it reads it, so the buffer may stay retained for a while after the image is replaced.

Parameters
imageCustom image for the background. nullptr clears it, as clearBackgroundImage() does.

The documentation for this class was generated from the following file: