Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update FaceUnity Nama SDK v7.3.0 #40

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

Merged
yoreland merged 1 commit into AgoraIO:master from isuperqiang:master
Jan 25, 2021
Merged
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
16 changes: 9 additions & 7 deletions Agora-Video-With-FaceUnity-Android/FUREADME.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## 对接第三方 Demo 的 faceunity 模块

当前的 Nama SDK 版本是 **7.2.0**。
本工程是第三方 Demo 依赖的 faceunity 模块,每次升级 SDK 时会优先在这里改动,然后同步到各个第三方 Demo 中。

当前的 Nama SDK 版本是 **7.3.0**。

--------

Expand All @@ -14,7 +16,7 @@
- assets/makeup 文件夹下 \*.bundle 是美妆素材文件。
- com/faceunity/nama/authpack.java 是鉴权证书文件,必须提供有效的证书才能运行 Demo,请联系技术支持获取。

通过 Maven 依赖最新版 SDK:`implementation 'com.faceunity:nama:7.2.0'`,方便升级,推荐使用。
通过 Maven 依赖最新版 SDK:`implementation 'com.faceunity:nama:7.3.0'`,方便升级,推荐使用。

其中,AAR 包含以下内容:

Expand Down Expand Up @@ -178,10 +180,10 @@ demo中,在FUChatActivity类,onCameraChangeRequested方法中执行,缺少
### 三、接口介绍

- IFURenderer 是核心接口,提供了创建、销毁、处理等功能。使用时通过 FURenderer.Builder 创建合适的 FURenderer 实例即可。
- IModuleManager 是模块管理接口,用于创建和销毁各个功能模块,FURenderer 是其实现类。
- IFaceBeautyModule 是美颜模块的接口,用于调整美颜参数。使用时通过 FURenderer 拿到 FaceBeautyModule 实例,调用里面的接口方法即可
- IStickerModule 是贴纸模块的接口,用于加载贴纸效果。使用时通过 FURenderer 拿到 StickerModule 实例,调用里面的接口方法即可
- IMakeModule 是美妆模块的接口,用于加载美妆效果。使用时通过 FURenderer 拿到 MakeupModule 实例,调用里面的接口方法即可
- IBodySlimModule 是美体模块的接口,用于调整美体参数。使用时通过 FURenderer 拿到 BodySlimModule 实例,调用里面的接口方法即可
- IModuleManager 是模块管理接口,用于创建和销毁各个功能模块,FURenderer 是其实现类,通过它访问各个模块接口
- IFaceBeautyModule 是美颜模块的接口,用于调整美颜参数。使用时通过 FURenderer 拿到 IFaceBeautyModule 的实例,调用接口方法即可
- IStickerModule 是贴纸模块的接口,用于呈现贴纸效果。使用时通过 FURenderer 拿到 IStickerModule 的实例,调用接口方法即可
- IMakeModule 是美妆模块的接口,用于呈现美妆效果。使用时通过 FURenderer 拿到 IMakeupModule 的实例,调用接口方法即可
- IBodySlimModule 是美体模块的接口,用于调整美体参数。使用时通过 FURenderer 拿到 IBodySlimModule 的实例,调用接口方法即可

