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

The entry point of the SDK. More...

#include <vb_sdk/sdk_factory.h>

Inheritance diagram for tsvb::ISDKFactory:
[legend]

Public Member Functions

virtual IAuthResult * auth (const char *customerID, pfnOnAuthCompletedCallback callback, void *ctx)=0
 Authorizes the instance. The SDK can't be used until authorized.
virtual IAuthResult * authWithAPIUrl (const char *customerID, const char *customApiUrl, pfnOnAuthCompletedCallback callback, void *ctx)=0
 The same as auth(), but sends the authorization request to a custom server.
virtual IAuthResult * authWithKey (const char *key)=0
 Authorizes the instance offline.
virtual void waitUntilAuthFinished ()=0
 Waits until asynchronous authorization is finished.
virtual IFrameFactory * createFrameFactory ()=0
 Creates an instance of IFrameFactory. The caller is responsible for releasing it.
virtual IPipeline * createPipeline ()=0
 Creates an instance of IPipeline. The caller is responsible for releasing it.
Public Member Functions inherited from tsvb::IRelease
virtual void release ()=0
 Releases the memory that was allocated for the object.

Detailed Description

The entry point of the SDK.

Obtain an instance by calling createSDKFactory() exported from the SDK library:

ISDKFactory* createFactory()
{
HMODULE hModule = ::LoadLibraryA("tsvb");
auto createSDKFactory = reinterpret_cast<pfnCreateSDKFactory>(
GetProcAddress(hModule, "createSDKFactory")
);
return createSDKFactory();
}
The entry point of the SDK.
Definition sdk_factory.h:79
ISDKFactory *(*) pfnCreateSDKFactory()
Type of the createSDKFactory() function exported from the SDK library.
Definition sdk_factory.h:174
ISDKFactory * createSDKFactory()
Creates an instance of ISDKFactory. The caller is responsible for releasing it.

Member Function Documentation

◆ auth()

virtual IAuthResult * tsvb::ISDKFactory::auth ( const char * customerID,
pfnOnAuthCompletedCallback callback,
void * ctx )
pure virtual

Authorizes the instance. The SDK can't be used until authorized.

Performs a web request to check the customer ID and get license info.

Can be used synchronously and asynchronously.

Synchronous mode: pass nullptr as callback. The method returns IAuthResult after authorization is finished. The result is owned by the caller and must be released when it isn't needed anymore.

IAuthResult* authResult = sdkFactory->auth(customerID, nullptr, nullptr);
if (authResult->status() == AuthStatus::active) {
// SDK can be used.
}
else {
// Authorization failed.
}
authResult->release();
Result of authorization.
Definition sdk_factory.h:39
virtual AuthStatus status() const =0
Returns the authorization status.
virtual void release()=0
Releases the memory that was allocated for the object.
@ active
Authorization succeeded and the license is active. The SDK can be used.
Definition sdk_factory.h:32

Asynchronous mode: pass a non-null callback. The method returns nullptr and performs authorization asynchronously; a valid IAuthResult is passed into the callback. The callback is called on an internal thread of the SDK, or on the calling thread before the method returns when authorization fails before the web request is sent. Don't call IAuthResult::release() within the callback, the result is deleted after the callback is finished.

void TSVB_CALLBACK authCompletionCallback(IAuthResult* result, void* ctx)
{
HandlerClass* handler = reinterpret_cast<HandlerClass*>(ctx);
handler->handleAuthResult(result);
}
// ...
// Ignore the returned value. In asynchronous mode auth returns nullptr.
sdkFactory->auth(customerID, &authCompletionCallback, handler);
#define TSVB_CALLBACK
Definition sdk_factory.h:11
Parameters
customerIDCustomer ID string, unique identifier.
callbackOptional callback called when asynchronous authorization is completed.
ctxOpaque callback context, passed into the callback as is.
Returns
IAuthResult in synchronous mode, nullptr in asynchronous mode.

◆ authWithAPIUrl()

virtual IAuthResult * tsvb::ISDKFactory::authWithAPIUrl ( const char * customerID,
const char * customApiUrl,
pfnOnAuthCompletedCallback callback,
void * ctx )
pure virtual

The same as auth(), but sends the authorization request to a custom server.

Parameters
customerIDSee auth().
customApiUrlBase URL of the authorization API. If null or empty, the default URL is used.
callbackSee auth().
ctxSee auth().
Returns
See auth().

◆ authWithKey()

virtual IAuthResult * tsvb::ISDKFactory::authWithKey ( const char * key)
pure virtual

Authorizes the instance offline.

Similar to auth(), but performs license verification without web requests. Internet connection is not required.

IAuthResult* authResult = sdkFactory->authWithKey("Your_secret_key");
if (authResult->status() == AuthStatus::active) {
// SDK can be used.
}
else {
// Authorization failed.
}
authResult->release();
Parameters
keyUnique client's secret key. DO NOT reveal it.
Returns
IAuthResult. The caller is responsible for releasing it.

◆ createFrameFactory()

virtual IFrameFactory * tsvb::ISDKFactory::createFrameFactory ( )
pure virtual

Creates an instance of IFrameFactory. The caller is responsible for releasing it.

◆ createPipeline()

virtual IPipeline * tsvb::ISDKFactory::createPipeline ( )
pure virtual

Creates an instance of IPipeline. The caller is responsible for releasing it.

Call it once the instance is authorized with auth(), authWithAPIUrl() or authWithKey().

◆ waitUntilAuthFinished()

virtual void tsvb::ISDKFactory::waitUntilAuthFinished ( )
pure virtual

Waits until asynchronous authorization is finished.

If auth() was called in synchronous mode, returns immediately. Also waits until the callback is finished, so don't call it within the callback.

Don't unload the SDK library until asynchronous authorization is finished. This method can be used to be sure of that before unloading the library. On macOS the library is never unloaded, see Library lifetime.


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