Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify the fu beauty SDK version as 8.6.0 and delete the Chinese ann… #32

Open
wants to merge 2 commits into
base: dev/fu_8.6.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions iOS/BeautyAPi/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="cUh-dw-9VZ">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="cUh-dw-9VZ">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -17,13 +17,13 @@
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="输入频道" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="b34-vf-Hsz">
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Input channel" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="b34-vf-Hsz">
<rect key="frame" x="44" y="253" width="305" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="编码分辨率" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eEh-Ut-trt">
<rect key="frame" x="44" y="390" width="87" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Encoding resolution" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eEh-Ut-trt">
<rect key="frame" x="44" y="390" width="150.66666666666666" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -36,8 +36,8 @@
<action selector="onClickResolutionButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="zUJ-tF-JN2"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="编码帧率" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nve-Qw-SHO">
<rect key="frame" x="44" y="435" width="70" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Encoded frame rate" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nve-Qw-SHO">
<rect key="frame" x="44" y="435" width="150.33333333333334" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -57,13 +57,13 @@
<constraint firstAttribute="height" constant="35" id="nlg-mn-gf2"/>
</constraints>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="加入频道"/>
<buttonConfiguration key="configuration" style="filled" title="Join channel"/>
<connections>
<action selector="onClickJoinChannelButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="yFN-GD-7t1"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="角色" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AT4-AP-5fJ">
<rect key="frame" x="44" y="309" width="35" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Role" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AT4-AP-5fJ">
<rect key="frame" x="44" y="309" width="33.333333333333343" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -76,8 +76,8 @@
<action selector="onClickRoleButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="u5m-ix-Vbk"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="美颜采集方式" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pN3-ph-fqS">
<rect key="frame" x="44" y="347" width="104" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Beauty collection method" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pN3-ph-fqS">
<rect key="frame" x="44" y="347" width="194" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -90,8 +90,8 @@
<action selector="onClickCaptureButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="j64-5u-BYv"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="美颜" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v1c-dZ-sk8">
<rect key="frame" x="44" y="476" width="35" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Beauty" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v1c-dZ-sk8">
<rect key="frame" x="44" y="476" width="53.333333333333343" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand Down
2 changes: 1 addition & 1 deletion iOS/BeautyAPi/BeautyAPI.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |spec|
spec.author = { "ZYQ" => "zhaoyongqiang@agora.io" }
spec.source = { :git => "https://github.com/AgoraIO-Community/BeautyAPI.git", :tag => spec.version }

# 默认加载所有
# Load all by default
spec.default_subspec = "Core"

# All
Expand Down
90 changes: 45 additions & 45 deletions iOS/BeautyAPi/BeautyAPI/BeautyAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, BeautyPresetMode) {
/// 默认美颜参数
/// Default beauty parameters
BeautyPresetModeDefault = 0,
/// 外部自定义美颜参数, 外部自行设置
/// External custom beauty parameters, external self-setting
BeautyPresetModeCustom = 1
};

Expand Down Expand Up @@ -48,49 +48,49 @@ typedef NS_ENUM(NSInteger, CaptureMode) {
};

@interface BeautyStats : NSObject
/// 美颜最小耗时
/// The least time-consuming beauty
@property (nonatomic, assign)double minCostMs;
/// 美颜最大耗时
/// Beauty is the most time-consuming
@property (nonatomic, assign)double maxCostMs;
/// 美颜平均耗时
/// Beauty takes an average time.
@property (nonatomic, assign)double averageCostMs;

@end

typedef NS_ENUM(NSInteger, MirrorMode) {
/// 本地远端都镜像,前置默认
/// The local remote end is mirrored, and the front default
MirrorMode_LOCAL_REMOTE = 0,
/// 仅本地镜像,远端不镜像,用于打电话场景,电商直播场景(保证电商直播后面的告示牌文字是正的);这种模式因为本地远端是反的,所以肯定有一边的文字贴纸方向会是反的
/// Only local mirroring, no mirroring at the remote end, used for phone call scenes, e-commerce live broadcast scenes (ensure that the bulletin board text behind the e-commerce live broadcast is positive); this mode is reversed because the local remote is reversed, so there must be a side of the direction of the text sticker.
MirrorMode_LOCAL_ONLY = 1,
/// 仅远端镜像
/// Remote mirroring only
MirrorMode_REMOTE_ONLY= 2,
/// 本地远端都不镜像,后置默认
/// The local remote end is not mirrored, and the back defaults.
MirrorMode_NONE
};

