其他功能模块提供了SDK的各种辅助和扩展功能,包括系统信息上报、网络管理、文件下载、加密功能、外部媒体输入、渲染功能、配置管理等。这些功能为SDK提供了更全面的扩展能力和系统集成支持。
上报应用信息和终端能力:
// 上报App信息 - 上报应用信息JSON字符串
NemoSdkAdaptor::getInstance()->reportAppInfo("app_info_json");
// 上报终端能力 - 上报终端能力JSON字符串
NemoSdkAdaptor::getInstance()->reportCapability("capability_json");
// 更新网络地址 - 更新IP和Mac地址信息
NemoSdkAdaptor::getInstance()->updateNetworkAddress();
下载和管理文件:
// 下载文件 - 下载指定URL的文件到本地路径
NemoSdkAdaptor::getInstance()->downloadFile("file_url", "save_path");
// 取消下载 - 取消正在进行的文件下载
NemoSdkAdaptor::getInstance()->cancelDownload();
配置外部音视频输入源:
// 启用媒体发送配置 - 启用外部媒体发送配置
NemoSdkAdaptor::getInstance()->enableMeidiaTXConfig(true);
// 输入外部视频数据 - 输入外部视频数据和尺寸信息
NemoSdkAdaptor::getInstance()->inputExternalVideoData(videoData, width, height);
// 输入外部音频数据 - 输入外部音频数据和采样率
NemoSdkAdaptor::getInstance()->inputExternalAudioData(audioData, sampleRate);
API: reportAppInfo
参数:
appInfo
: App信息JSON字符串示例:
// 上报应用信息
std::string appInfo = R"({
"appName": "MyMeetingApp",
"version": "1.0.0",
"platform": "Windows"
})";
NemoSdkAdaptor::getInstance()->reportAppInfo(appInfo);
API: reportCapability
参数:
capability
: 终端能力JSON字符串示例:
// 上报终端能力
std::string capability = R"({
"videoCodec": ["H.264", "H.265"],
"audioCodec": ["AAC", "OPUS"],
"maxResolution": "1920x1080"
})";
NemoSdkAdaptor::getInstance()->reportCapability(capability);
API: updateNetworkAddress
示例:
// 更新网络地址信息
NemoSdkAdaptor::getInstance()->updateNetworkAddress();
API: downloadFile
参数:
url
: 文件下载地址savePath
: 文件保存路径示例:
// 下载配置文件
NemoSdkAdaptor::getInstance()->downloadFile(
"https://example.com/config.json",
"C:/config/config.json"
);
API: cancelDownload
示例:
// 取消正在进行的下载
NemoSdkAdaptor::getInstance()->cancelDownload();
API: AESCTR_encrypt
接口定义:
virtual XYString AESCTR_encrypt(const XYString& data, const XYString& key, const XYString& iv) = 0;
参数:
返回值: 返回XYString类型的加密后的数据
示例:
// AES加密数据
XYString data = "sensitive_data";
XYString key = "encryption_key";
XYString iv = "initialization_vector";
XYString encrypted = NemoSdkAdaptor::getInstance()->AESCTR_encrypt(data, key, iv);
API: AESCTR_decrypt
接口定义:
virtual XYString AESCTR_decrypt(const XYString& data, const XYString& key, const XYString& iv) = 0;
参数:
返回值: 返回XYString类型的解密后的数据
示例:
// AES解密数据
XYString encryptedData = "encrypted_data";
XYString key = "encryption_key";
XYString iv = "initialization_vector";
XYString decrypted = NemoSdkAdaptor::getInstance()->AESCTR_decrypt(encryptedData, key, iv);
API: RSA_encrypt
接口定义:
virtual XYString RSA_encrypt(const XYString& data, const XYString& publicKey) = 0;
参数:
返回值: 返回XYString类型的加密后的数据
示例:
// RSA加密数据
XYString data = "data_to_encrypt";
XYString publicKey = "public_key";
XYString encrypted = NemoSdkAdaptor::getInstance()->RSA_encrypt(data, publicKey);
API: enableMeidiaTXConfig
接口定义:
virtual void enableMeidiaTXConfig(bool enabled) = 0;
参数:
enabled
: bool - 是否启用自定义音视频输入源返回值: 无
示例:
// 启用自定义音视频输入源
NemoSdkAdaptor::getInstance()->enableMeidiaTXConfig(true);
接口定义:
virtual void inputExternalVideoData(uint8_t* data, int width, int height, XYVideoFormat format) = 0;
参数:
data
: uint8_t* - 视频数据width
: int - 视频宽度height
: int - 视频高度format
: XYVideoFormat - 视频格式返回值: 无
示例:
// 输入外部视频数据
uint8_t* videoData = getExternalVideoFrame();
NemoSdkAdaptor::getInstance()->inputExternalVideoData(videoData, 1920, 1080, XYVideoFormat_I420);
接口定义:
virtual void inputExternalAudioData(uint8_t* data, int sampleRate, int channels) = 0;
参数:
data
: uint8_t* - 音频数据sampleRate
: int - 采样率channels
: int - 声道数返回值: 无
示例:
// 输入外部音频数据
uint8_t* audioData = getExternalAudioFrame();
NemoSdkAdaptor::getInstance()->inputExternalAudioData(audioData, 48000, 2);
API: putContentData
参数:
data
: 内容数据示例:
// 输入内容共享数据
uint8_t* contentData = getContentFrame();
NemoSdkAdaptor::getInstance()->putContentData(contentData);
API: createGLRender
示例:
// 创建GL渲染器
NemoSdkAdaptor::getInstance()->createGLRender();
API: drawGLFrame
参数:
frame
: 帧数据示例:
// 绘制GL帧
uint8_t* frameData = getFrameData();
NemoSdkAdaptor::getInstance()->drawGLFrame(frameData);
API: destoryGLRender
示例:
// 销毁GL渲染器
NemoSdkAdaptor::getInstance()->destoryGLRender();
API: getCloudConfig
示例:
// 获取云端配置
NemoSdkAdaptor::getInstance()->getCloudConfig();
API: setLowPerfMode
参数:
enabled
: 是否启用低性能模式示例:
// 启用低性能模式
NemoSdkAdaptor::getInstance()->setLowPerfMode(true);
API: getNemoSDKVersion
示例:
// 获取SDK版本信息
std::string version = NemoSdkAdaptor::getInstance()->getNemoSDKVersion();
class OtherFunctionManager {
private:
bool _isMediaTXEnabled = false;
bool _isLowPerfMode = false;
std::string _resourcePath = "./resources/";
public:
// 系统信息管理
void reportAppInfo(const std::string& appInfo) {
NemoSdkAdaptor::getInstance()->reportAppInfo(appInfo);
}
void reportCapability(const std::string& capability) {
NemoSdkAdaptor::getInstance()->reportCapability(capability);
}
void updateNetworkAddress() {
NemoSdkAdaptor::getInstance()->updateNetworkAddress();
}
// 文件管理
void downloadFile(const std::string& url, const std::string& savePath) {
NemoSdkAdaptor::getInstance()->downloadFile(url, savePath);
}
void cancelDownload() {
NemoSdkAdaptor::getInstance()->cancelDownload();
}
// 加密功能
std::string encryptData(const std::string& data, const std::string& key) {
return NemoSdkAdaptor::getInstance()->AESCTR_encrypt(data, key);
}
std::string decryptData(const std::string& data, const std::string& key) {
return NemoSdkAdaptor::getInstance()->AESCTR_decrypt(data, key);
}
void rsaEncrypt(const std::string& data, const std::string& publicKey) {
NemoSdkAdaptor::getInstance()->RSA_encrypt(data, publicKey);
}
// 外部媒体输入
void enableMediaTXConfig(bool enabled) {
_isMediaTXEnabled = enabled;
NemoSdkAdaptor::getInstance()->enableMeidiaTXConfig(enabled);
}
void inputExternalVideo(uint8_t* data, int width, int height) {
if (_isMediaTXEnabled) {
NemoSdkAdaptor::getInstance()->inputExternalVideoData(data, width, height);
}
}
void inputExternalAudio(uint8_t* data, int sampleRate) {
if (_isMediaTXEnabled) {
NemoSdkAdaptor::getInstance()->inputExternalAudioData(data, sampleRate);
}
}
void putContentData(uint8_t* data) {
NemoSdkAdaptor::getInstance()->putContentData(data);
}
// 渲染功能
void createGLRenderer() {
NemoSdkAdaptor::getInstance()->createGLRender();
}
void drawGLFrame(uint8_t* frame) {
NemoSdkAdaptor::getInstance()->drawGLFrame(frame);
}
void destroyGLRenderer() {
NemoSdkAdaptor::getInstance()->destoryGLRender();
}
// 配置管理
void getCloudConfig() {
NemoSdkAdaptor::getInstance()->getCloudConfig();
}
void setLowPerfMode(bool enabled) {
_isLowPerfMode = enabled;
NemoSdkAdaptor::getInstance()->setLowPerfMode(enabled);
}
std::string getSDKVersion() {
return NemoSdkAdaptor::getInstance()->getNemoSDKVersion();
}
// 回调处理
void onReportCapabilityResult(const XYString& code, const XYString& result) {
QString errCode(code.str());
QString resultStr(result.str());
if (errCode == SDKError_NoError) {
qDebug() << "Capability report successful:" << resultStr;
emit capabilityReportSuccess(resultStr);
} else {
qDebug() << "Capability report failed:" << errCode;
emit capabilityReportFailed(errCode);
}
}
void onDownloadStatusChanged(const XYString& status) {
QString statusStr(status.str());
qDebug() << "Download status:" << statusStr;
emit downloadStatusChanged(statusStr);
}
void onDownloadProgressChanged(const XYString& progress) {
QString progressStr(progress.str());
qDebug() << "Download progress:" << progressStr;
emit downloadProgressChanged(progressStr);
}
void onRSAEncrypt(const XYString& code, const XYString& result) {
QString errCode(code.str());
QString resultStr(result.str());
if (errCode == SDKError_NoError) {
qDebug() << "RSA encryption successful:" << resultStr;
emit rsaEncryptSuccess(resultStr);
} else {
qDebug() << "RSA encryption failed:" << errCode;
emit rsaEncryptFailed(errCode);
}
}
void onGetCloudConfig(const XYString& code, const XYString& config) {
QString errCode(code.str());
QString configStr(config.str());
if (errCode == SDKError_NoError) {
qDebug() << "Cloud config:" << configStr;
emit cloudConfigReceived(configStr);
} else {
qDebug() << "Get cloud config failed:" << errCode;
emit cloudConfigFailed(errCode);
}
}
// Getter方法
bool isMediaTXEnabled() const { return _isMediaTXEnabled; }
bool isLowPerfMode() const { return _isLowPerfMode; }
std::string getResourcePath() const { return _resourcePath; }
};
系统功能提供以下特性:
文件管理功能包括:
加密功能支持:
外部媒体输入功能:
渲染功能包括:
方法 | 描述 | 链接 |
上报App信息至服务端 | ||
更新IP和Mac地址 | ||
下载文件 | ||
取消下载文件 | ||
AES加密算法解密 | ||
AES加密算法加密 | ||
RSA加密 | ||
上报终端能力,做端适配云校验 | ||
配置媒体数据发送方式:可以自定义音视频输入源,开启之后之前UI自定义音视频数据输入源 | ||
输入content数据视频流 | ||
自定义外部视频输入源 | ||
自定义音频流输入 | ||
YUV转ARGB格式转换 | ||
创建原生GL着色器 | ||
销毁原生GL着色器 | ||
绘制GL帧 | ||
获取云控配置 | ||
设置低性能模式 | ||
获取SDK版本 | ||
获取企业国密状态 |
回调 | 描述 | 链接 |
上报终端能力结果回调 | ||
下载状态变化回调 | ||
下载进度变化回调 | ||
RSA加密结果回调 | ||
获取云控配置结果回调 | ||
获取国密状态结果回调 |