MeiCam SDK For iOS
3.14.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 effect context 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.
NSString *licPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"3-2-3d2c1a947b969a7f7ef4e2eb380c8f44.lic"]; if (![NvsEffectSdkContext verifySdkLicenseFile:licPath]) { NSLog(@"Invalid license!"); } self.renderCore = [self.effectContext createEffectRenderCore];
NvsEffectRational aspectRatio = {9, 16}; self.faceEffect = [self.effectContext createVideoEffect:@"Specific Warp Effect" aspectRatio:aspectRatio];
[self.faceEffect setFloatVal:"Saturation" val:0];//Saturation [self.faceEffect setFloatVal:"Brightness" val:0];//Brightness [self.faceEffect setFloatVal:"Contrast" val:0]; //Contrast
NSString *fxPackagePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"D41B1BC6-23AC-4508-9C8A-F6430BB37C3F.videofx"]; self.assetPackageId = [[NSMutableString alloc] init]; NvsEffectAssetPackageManagerError err = [self.effectContext.assetPackageManager installAssetPackage:fxPackagePath license:nil type:NvsEffectAssetPackageType_VideoFx sync:YES assetPackageId:self.assetPackageId]; if (err != NvsEffectAssetPackageManagerError_NoError && err != NvsEffectAssetPackageManagerError_AlreadyInstalled) { NSLog(@"Failed to install package!"); }
[self.renderCore clearCacheResources]; [self.renderCore clearEffectResources:self.effect]; [self.renderCore cleanUp];
Destroy when exit. The corresponding code is as follows:
[NvsEffectSdkContext destroyInstance];