类 TSRSdk

java.lang.Object
com.tencent.mps.tie.api.TSRSdk

public class TSRSdk extends Object
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:

  1. Get an instance of TSRSdk using the getInstance() method.
  2. Initialize the TSRSdk object with online license verification using the init(long, int, TSRSdkLicenseVerifyResultCallback, TSRLogger) methods.
  3. Perform super-resolution rendering using the TSRPass class.
  4. Release resources when the TSRSdk object is no longer needed by calling the release() 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.release();
 // Release resources when the TSRSdk object is no longer needed.
 TSRSdk.getInstance().release();
 
 
  • 方法详细资料

    • getInstance

      public static TSRSdk 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 the release() 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. See TSRSdk.TSRSdkLicenseVerifyResultCallback for more information.
      logger - Set a logger for the TSRSdk. The Logger must not be null.
    • init

      public TSRSdk.TSRSdkLicenseStatus init(long appId, String licensePath, TSRLogger logger)
    • release

      public void release()
      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.release() 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.