@interface CameraConfig : NSObject
// 前置默认镜像
// Front default mirror image
@property(nonatomic, assign) MirrorMode frontMirror;
// 后置默认镜像
// Rear default mirror image
@property(nonatomic, assign) MirrorMode backMirror;
@end

@interface BeautyConfig : NSObject
#if __has_include(<AgoraRtcKit/AgoraRtcKit.h>)
// 由外部传入的rtc对象,不可为空
// The rtc object passed in from the outside cannot be empty.
@property(nonatomic, weak)AgoraRtcEngineKit *rtcEngine;
#endif
// 由外部传入的美颜SDK接口对象(不同厂家不一样),不可为空
// The beauty SDK interface object (different manufacturers are different) passed in from the outside cannot be empty.
@property(nonatomic, weak)id<BeautyRenderDelegate>beautyRender;
// 是否由内部自动注册祼数据回调处理
// Whether to automatically register the data callback processing internally
@property(nonatomic, assign)CaptureMode captureMode;
// 事件回调,包含美颜耗时
// Event callback, including beauty time-consuming
@property(nonatomic, copy)void (^eventCallback)(BeautyStats *stats);
// 统计区间 单位: 秒 默认: 1s
// Statistical interval Unit: seconds Default: 1s
@property(nonatomic, assign)NSInteger statsDuration;
// 是否开启统计
// Whether to turn on statistics
@property(nonatomic, assign)BOOL statsEnable;
// 配置摄像头镜像
// Configure camera mirroring
@property(nonatomic, strong)CameraConfig *cameraConfig;

