类 TSRSdk


  • public class TSRSdk
    extends java.lang.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, 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,
                         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 - appId
        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.
      • 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, TSRSdkLicenseVerifyResultCallback, TSRLogger)) before using it again.