类 TSRSdk
java.lang.Object
com.tencent.mps.tie.api.TSRSdk
TSRSdk is a class responsible for managing and verifying the license of the super-resolution SDK.
The class provides methods for initializing the SDK with online license verification,
and releasing the resources when the SDK is no longer needed. It also allows setting a custom
logger for logging purposes.
Usage:
- Get an instance of TSRSdk using the
getInstance()
method. - Initialize the TSRSdk object with online license verification using the
init(long, int, TSRSdkLicenseVerifyResultCallback, TSRLogger)
methods. - Perform super-resolution rendering using the
TSRPass
class. - Release resources when the TSRSdk object is no longer needed by calling the
deInit()
method.
Example for online verification:
TSRSdkLicenseVerifyResultCallback callback = new TSRSdkLicenseVerifyResultCallback() {
public void onTSRSdkLicenseVerifyResult(TSRSdkLicenseStatus status) {
if (status == TSRSdkLicenseStatus.AVAILABLE) {
// Creating TSRPass for super-resolution rendering
} else {
// Do something when the verification of sdk's license failed.
}
}
};
TSRSdk.getInstance().init(appId, callback, logger);
// If you have created TSRPass, you should release it before release TSRSdk.
tsrPass.deInit();
// Release resources when the TSRSdk object is no longer needed.
TSRSdk.getInstance().deInit();
-
嵌套类概要
修饰符和类型类说明static enum
Enum representing the status of an SDK license.static interface
TSRSdkLicenseVerifyResultCallback is an interface for handling the result of TSRSDK license verification. -
方法概要
修饰符和类型方法说明void
deInit()
Releases the resources associated with the TSRSdk instance.static TSRSdk
void
init
(long appId, int authId, TSRSdk.TSRSdkLicenseVerifyResultCallback callback, TSRLogger logger) Initializes the TSRSdk with online license verification.Initializes the TsrSdk with offline license verification.
-
方法详细资料
-
getInstance
-
init
public void init(long appId, int authId, TSRSdk.TSRSdkLicenseVerifyResultCallback callback, TSRLogger logger) Initializes the TSRSdk with online license verification. This method only can be executed once before thedeInit()
is executed.- 参数:
appId
- Tencent Cloud account's APPID, You can click on the link https://github.com/tencentyun/TSR/blob/main/%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97.md to learn how to find the APPID.authId
- The authentication ID of the TSRSDK. You can contact the Tencent Cloud MPS Team to get the authentication ID.callback
- SdkLicenseVerifyResultCallback is an interface for handling the result of SDK license verification. SeeTSRSdk.TSRSdkLicenseVerifyResultCallback
for more information.logger
- Set a logger for the TSRSdk. The Logger must not be null.
-
init
Initializes the TsrSdk with offline license verification. This method only can be executed once before thedeInit()
is executed.- 参数:
appId
- Tencent Cloud account's APPID, You can click on the link https://github.com/tencentyun/TSR/blob/main/%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97.md to learn how to find the APPID.licensePath
- The path of the licenselogger
- Set a logger for the TsrSdk. The Logger must not be null.- 返回:
- The result of the verification of sdk's license.
-
deInit
public void deInit()Releases the resources associated with the TSRSdk instance.This method should be called when the TSRSdk instance is no longer needed, to free up memory and other resources. Before calling this method, make sure to release all associated TSRPass objects by calling their
TSRPass.deInit()
method, as they depend on the resources provided by the TSRSdk instance. Failing to release TSRPass objects before releasing the TSRSdk may lead to unexpected errors or undefined behavior.After calling this method, you must re-initialize the TSRSdk instance using the init methods
init(long, int, TSRSdkLicenseVerifyResultCallback, TSRLogger)
) before using it again.
-