@end
Expand All @@ -103,93 +103,93 @@ typedef NS_ENUM(NSInteger, MirrorMode) {
@property (nonatomic, weak) id<BeautyRenderDelegate>beautyRender;

/**
* 创建并初始化美颜场景化API,如果外部调用过registerVideoFrameObserver,那create必须在此之后调用
* Create and initialize the beauty scenario API. If registerVideoFrameObserver has been called externally, create must be called after that.
*
* @param config 配置
* @param config config
*
* @return 0: 成功, 非0: 见错误码
* @return 0: Success, Non 0: See error code
**/
- (int)initialize: (BeautyConfig *)config;

/**
* 美颜开关
* Beauty switch
*
* @param enable 是否打开美颜
* @param enable Whether to turn on the beauty
*
* @return 0: 成功, 非0: 见错误码
* @return 0: Success, Non 0: See error code
**/
- (int)enable: (BOOL)enable;

/**
* 读取美颜开关状态
* Read the status of the beauty switch
**/
@property (nonatomic, readonly, assign) BOOL isEnable;

/**
* 是否是前置摄像头
* Is it the front camera?
**/
@property (nonatomic, assign, readonly) BOOL isFrontCamera;

/**
* 切换摄像头
* Switch the camera
*
*
* @return 0: 成功;非0:见错误码
* @return 0: Success; Non 0: See the error code
**/
- (int)switchCamera;

/**
* 设置摄像头镜像模式,注意前置和后置要单独控制
* Set the camera mirroring mode, and pay attention to the front and rear should be controlled separately.
*
*
* @return 0: 成功;非0:见错误码
* @return 0: Success; Non 0: See the error code
**/
- (int)updateCameraConfig: (CameraConfig *)cameraConfig;

/**
* 本地视图渲染,由内部来处理镜像问题
* Local view rendering, internal to deal with mirroring problems
*
* @param view 渲染视图
* @param renderMode 渲染缩放模式
* @return 0: 成功, 非0: 见错误码
* @param view Rendering view
* @param renderMode Render zoom mode
* @return 0: Success, Non 0: See error code
**/
#if __has_include(<AgoraRtcKit/AgoraRtcKit.h>)
- (int)setupLocalVideo: (UIView *)view renderMode: (AgoraVideoRenderMode)renderMode;
#endif

/**
* 镜像处理方法,当useCustom为true时才需要调用
* The mirror processing method only needs to be called when useCustom is true.
*
* @return 采集时是否需要镜像
* @return Do you need mirroring when collecting?
**/
- (BOOL)getMirrorApplied;
/**
* 美颜处理方法,当useCustom为true时才需要调用,否则会报错
* The beauty processing method only needs to be called when useCustom is true, otherwise an error will be reported.
*
*
* @return 0: 成功;非0:见错误码
* @return 0: Success; Non 0: See the error code
**/
- (int)onFrame: (CVPixelBufferRef)pixelBuffer callback: (void (^)(CVPixelBufferRef))callback;

/**
* 设置美颜最佳默认参数
* Set the best default parameters for beauty
*
* @param mode 美颜参数模式
* @param mode Beauty parameter mode
*
* @return 0: 成功;非0:见错误码
* @return 0: Success; Non 0: See the error code
**/
- (int)setBeautyPreset: (BeautyPresetMode)mode;

/**
* 销毁美颜场景化API。
* 当创建useCustome=true时,会调用rtcEngine.registerVideoFrameObserver(null)将祼数据回调解绑。
* Destroy the beauty scene API.
* When creating useCustome=true, rtcEngine.registerVideoFrameObserver(null) will be called to mediate and bind the data.
*
* @return 0: 成功;非0: 见错误码表
* @return 0: Success; Non 0: See the error code table
**/
- (int)destroy;

/**
* @return 版本号
* @return Version number
**/
- (NSString *)getVersion;

Expand Down
11 changes: 5 additions & 6 deletions iOS/BeautyAPi/BeautyAPI/BeautyAPI.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ - (int)initialize:(BeautyConfig *)config {
self.config.statsDuration = 1;
}
if (config == nil) {
[LogUtil log:@"缺少配置信息" level:(LogLevelError)];
[LogUtil log:@"Lack of configuration information" level:(LogLevelError)];
return -1;
}
if (config.beautyRender == nil) {
[LogUtil log:@"beautyRender 为空" level:(LogLevelError)];
[LogUtil log:@"beautyRender is empty" level:(LogLevelError)];
return -1;
}
[LogUtil log:[NSString stringWithFormat:@"beautyRender == %@", config.beautyRender.description]];
Expand All @@ -100,7 +100,7 @@ - (int)initialize:(BeautyConfig *)config {
[self rtcReportWithEvent:@"initialize" label:dict];
[self setupMirror];
#else
[LogUtil log:@"rtc 未导入" level:(LogLevelError)];
[LogUtil log:@"rtc Not imported" level:(LogLevelError)];
return -1;
#endif
} else {
Expand Down Expand Up @@ -218,7 +218,7 @@ - (int)destroy {

- (void)rtcReportWithEvent: (NSString *)event label: (NSDictionary *)label {
if (self.config.rtcEngine == nil) {
[LogUtil log:@"rtc 不能为空" level:(LogLevelError)];
[LogUtil log:@"rtc Can't be empty" level:(LogLevelError)];
return;
}
[self.reporter reportFuncEventWithName:event value:label ext:@{}];
Expand Down Expand Up @@ -337,7 +337,6 @@ + (void)log:(NSString *)message level:(LogLevel)level {
[self getCurrentTime],
[self getLogPrefixForLevel:level],
message];
// 写入文件
NSString *logFile = [NSString stringWithFormat:@"%@/agora_beautyapi.log", NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject];
[self checkLogFileSizeWithPath: logFile];
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:logFile];
Expand All @@ -361,7 +360,7 @@ + (void)checkLogFileSizeWithPath: (NSString *)filePath {
if (fileAttributes) {
NSNumber *fileSizeNumber = [fileAttributes objectForKey:NSFileSize];
long long fileSize = [fileSizeNumber longLongValue];
if (fileSize > 1024 * 1024 * 2) { // 文件大于2M
if (fileSize > 1024 * 1024 * 2) {
[fileManager removeItemAtPath:filePath error:&error];
}
}
Expand Down
2 changes: 0 additions & 2 deletions iOS/BeautyAPi/BeautyAPI/Render/FURender/FUBeautyRender.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@interface FUBeautyRender ()

#if __has_include(FURenderMoudle)
/// 当前的贴纸
@property (nonatomic, strong) FUSticker *currentSticker;
@property (nonatomic, strong) FUAnimoji *currentAnimoji;
#endif
Expand All @@ -39,7 +38,6 @@ + (BOOL)checkLicense {
FUSetupConfig *setupConfig = [[FUSetupConfig alloc] init];
setupConfig.authPack = FUAuthPackMake(g_auth_package, sizeof(g_auth_package));

// 初始化 FURenderKit
success = [FURenderKit setupWithSetupConfig:setupConfig];
#endif
return success;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ @interface SenseBeautyRender ()

#if __has_include(Sensetime)
@property (nonatomic, strong) NSTimer *timer;
///贴纸id
@property (nonatomic, assign) int stickerId;
@property (nonatomic, assign) int filterId;
#endif
Expand Down
Loading