关于 SDK 的更多详细说明,请参看 **[FULiveDemoDroid](https://github.com/Faceunity/FULiveDemoDroid/)**。如有对接问题,请联系技术支持。
8 changes: 4 additions & 4 deletions Agora-Video-With-FaceUnity-Android/faceunity/build.gradle
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 720
versionName "7.2.0"
// 7.2.0_phy_6f1ec6e4_b431017
versionCode 730
versionName "7.3.0"
// 7.3.0_phy_505b959b_bf80f59
}
buildTypes {
release {
Expand All @@ -23,5 +23,5 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.1'
implementation 'com.faceunity:nama:7.2.0'
implementation 'com.faceunity:nama:7.3.0'
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import android.content.Context;

import com.faceunity.nama.module.BodySlimModule;
import com.faceunity.nama.module.FaceBeautyModule;
import com.faceunity.nama.module.IBodySlimModule;
import com.faceunity.nama.module.IEffectModule;
import com.faceunity.nama.module.IFaceBeautyModule;
import com.faceunity.nama.module.IMakeupModule;
import com.faceunity.nama.module.IStickerModule;
import com.faceunity.nama.module.MakeupModule;
import com.faceunity.nama.module.StickerModule;
import com.faceunity.nama.module.impl.BodySlimModule;
import com.faceunity.nama.module.impl.FaceBeautyModule;
import com.faceunity.nama.module.impl.MakeupModule;
import com.faceunity.nama.module.impl.StickerModule;
import com.faceunity.nama.utils.BundleUtils;
import com.faceunity.nama.utils.DeviceUtils;
import com.faceunity.nama.utils.LogUtils;
Expand All @@ -35,7 +36,7 @@ public class FURenderer implements IFURenderer, IModuleManager {
private static final int ITEMS_ARRAY_STICKER = 1;
private static final int ITEMS_ARRAY_MAKEUP = 2;
private static final int ITEMS_ARRAY_BODY_SLIM = 3;
/* 句柄数组长度 4 */
/* 句柄数组长度 4,根据功能需要调整大小 */
private static final int ITEMS_ARRAY_LENGTH = 4;
/* 存放美颜、贴纸等句柄的数组 */
private final int[] mItemsArray = new int[ITEMS_ARRAY_LENGTH];
Expand Down Expand Up @@ -63,10 +64,10 @@ public class FURenderer implements IFURenderer, IModuleManager {
/* GL 线程 ID */
private long mGlThreadId;
/* 特效模块,美颜、贴纸、美妆和美体 */
private FaceBeautyModule mFaceBeautyModule;
private StickerModule mStickerModule;
private MakeupModule mMakeupModule;
private BodySlimModule mBodySlimModule;
private IFaceBeautyModule mFaceBeautyModule;
private IStickerModule mStickerModule;
private IMakeupModule mMakeupModule;
private IBodySlimModule mBodySlimModule;
/* 是否创建过特效模块,用于恢复选中效果 */
private boolean mIsCreatedSticker;
private boolean mIsCreatedMakeup;
Expand Down Expand Up @@ -281,6 +282,7 @@ public int onDrawFrameSingleInput(byte[] img, int w, int h, int format, byte[] r
prepareDrawFrame();
int flags = createFlags();
flags ^= mInputTextureType;
flags |= faceunity.FU_ADM_FLAG_ENABLE_READBACK;
if (mIsRunBenchmark) {
mCallStartTime = System.nanoTime();
}
Expand Down Expand Up @@ -486,7 +488,7 @@ public void onBundleCreated(int itemHandle) {
}

@Override
public BodySlimModule getBodySlimModule() {
public IBodySlimModule getBodySlimModule() {
return mBodySlimModule;
}

Expand Down Expand Up @@ -547,15 +549,15 @@ private void prepareDrawFrame() {
int trackFace = faceunity.fuIsTracking();
// 获取人体是否识别
int trackHumans = faceunity.fuHumanProcessorGetNumResults();
if (mItemsArray[ITEMS_ARRAY_BODY_SLIM] > 0) {
if (BundleUtils.isAiModelLoaded(faceunity.FUAITYPE_HUMAN_PROCESSOR)) {
if (mTrackHumanStatus != trackHumans || mTrackFaceStatus != trackFace) {
mTrackHumanStatus = trackHumans;
mTrackFaceStatus = trackFace;
if (mOnTrackStatusChangedListener != null) {
mOnTrackStatusChangedListener.onTrackStatusChanged(TRACK_TYPE_HUMAN, trackHumans + trackFace);
}
}
} else {
} else if (BundleUtils.isAiModelLoaded(faceunity.FUAITYPE_FACEPROCESSOR)) {
if (mTrackFaceStatus != trackFace) {
mTrackFaceStatus = trackFace;
if (mOnTrackStatusChangedListener != null) {
Expand Down Expand Up @@ -618,6 +620,7 @@ public void run() {
});
}

/* 根据不同的 texture 类型和输入方向,修改 rotationMode */
private int createRotationMode() {
if (mInputTextureType == FURenderer.INPUT_TEXTURE_2D) {
return faceunity.FU_ROTATION_MODE_0;
Expand Down Expand Up @@ -715,7 +718,7 @@ public interface OnSystemErrorListener {

private static final int NANO_IN_ONE_MILLI_SECOND = 1_000_000;
private static final int NANO_IN_ONE_SECOND = 1_000_000_000;
private static final int FRAME_COUNT = 20;
private static final int FRAME_COUNT = 100;
private boolean mIsRunBenchmark = false;
private int mCurrentFrameCount;
private long mLastFrameTimestamp;
Expand Down Expand Up @@ -779,7 +782,7 @@ public Builder(Context context) {
}

/**
* 是否手动创建 EGLContext
* 是否手动创建 EGLContext,默认不创建
*
* @param isCreateEGLContext
* @return
Expand Down Expand Up @@ -823,17 +826,6 @@ public Builder setInputTextureType(int inputTextureType) {
return this;
}

/**
* 输入图像的 buffer 类型,一般不用修改此项
*
* @param inputImageFormat
* @return
*/
public Builder setInputImageFormat(int inputImageFormat) {
this.inputImageFormat = inputImageFormat;
return this;
}

/**
* 输入图像的方向
*
Expand All @@ -846,7 +838,7 @@ public Builder setInputImageOrientation(int inputImageOrientation) {
}

/**
* 相机前后方向
* 相机前后置方向
*
* @param cameraFacing
* @return
Expand Down Expand Up @@ -901,7 +893,7 @@ public Builder setCreateBodySlim(boolean createBodySlim) {
}

/**
* 是否需要 benchmark 统计数据
* 是否运行 benchmark 数据统计,一般用于性能分析
*
* @param isRunBenchmark
* @return
Expand Down Expand Up @@ -962,12 +954,13 @@ public FURenderer build() {
fuRenderer.mOnTrackStatusChangedListener = onTrackStatusChangedListener;
fuRenderer.mOnSystemErrorListener = onSystemErrorListener;

LogUtils.debug(TAG, "FURenderer fields. isCreateEglContext: " + isCreateEglContext + ", maxFaces: "
+ maxFaces + ", inputTextureType: " + inputTextureType + ", inputImageFormat: "
+ inputImageFormat + ", inputImageOrientation: " + inputImageOrientation
+ ", deviceOrientation: " + deviceOrientation + ", cameraType: " + cameraFacing
+ ", isRunBenchmark: " + isRunBenchmark + ", isCreateSticker: " + isCreateSticker
+ ", isCreateMakeup: " + isCreateMakeup + ", isCreateBodySlim: " + isCreateBodySlim);
LogUtils.debug(TAG, "FURenderer fields. isCreateEglContext: " + isCreateEglContext
+ ", maxFaces: " + maxFaces + ", inputTextureType: " + inputTextureType
+ ", inputImageFormat: " + inputImageFormat + ", inputImageOrientation: " + inputImageOrientation
+ ", deviceOrientation: " + deviceOrientation + ", cameraFacing: " + cameraFacing
+ ", isRunBenchmark: " + isRunBenchmark + ", isCreateFaceBeauty: " + isCreateFaceBeauty
+ ", isCreateSticker: " + isCreateSticker + ", isCreateMakeup: " + isCreateMakeup
+ ", isCreateBodySlim: " + isCreateBodySlim);
return fuRenderer;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.faceunity.nama;

import com.faceunity.nama.module.BodySlimModule;
import com.faceunity.nama.module.IBodySlimModule;
import com.faceunity.nama.module.IFaceBeautyModule;
import com.faceunity.nama.module.IMakeupModule;
import com.faceunity.nama.module.IStickerModule;
Expand Down Expand Up @@ -63,7 +63,7 @@ public interface IModuleManager {
*
* @return
*/
BodySlimModule getBodySlimModule();
IBodySlimModule getBodySlimModule();

/**
* 销毁美体模块
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @author Richie on 2020年07月07日
*/
public interface IBodySlimModule {
public interface IBodySlimModule extends IEffectModule {
/**
* 设置最大人体数量
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @author Richie on 2020年07月07日
*/
public interface IFaceBeautyModule {
public interface IFaceBeautyModule extends IEffectModule {
/**
* 设置需要识别的人脸个数
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @author Richie on 2020年07月07日
*/
public interface IMakeupModule {
public interface IMakeupModule extends IEffectModule {
/**
* 选择美妆
*
Expand All @@ -28,4 +28,20 @@ public interface IMakeupModule {
* @param isMakeupFlipPoints 0 为关闭,1 为开启
*/
void setIsMakeupFlipPoints(int isMakeupFlipPoints);

/**
* 设置美妆选择回调
*
* @param onMakeupSelectedListener
*/
void setOnMakeupSelectedListener(OnMakeupSelectedListener onMakeupSelectedListener);

interface OnMakeupSelectedListener {
/**
* 选择美妆
*
* @param itemHandle 句柄
*/
void onMakeupSelected(int itemHandle);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @author Richie on 2020年07月07日
*/
public interface IStickerModule {
public interface IStickerModule extends IEffectModule {
/**
* 选择贴纸
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.faceunity.nama.module;
package com.faceunity.nama.module.event;

import com.faceunity.nama.utils.LogUtils;
import com.faceunity.wrapper.faceunity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.faceunity.nama.module;
package com.faceunity.nama.module.impl;

import com.faceunity.nama.module.IEffectModule;
import com.faceunity.nama.module.event.RenderEventQueue;
import com.faceunity.nama.utils.LogUtils;
import com.faceunity.wrapper.faceunity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.faceunity.nama.module;
package com.faceunity.nama.module.impl;

import android.content.Context;

import com.faceunity.nama.module.IBodySlimModule;
import com.faceunity.nama.module.event.RenderEventQueue;
import com.faceunity.nama.param.BodySlimParam;
import com.faceunity.nama.utils.BundleUtils;
import com.faceunity.nama.utils.LogUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.faceunity.nama.module;
package com.faceunity.nama.module.impl;

import android.content.Context;

import com.faceunity.nama.module.IFaceBeautyModule;
import com.faceunity.nama.module.event.RenderEventQueue;
import com.faceunity.nama.param.BeautificationParam;
import com.faceunity.nama.utils.BundleUtils;
import com.faceunity.nama.utils.LogUtils;
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /