MeiCam SDK For Android
3.10.0
|
Meishe effectSDK is used as follows:
The NvsEffectSdkContext class can be thought of as the entry to the entire SDK framework. During development, NvsEffectSdkContext provides a static interface sharedInstance to create the unique instance of "effectSDK" context. With this instance object, users can handle one or more effects. After using, the object instance of the NvsEffectSdkContext should be destroyed. In order to add asset package (capture effect package, scene resource package, etc.), users must firstly install it and then get the corresponding packageId as the handle for further use, while the handle of built-in capture effect is just its name.
Input parameters, such as resource path, license path, of SDK interfaces must be full path.
mEffectSdkContext = NvsEffectSdkContext.init(this, "assets:/effectsdkdemo.lic", 0); mEffectRenderCore = context.createEffectRenderCore();
NvsRational aspectRatio = new NvsRational(9, 16); NvsEffect effect = mEffectSdkContext.createVideoEffect("Color Property", aspectRatio);
3.Set the parameters related to the effect. "fxParam" is the corresponding parameter name and "val" is the value of the parameter.
The corresponding code is as follows:
effect.setFloatVal("Saturation", 0);//Saturation effect.setFloatVal("Brightness", 0);//Brightness effect.setFloatVal("Contrast", 0);//Contrast
String fxPackagePath = "assets:/7CBBDCFB-4568-47FB-8A98-3A699893A043.3.videofx"; int error = mEffectSdkContext.getAssetPackageManager().installAssetPackage(fxPackagePath, null, NvsAssetPackageManager.ASSET_PACKAGE_TYPE_VIDEOFX, true, m_fxPackageId); if (error != NvsAssetPackageManager.ASSET_PACKAGE_MANAGER_ERROR_NO_ERROR && error != NvsAssetPackageManager.ASSET_PACKAGE_MANAGER_ERROR_ALREADY_INSTALLED) { Log.d(TAG, "Failed to install fx package!"); }
mEffectRenderCore.clearEffectResources(effect);
NvsEffectSdkContext.close();