集成完直播后提交代码

This commit is contained in:
xuhuixiang
2026-02-06 14:55:21 +08:00
commit ea9ffa06ff
960 changed files with 75063 additions and 0 deletions

1
LiveBeauty/live_beauty/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View 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
}

View 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

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.alivc.live.beauty" />

View File

@@ -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;
}
}

View File

@@ -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();
}

View File

@@ -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";
}

View File

@@ -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;
}

View File

@@ -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;
}
}