集成完直播后提交代码
This commit is contained in:
1
LiveBeauty/live_beauty/.gitignore
vendored
Normal file
1
LiveBeauty/live_beauty/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
30
LiveBeauty/live_beauty/build.gradle
Normal file
30
LiveBeauty/live_beauty/build.gradle
Normal file
@@ -0,0 +1,30 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdkVersion
|
||||
buildToolsVersion androidBuildToolsVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion androidMinSdkVersion
|
||||
targetSdkVersion androidTargetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation externalAndroidAnnotation
|
||||
}
|
||||
0
LiveBeauty/live_beauty/consumer-rules.pro
Normal file
0
LiveBeauty/live_beauty/consumer-rules.pro
Normal file
21
LiveBeauty/live_beauty/proguard-rules.pro
vendored
Normal file
21
LiveBeauty/live_beauty/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
2
LiveBeauty/live_beauty/src/main/AndroidManifest.xml
Normal file
2
LiveBeauty/live_beauty/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.alivc.live.beauty" />
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.alivc.live.beauty;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alivc.live.beauty.constant.BeautySDKType;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class BeautyFactory {
|
||||
private BeautyFactory() {
|
||||
}
|
||||
|
||||
public static BeautyInterface createBeauty(BeautySDKType type, @NonNull Context context) {
|
||||
BeautyInterface itf = null;
|
||||
if (type == BeautySDKType.QUEEN) {
|
||||
Object[] values = {context};
|
||||
Class<?>[] params = {Context.class};
|
||||
itf = reflectInitBeauty(BeautySDKType.QUEEN.getManagerClassName(), values, params);
|
||||
}
|
||||
return itf;
|
||||
}
|
||||
|
||||
private static BeautyInterface reflectInitBeauty(@NonNull String className, @NonNull Object[] values, @NonNull Class<?>[] params) {
|
||||
Object obj = null;
|
||||
try {
|
||||
Class<?> cls = Class.forName(className);
|
||||
Constructor<?> constructor = cls.getDeclaredConstructor(params);
|
||||
obj = constructor.newInstance(values);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return (BeautyInterface) obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.alivc.live.beauty;
|
||||
|
||||
import com.alivc.live.beauty.constant.BeautyImageFormat;
|
||||
|
||||
/**
|
||||
* 美颜基础接口类
|
||||
* <p>
|
||||
* 实现:不同厂商的美颜,须继承自该类进行扩展实现;
|
||||
*/
|
||||
public interface BeautyInterface {
|
||||
|
||||
//////////// 1、美颜生命周期相关接口 ////////////
|
||||
|
||||
/**
|
||||
* 初始化美颜
|
||||
*
|
||||
* @note 注意:直播SDK 从v6.2.0 开始,接口发生变动,不再透出内部glcontext,以供外部进行上下文切换,并进行美颜处理
|
||||
* @note 后续所有video texture回调,将在gl线程回调;
|
||||
* @note 普通直播模式/直播连麦模式,应用层接入美颜Queen SDK的逻辑,将共享使用QueenBeautyImpl中(即:BeautySDKType.QUEEN)
|
||||
*/
|
||||
void init();
|
||||
|
||||
/**
|
||||
* 销毁、释放美颜
|
||||
*/
|
||||
void release();
|
||||
|
||||
//////////// 2、美颜接口 ////////////
|
||||
|
||||
/**
|
||||
* 开启/关闭美颜
|
||||
*
|
||||
* @param enable 是否开启
|
||||
*/
|
||||
void setBeautyEnable(boolean enable);
|
||||
|
||||
//////////// 4、美颜输入输出 ////////////
|
||||
|
||||
/**
|
||||
* 纹理输入接口,用于图像处理
|
||||
*
|
||||
* @param inputTexture 输入纹理id
|
||||
* @param textureWidth 纹理宽度
|
||||
* @param textureHeight 纹理高度
|
||||
* @return 输出纹理
|
||||
* @note 默认输出为Sample2D格式的纹理
|
||||
*/
|
||||
int onTextureInput(int inputTexture, int textureWidth, int textureHeight);
|
||||
|
||||
/**
|
||||
* 帧数据输入接口,用于图像处理
|
||||
*
|
||||
* @param image byte数组形式的帧数据
|
||||
* @param format 帧数据类型,rgba、rgb、nv21等,参考{@linkplain BeautyImageFormat}
|
||||
* @param width 帧宽
|
||||
* @param height 帧高
|
||||
* @param stride 顶点间隔
|
||||
*/
|
||||
void onDrawFrame(byte[] image, @BeautyImageFormat int format, int width, int height, int stride);
|
||||
|
||||
void switchCameraId(int cameraId);
|
||||
|
||||
//////////// 5、美颜其它接口 ////////////
|
||||
|
||||
/**
|
||||
* 获取版本号
|
||||
*
|
||||
* @return 版本号
|
||||
*/
|
||||
String getVersion();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.alivc.live.beauty.constant;
|
||||
|
||||
public class BeautyConstant {
|
||||
public static final String BEAUTY_QUEEN_MANAGER_CLASS_NAME = "com.alivc.live.queenbeauty.QueenBeautyImpl";
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.alivc.live.beauty.constant;
|
||||
|
||||
import static com.alivc.live.beauty.constant.BeautyImageFormat.kDefault;
|
||||
import static com.alivc.live.beauty.constant.BeautyImageFormat.kNV21;
|
||||
import static com.alivc.live.beauty.constant.BeautyImageFormat.kRGB;
|
||||
import static com.alivc.live.beauty.constant.BeautyImageFormat.kRGBA;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({kDefault, kRGB, kNV21, kRGBA})
|
||||
public @interface BeautyImageFormat {
|
||||
int kDefault = -1;
|
||||
int kRGB = 0;
|
||||
int kNV21 = 1;
|
||||
int kRGBA = 2;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alivc.live.beauty.constant;
|
||||
|
||||
public enum BeautySDKType {
|
||||
// should be kept!
|
||||
QUEEN(BeautyConstant.BEAUTY_QUEEN_MANAGER_CLASS_NAME),
|
||||
|
||||
;
|
||||
|
||||
private final String managerClassName;
|
||||
|
||||
BeautySDKType(String managerClassName) {
|
||||
this.managerClassName = managerClassName;
|
||||
}
|
||||
|
||||
public String getManagerClassName() {
|
||||
return managerClassName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user