sudo gem install cocoapods
pod init
#Please install the corresponding library according to your package#For example: your package is A1-00pod 'TencentEffect_A1-00', :podspec => 'https://mediacloud-76607.gzc.vod.tencent-cloud.com/TencentEffect/iOS/podspec/latest/TencentEffect_A1-00.podspec'#For example: your package is S1-07pod 'TencentEffect_S1-07', :podspec => 'https://mediacloud-76607.gzc.vod.tencent-cloud.com/TencentEffect/iOS/podspec/latest/TencentEffect_S1-07.podspec'
pod install
Package | SPM Repository URL |
A1-00, A1-01, S1-00 | |
A1-02 to A1-06, S1-01 to S1-07, X1-01, X1-02, All |
Product suffix | Description |
No suffix, (e.g. TencentEffect_S1-07) | Includes the SDK binary libraries and the resource bundle (XMagicResources). |
_nobundle (e.g. TencentEffect_S1-07_nobundle) | Includes only the SDK binary libraries, without the resource bundle. |
_nolibpag (e.g. TencentEffect_S1-07_nolibpag) | Excludes libpag but includes the resource bundle. |
-ObjC to Other Linker Flags.XMagic.framework, YTCommonXMagic.framework, libpag.framework, TECodec.framework and their required dependency libraries MetalPerformanceShaders.framework, JavaScriptCore.framework, VideoToolbox.framework, libc++.tbd andlibsqlite3.tbd. 
-ObjC to Other Linker Flags.
Info.plist file. If you don’t do so, the application will crash on iOS 10. Grant the application camera access in Privacy - Camera Usage Description.LicenseURL and LicenseKEY, refer to Activate the Service.didFinishLaunchingWithOptions method of AppDelegate (the values of LicenseURL and LicenseKey are generated when you bound the license in the console).TELicenseCheck.h in XMagic.framework; if your SDK version is 2.5.1 or later, TELicenseCheck.h is in YTCommonXMagic.framework. The SDK can only be used after successful authentication.[TELicenseCheck setTELicense:LicenseURL key:LicenseKey completion:^(NSInteger authresult, NSString * _Nonnull errorMsg) {if (authresult == TELicenseCheckOk) {NSLog(@"Authentication successful");} else {NSLog(@"Authentication failed");}}];
Error Codes | Description |
0 | Successful. |
-1 | The input parameter is invalid; for example, the URL or KEY is empty. |
-3 | Download failed. Check the network settings. |
-4 | Unable to obtain any Tencent Effect authentication information from the local system, which may be caused by an I/O failure. |
-5 | The VCUBE TEMP license file is empty, which may be caused by an I/O failure. |
-6 | The JSON field in the v_cube.license file is incorrect. Please contact Tencent Cloud team for help. |
-7 | Signature verification failed. Please contact Tencent Cloud team for help. |
-8 | Decryption failed. Please contact Tencent Cloud team for help. |
-9 | The JSON field in TELicense is incorrect. Please contact Tencent Cloud team for help. |
-10 | The Tencent Effect authentication information parsed online is empty. Please contact Tencent Cloud team for help. |
-11 | Failed to write Tencent Effect SDK authentication information to the local file, which may be caused by an I/O failure. |
-12 | Download failed, and failed to parse local assets. |
-13 | Authentication failed. |
Others | Please contact Tencent Cloud team for help. |
/// root_path passes in the directory where LightCore.bundle is located/// When integrating Cocoapod: [[NSBundle mainBundle] bundlePath]/// When SPM is integrated: [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Frameworks/XMagicResources.framework"]/// renderSize is the image resolution, taking 720p as an exampleNSDictionary *assetsDict = @{@"core_name" : @"LightCore.bundle",@"root_path" : @"Pass here the directory path where LightCore.bundle is located"};self.xMagic = [[XMagic alloc] initWithRenderSize:CGSizeMake(720, 1280) assetsDict:assetsDict];
/// Whitening[self.xMagic setEffect:@"beauty.lutFoundationAlpha" effectValue:50 resourcePath:nil extraInfo:nil];/// smooth[self.xMagic setEffect:@"smooth.smooth" effectValue:50 resourcePath:nil extraInfo:nil];
/// Take the device camera data output as an example/// sampleBuffer:Data output by the device camera-(CMSampleBufferRef)didProcessCPUData:(CMSampleBufferRef)sampleBuffer{CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);YTProcessInput *input = [[YTProcessInput alloc] init];input.pixelData = [[YTImagePixelData alloc] init];input.pixelData.data = pixelBuffer;input.dataType = kYTImagePixelData;YTProcessOutput *output = [self.xMagic process:input];if (output.pixelData.data != nil) { //output.pixelData.data:Data processed by Beauty Effect SDKCMSampleBufferRef outSampleBuffer = [self sampleBufferFromPixelBuffer:output.pixelData.data];return outSampleBuffer;}return nil;}/// PixelBuffer to sampleBuffer- (CMSampleBufferRef)sampleBufferFromPixelBuffer:(CVPixelBufferRef)pixelBuffer{CFRetain(pixelBuffer);CMSampleBufferRef outputSampleBuffer = NULL;CMSampleTimingInfo timing = {kCMTimeInvalid, kCMTimeInvalid, kCMTimeInvalid};CMVideoFormatDescriptionRef videoInfo = NULL;OSStatus result = CMVideoFormatDescriptionCreateForImageBuffer(NULL, pixelBuffer, &videoInfo);result = CMSampleBufferCreateForImageBuffer(kCFAllocatorDefault, pixelBuffer, true, NULL, NULL, videoInfo, &timing, &outputSampleBuffer);CFArrayRef attachments = CMSampleBufferGetSampleAttachmentsArray(outputSampleBuffer, YES);CFMutableDictionaryRef dict = (CFMutableDictionaryRef)CFArrayGetValueAtIndex(attachments, 0);CFDictionarySetValue(dict, kCMSampleAttachmentKey_DisplayImmediately, kCFBooleanTrue);CFRelease(videoInfo);CFRelease(pixelBuffer);return outputSampleBuffer;}
/// Called where SDK resources need to be released[self.xMagic deinit]
피드백