sudo gem install cocoapods
pod init
#请根据您的套餐pod install对应的库#例如:如果您的套餐是all类型,那么只需要pod 'TencentEffect_All'#例如:如果您的套餐是S1-04类型,那么只需要pod 'TencentEffect_S1-04'pod 'TencentEffect_All'#pod 'TencentEffect_A1-00'#pod 'TencentEffect_A1-01'#pod 'TencentEffect_A1-02'#pod 'TencentEffect_A1-03'#pod 'TencentEffect_A1-04'#pod 'TencentEffect_A1-05'#pod 'TencentEffect_A1-06'#pod 'TencentEffect_S1-00'#pod 'TencentEffect_S1-01'#pod 'TencentEffect_S1-02'#pod 'TencentEffect_S1-03'#pod 'TencentEffect_S1-04'#pod 'TencentEffect_S1-05'#pod 'TencentEffect_S1-06'#pod 'TencentEffect_S1-07'#pod 'TencentEffect_X1-01'#pod 'TencentEffect_X1-02'
pod install
-ObjC。套餐 | SPM 仓库地址 |
A1-00、A1-01、S1-00 | |
A1-02 ~ A1-06、S1-01 ~ S1-07、X1-01、X1-02、All |
Product 后缀 | 含义 |
无后缀,(如 TencentEffect_S1-07) | 包含 SDK 二进制库与资源包(XMagicResources)。 |
_nobundle(如 TencentEffect_S1-07_nobundle) | 仅包含 SDK 二进制库,不含资源包。 |
_nolibpag(如 TencentEffect_S1-07_nolibpag) | 不含 libpag 库,含资源包。 |
-ObjC。XMagic.framework、YTCommonXMagic.framework、libpag.framework、TEFFmpeg.framework(version3.0.0以后,改名为:TECodec.framework)及其所需依赖库 MetalPerformanceShaders.framework、CoreTelephony.framework、JavaScriptCore.framework、VideoToolbox.framework、libc++.tbd,根据需要添加其它工具库 Masonry.framework(控件布局库)、SSZipArchive(文件解压库)。
-ObjC。
TELicenseCheck.h 在 XMagic.framework 里面;SDK 版本在2.5.1及以后,TELicenseCheck.h 在 YTCommonXMagic.framework 里面,只有鉴权成功后才能使用 SDK。[TELicenseCheck setTELicense:LicenseURL key:LicenseKey completion:^(NSInteger authresult, NSString * _Nonnull errorMsg) {if (authresult == TELicenseCheckOk) {NSLog(@"鉴权成功");} else {NSLog(@"鉴权失败");}}];
错误码 | 说明 |
0 | 成功。Success。 |
-1 | 输入参数无效,例如 URL 或 KEY 为空。 |
-3 | 下载环节失败,请检查网络设置。 |
-4 | 从本地读取的 TE 授权信息为空,可能是 IO 失败引起。 |
-5 | 读取 VCUBE TEMP License 文件内容为空,可能是 IO 失败引起。 |
-6 | v_cube.license 文件 JSON 字段不对。请联系腾讯云团队处理。 |
-7 | 签名校验失败。请联系腾讯云团队处理。 |
-8 | 解密失败。请联系腾讯云团队处理。 |
-9 | TELicense 字段里的 JSON 字段不对。请联系腾讯云团队处理。 |
-10 | 从网络解析的 TE 授权信息为空。请联系腾讯云团队处理。 |
-11 | 把 TE 授权信息写到本地文件时失败,可能是 IO 失败引起。 |
-12 | 下载失败,解析本地 asset 也失败。 |
-13 | 鉴权失败。 |
其他 | 请联系腾讯云团队处理。 |
/// root_path 传入 LightCore.bundle所在的目录。NSDictionary *assetsDict = @{@"core_name" : @"LightCore.bundle",@"root_path" : [[NSBundle mainBundle] bundlePath]};self.xMagicApi = [[XMagic alloc] initWithRenderSize:previewSize assetsDict:assetsDict];
/// 以设备摄像头数据输出为例/// sampleBuffer:设备摄像头输出的数据-(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.xMagicKit process:input];if (output.pixelData.data != nil) { //output.pixelData.data:美颜SDK处理以后的数据CMSampleBufferRef outSampleBuffer = [self sampleBufferFromPixelBuffer:output.pixelData.data];return outSampleBuffer;}return nil;}/// PixelBuffer转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;}
/// 在需要释放SDK资源的地方调用[self.xMagicApi deinit];
文档反馈