# 结构体 (/zh-CN/api-reference/local-server-recording/cpp/struct) > For AI agents: see the complete documentation index at [llms.txt](/llms.txt). ## AgoraServiceConfiguration [#agoraserviceconfiguration] ```cpp struct AgoraServiceConfiguration { bool enableAudioProcessor; bool enableAudioDevice; bool enableVideo; void* context; const char* appId; unsigned int areaCode; agora::CHANNEL_PROFILE_TYPE channelProfile; const char* license; rtc::AUDIO_SCENARIO_TYPE audioScenario; commons::LogConfig logConfig; bool useStringUid; IServiceObserver* serviceObserver; Optional threadPriority __deprecated; bool useExternalEglContext; bool domainLimit; AgoraServiceConfiguration() : enableAudioProcessor(true), enableAudioDevice(true), enableVideo(false), context(NULL), appId(NULL), areaCode(rtc::AREA_CODE_GLOB), channelProfile(agora::CHANNEL_PROFILE_LIVE_BROADCASTING), license(NULL), audioScenario(rtc::AUDIO_SCENARIO_DEFAULT), useStringUid(false), serviceObserver(NULL), useExternalEglContext(false), domainLimit(false){} }; ``` 用于配置 [`IAgoraService`](/zh-CN/api-reference/local-server-recording/cpp/iagoraservice.cpp) 的全局参数。 调用 [`initialize`](/zh-CN/api-reference/local-server-recording/cpp/iagoramediartcrecorder.cpp#initialize) 时设置这些参数。 #### 成员参数 [#成员参数] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `enableAudioProcessor` | `bool` | [struct-cpp-html-0-1-2 details](#table-slot-struct-cpp-html-0-1-2) | | `enableAudioDevice` | `bool` | [struct-cpp-html-0-2-2 details](#table-slot-struct-cpp-html-0-2-2) | | `enableVideo` | `bool` | [struct-cpp-html-0-3-2 details](#table-slot-struct-cpp-html-0-3-2) | | `appId` | `const char*` | 项目的 App ID。 | | `areaCode` | `unsigned int` | 支持的区域码,默认值为 `AREA_CODE_GLOB`。 | | `channelProfile` | `agora::CHANNEL_PROFILE_TYPE` | 频道场景。详见 [`CHANNEL_PROFILE_TYPE`](/zh-CN/api-reference/local-server-recording/cpp/enum#channel_profile_type)。 | | `license` | `const char*` | 连接频道时用于验证的 License。根据 License 收费。 | | `audioScenario` | `rtc::AUDIO_SCENARIO_TYPE` | 音频场景。详见 [`AUDIO_SCENARIO_TYPE`](/zh-CN/api-reference/local-server-recording/cpp/enum#audio_scenario_type)。 | | `logConfig` | `commons::LogConfig` | 日志配置。用于设置日志路径、日志大小和日志级别。详见 [`LogConfig`](/zh-CN/api-reference/local-server-recording/cpp/struct#logconfig)。 | | `useStringUid` | `bool` | [struct-cpp-html-0-10-2 details](#table-slot-struct-cpp-html-0-10-2) | | `domainLimit` | `bool` | [struct-cpp-html-0-11-2 details](#table-slot-struct-cpp-html-0-11-2) | **struct-cpp-html-0-1-2 details** 是否启用音频处理模块。 - `true`:(默认)启用音频处理模块。 - `false`:禁用音频处理模块。禁用后无法创建音频轨道。 **struct-cpp-html-0-2-2 details** 是否启用音频设备模块。 - `true`:(默认)启用音频设备模块。 - `false`:禁用音频设备模块。 :::warning[注意] 在录制场景中,请确保将 `enableAudioDevice` 设置为 `false`。如果设置为 `true`,SDK 会报错,因为录制器实例没有任何音频设备。 ::: **struct-cpp-html-0-3-2 details** 是否启用视频。 - `true`:启用视频。 - `false`:(默认)禁用视频。 **struct-cpp-html-0-10-2 details** 是否启用字符串类型的用户 ID。 - `true`:启用字符串类型的用户 ID。 - `false`:(默认)不启用字符串类型的用户 ID。 **struct-cpp-html-0-11-2 details** 是否启用域名限制。 - `true`:仅连接已通过 DNS 解析的服务器。 - `false`:(默认)连接服务器时不做限制。 ## VideoSubscriptionOptions [#videosubscriptionoptions] ```cpp struct VideoSubscriptionOptions { Optional type; Optional encodedFrameOnly; }; ``` 用于设置视频订阅选项。 #### 成员参数 [#成员参数-1] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `type` | `Optional` | [struct-cpp-html-1-1-2 details](#table-slot-struct-cpp-html-1-1-2) | | `encodedFrameOnly` | `Optional` | [struct-cpp-html-1-2-2 details](#table-slot-struct-cpp-html-1-2-2) | **struct-cpp-html-1-1-2 details** 要订阅的视频流类型,详见 [`VIDEO_STREAM_TYPE`](/zh-CN/api-reference/local-server-recording/cpp/enum#video_stream_type)。 - 默认值为 `VIDEO_STREAM_HIGH`,表示高质量视频流。 **struct-cpp-html-1-2-2 details** 是否仅订阅编码后的视频数据: - `true`:仅订阅编码后的视频数据。 - `false`:(默认)订阅解码后的视频数据。 :::warning[注意] 在涉及视频帧采集的场景中,如果你希望采集 YUV 帧、JPF 帧或 JPG 文件,请确保将该参数设置为 `false`。 ::: ## Rectangle [#rectangle] ```cpp struct Rectangle { int x; int y; int width; int height; Rectangle() : x(0), y(0), width(0), height(0) {} Rectangle(int xx, int yy, int ww, int hh) : x(xx), y(yy), width(ww), height(hh) {} }; ``` 设置目标区域相对于屏幕或窗口的位置。 如果未设置该参数,SDK 会选择整个屏幕或窗口。 #### 成员参数 [#成员参数-2] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `x` | `int` | 从左上角起的水平偏移量。 | | `y` | `int` | 从左上角起的垂直偏移量。 | | `width` | `int` | 区域的宽度。 | | `height` | `int` | 区域的高度。 | ## WatermarkRatio [#watermarkratio] ```cpp struct WatermarkRatio { float xRatio; float yRatio; float widthRatio; WatermarkRatio() : xRatio(0.0), yRatio(0.0), widthRatio(0.0) {} WatermarkRatio(float x, float y, float width) : xRatio(x), yRatio(y), widthRatio(width) {} }; ``` 用于设置水印在屏幕上的位置和大小。 [`WatermarkRatio`](/zh-CN/api-reference/local-server-recording/cpp/struct#watermarkratio) 用于设置水印在屏幕上的位置和大小。 - (`xRatio`, `yRatio`) 表示水印左上角的坐标,决定水印左上角相对于屏幕左上角的距离。 - `widthRatio` 表示水印的宽度,SDK 会根据该值按比例计算水印高度,确保图像不失真。 #### 成员参数 [#成员参数-3] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `xRatio` | `float` | 水平方向上水印左上角的位置。以屏幕左上角为原点,表示水印左上角相对于原点的水平距离。取值范围为 [0.0, 1.0]。 | | `yRatio` | `float` | 垂直方向上水印左上角的位置。以屏幕左上角为原点,表示水印左上角相对于原点的垂直距离。取值范围为 [0.0, 1.0]。 | | `widthRatio` | `float` | 水印的宽度。SDK 会根据该值按比例计算水印的高度,以保证缩放后图像不失真。取值范围为 [0.0, 1.0]。默认值为 0,表示不显示水印。 | ## WatermarkOptions [#watermarkoptions] ```cpp struct WatermarkOptions { bool visibleInPreview; Rectangle positionInLandscapeMode; Rectangle positionInPortraitMode; WatermarkRatio watermarkRatio; WATERMARK_FIT_MODE mode; int zOrder; WatermarkOptions() : visibleInPreview(true), positionInLandscapeMode(0, 0, 0, 0), positionInPortraitMode(0, 0, 0, 0), mode(FIT_MODE_COVER_POSITION), zOrder(0) {} }; ``` 用于配置水印图像的显示、位置和适配方式。 #### 成员参数 [#成员参数-4] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `visibleInPreview` | `bool` | [struct-cpp-html-4-1-2 details](#table-slot-struct-cpp-html-4-1-2) | | `positionInLandscapeMode` | `Rectangle` | 当水印的适配模式为 `FIT_MODE_COVER_POSITION` 时,用于设置水印图像在横屏模式下的位置区域。详见 [`Rectangle`](/zh-CN/api-reference/local-server-recording/cpp/struct#rectangle)。 | | `positionInPortraitMode` | `Rectangle` | 当水印的适配模式为 `FIT_MODE_COVER_POSITION` 时,用于设置水印图像在竖屏模式下的位置区域。详见 [`Rectangle`](/zh-CN/api-reference/local-server-recording/cpp/struct#rectangle)。 | | `watermarkRatio` | `WatermarkRatio` | 当水印的适配模式为 `FIT_MODE_USE_IMAGE_RATIO` 时,用于设置水印的坐标。详见 [`WatermarkRatio`](/zh-CN/api-reference/local-server-recording/cpp/struct#watermarkratio)。 | | `mode` | `WATERMARK_FIT_MODE` | 水印的适配模式。详见 [`WATERMARK_FIT_MODE`](/zh-CN/api-reference/local-server-recording/cpp/enum#watermark_fit_mode)。 | | `zOrder` | `int` | 水印图像的图层顺序,默认值为 0。 | **struct-cpp-html-4-1-2 details** 水印图像在本地视频预览中是否可见: - `true`:(默认)水印图像在预览中可见。 - `false`:水印图像在预览中不可见。 ## WatermarkTimestamp [#watermarktimestamp] ```cpp struct WatermarkTimestamp { int fontSize; const char* fontFilePath; WatermarkTimestamp() : fontSize(10), fontFilePath(NULL) {} }; ``` 用于设置时间戳水印的字体大小和字体文件路径。 #### 成员参数 [#成员参数-5] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `fontSize` | `int` | `timestamp` 的字体大小。默认值为 10。 | | `fontFilePath` | `const char*` | `timestamp` 字体文件的路径。默认值为 `NULL`,表示使用系统默认字体。 | ## WatermarkLitera [#watermarklitera] ```cpp struct WatermarkLitera { const char* wmLitera; const char* fontFilePath; int fontSize; WatermarkLitera() : wmLitera(NULL), fontFilePath(NULL), fontSize(10) {} }; ``` 用于设置水印文字的内容、字体路径和字体大小。 #### 成员参数 [#成员参数-6] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `wmLitera` | `const char*` | [`WatermarkLitera`](/zh-CN/api-reference/local-server-recording/cpp/struct#watermarklitera) 中的水印文字内容。默认值为 `NULL`。 | | `fontFilePath` | `const char*` | 水印文字所使用的字体文件路径。默认值为 `NULL`,表示使用系统默认字体。 | | `fontSize` | `int` | 水印文字的字体大小。默认值为 10。 | ## WatermarkConfig [#watermarkconfig] ```cpp struct WatermarkConfig { int index; WatermarkSourceType type; WatermarkTimestamp timestampSource; WatermarkLitera literaSource; const char* imageUrl; WatermarkOptions options; WatermarkConfig() : index(0), type(PICTURE), imageUrl(NULL) {} }; ``` 用于配置水印参数。 #### 成员参数 [#成员参数-7] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `index` | `int` | 水印索引,默认值为 0。 | | `type` | `WatermarkSourceType` | 水印来源类型。详见 [`WatermarkSourceType`](/zh-CN/api-reference/local-server-recording/cpp/enum#watermarksourcetype)。 | | `timestampSource` | `WatermarkTimestamp` | 水印时间戳。详见 [`WatermarkTimestamp`](/zh-CN/api-reference/local-server-recording/cpp/struct#watermarktimestamp)。 | | `literaSource` | `WatermarkLitera` | 水印文字内容。详见 [`WatermarkLitera`](/zh-CN/api-reference/local-server-recording/cpp/struct#watermarklitera)。 | | `imageUrl` | `const char*` | 水印图片文件的 URL,默认值为 NULL。 | | `options` | `WatermarkOptions` | 水印的选项配置。详见 [`WatermarkOptions`](/zh-CN/api-reference/local-server-recording/cpp/struct#watermarkoptions)。 | ## EncryptionConfig [#encryptionconfig] ```cpp struct EncryptionConfig { ENCRYPTION_MODE encryptionMode; const char* encryptionKey; uint8_t encryptionKdfSalt[32]; bool datastreamEncryptionEnabled; EncryptionConfig() : encryptionMode(AES_128_GCM2), encryptionKey(OPTIONAL_NULLPTR), datastreamEncryptionEnabled(false) { memset(encryptionKdfSalt, 0, sizeof(encryptionKdfSalt)); } const char* getEncryptionString() const { switch (encryptionMode) { case AES_128_XTS: return "aes-128-xts"; case AES_128_ECB: return "aes-128-ecb"; case AES_256_XTS: return "aes-256-xts"; case SM4_128_ECB: return "sm4-128-ecb"; case AES_128_GCM: return "aes-128-gcm"; case AES_256_GCM: return "aes-256-gcm"; case AES_128_GCM2: return "aes-128-gcm-2"; case AES_256_GCM2: return "aes-256-gcm-2"; default: return "aes-128-gcm-2"; } return "aes-128-gcm-2"; } }; ``` 用于配置内建加密功能。 #### 成员参数 [#成员参数-8] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `encryptionMode` | `ENCRYPTION_MODE` | 内建加密模式。声网建议使用 `AES_128_GCM2` 或 `AES_256_GCM2` 加密模式,这两种模式支持使用 salt 以提高安全性。详见 [`ENCRYPTION_MODE`](/zh-CN/api-reference/local-server-recording/cpp/enum#encryption_mode)。 | | `encryptionKey` | `const char*` | [struct-cpp-html-8-2-2 details](#table-slot-struct-cpp-html-8-2-2) | | `encryptionKdfSalt` | `uint8_t[32]` | [struct-cpp-html-8-3-2 details](#table-slot-struct-cpp-html-8-3-2) | | `datastreamEncryptionEnabled` | `bool` | [struct-cpp-html-8-4-2 details](#table-slot-struct-cpp-html-8-4-2) | **struct-cpp-html-8-2-2 details** 字符串类型的加密密钥,长度不受限制。声网建议使用 32 字节的密钥。 :::warning[注意] 如果未设置加密密钥或将其设置为 NULL,则无法使用内建加密,SDK 会返回 `ERR_INVALID_ARGUMENT`(-2)。 ::: **struct-cpp-html-8-3-2 details** Salt,长度为 32 字节。声网建议你在服务器端使用 OpenSSL 生成。 :::warning[注意] 该参数仅在 `AES_128_GCM2` 或 `AES_256_GCM2` 加密模式下生效。在这种情况下,请确保该参数不为 0。 ::: **struct-cpp-html-8-4-2 details** 是否启用数据流加密。 - `true`:启用数据流加密。 - `false`:(默认)不启用数据流加密。 ## LogUploadServerInfo [#loguploadserverinfo] ```cpp struct LogUploadServerInfo { const char* serverDomain; const char* serverPath; int serverPort; bool serverHttps; LogUploadServerInfo() : serverDomain(NULL), serverPath(NULL), serverPort(0), serverHttps(true) {} LogUploadServerInfo(const char* domain, const char* path, int port, bool https) : serverDomain(domain), serverPath(path), serverPort(port), serverHttps(https) {} }; ``` [`LogUploadServerInfo`](/zh-CN/api-reference/local-server-recording/cpp/struct#loguploadserverinfo) 用于配置日志上传服务器的信息。 #### 成员参数 [#成员参数-9] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `serverDomain` | `const char*` | 日志上传服务器的域名。 | | `serverPath` | `const char*` | 日志上传服务器的路径。 | | `serverPort` | `int` | 日志上传服务器的端口号。 | | `serverHttps` | `bool` | [struct-cpp-html-9-4-2 details](#table-slot-struct-cpp-html-9-4-2) | **struct-cpp-html-9-4-2 details** 是否使用 HTTPS 请求: - `true`:使用 HTTPS 请求。 - `false`:使用 HTTP 请求。 ## AdvancedConfigInfo [#advancedconfiginfo] ```cpp struct AdvancedConfigInfo { LogUploadServerInfo logUploadServer; }; ``` 高级配置信息。 #### 成员参数 [#成员参数-10] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `logUploadServer` | `LogUploadServerInfo` | 日志上传服务器信息。详见 [`LogUploadServerInfo`](/zh-CN/api-reference/local-server-recording/cpp/struct#loguploadserverinfo)。 | ## LocalAccessPointConfiguration [#localaccesspointconfiguration] ```cpp struct LocalAccessPointConfiguration { const char** ipList; int ipListSize; const char** domainList; int domainListSize; const char* verifyDomainName; LOCAL_PROXY_MODE mode; AdvancedConfigInfo advancedConfig; bool disableAut; LocalAccessPointConfiguration() : ipList(NULL), ipListSize(0), domainList(NULL), domainListSize(0), verifyDomainName(NULL), mode(ConnectivityFirst), disableAut(true) {} }; ``` 配置本地接入点的连接信息。 #### 成员参数 [#成员参数-11] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `ipList` | `const char**` | 本地接入点的 IP 地址列表。 | | `ipListSize` | `int` | 本地接入点 IP 地址的数量。 | | `domainList` | `const char**` | 本地接入点的域名列表。 | | `domainListSize` | `int` | 本地接入点域名的数量。 | | `verifyDomainName` | `const char*` | 安装在特定本地接入点上的证书域名。传入空字符串 "" 表示使用该接入点上的 SNI(Server Name Indication)域名。SNI 是 TLS 协议的扩展。 | | `mode` | `LOCAL_PROXY_MODE` | 本地代理连接模式。详见 [`LOCAL_PROXY_MODE`](/zh-CN/api-reference/local-server-recording/cpp/enum#local_proxy_mode)。 | | `advancedConfig` | `AdvancedConfigInfo` | 本地代理连接的高级配置信息。详见 [`AdvancedConfigInfo`](/zh-CN/api-reference/local-server-recording/cpp/struct#advancedconfiginfo)。 | | `disableAut` | `bool` | [struct-cpp-html-11-8-2 details](#table-slot-struct-cpp-html-11-8-2) | **struct-cpp-html-11-8-2 details** 是否禁用 `vos-aut`: - `true`:(默认)禁用 `vos-aut`。 - `false`:不禁用 `vos-aut`。 ## EncodedVideoFrameInfo [#encodedvideoframeinfo] ```cpp struct EncodedVideoFrameInfo { uid_t uid; VIDEO_CODEC_TYPE codecType; int width; int height; int framesPerSecond; VIDEO_FRAME_TYPE frameType; VIDEO_ORIENTATION rotation; int trackId; int64_t captureTimeMs; int64_t decodeTimeMs; VIDEO_STREAM_TYPE streamType; int64_t presentationMs; }; ``` 描述外部编码视频帧的信息。 #### 成员参数 [#成员参数-12] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `codecType` | `VIDEO_CODEC_TYPE` | 本地视频流的编解码器类型。详见 [`VIDEO_CODEC_TYPE`](/zh-CN/api-reference/local-server-recording/cpp/enum#video_codec_type)。 | | `width` | `int` | 视频帧的宽度(像素)。 | | `height` | `int` | 视频帧的高度(像素)。 | ## MixerLayoutConfig [#mixerlayoutconfig] ```cpp struct MixerLayoutConfig { int32_t x; int32_t y; int32_t width; int32_t height; int32_t zOrder; float alpha; bool mirror; const char* image_path; int rotation; MixerLayoutConfig() : x(0), y(0), width(0), height(0), zOrder(0), alpha(1.0), mirror(false), image_path(NULL),rotation(0) {} MixerLayoutConfig(int ox, int oy, int w, int h, int order) : x(ox), y(oy), width(w), height(h), zOrder(order), alpha(1.0), mirror(false), image_path(NULL), rotation(0) {} }; ``` 用于配置混合视频流中的视频区域布局。 #### 成员参数 [#成员参数-13] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `x` | `int32_t` | 混合视频流中视频区域左上角的 x 坐标。 | | `y` | `int32_t` | 混合视频流中视频区域左上角的 y 坐标。 | | `width` | `int32_t` | 混合视频流中视频区域的宽度。 | | `height` | `int32_t` | 混合视频流中视频区域的高度。 | | `zOrder` | `int32_t` | 混合视频流中视频区域的图层顺序。值越大,图层越靠上。 | | `alpha` | `float` | 混合视频流中视频区域的透明度。 | | `mirror` | `bool` | [struct-cpp-html-13-7-2 details](#table-slot-struct-cpp-html-13-7-2) | | `image_path` | `const char*` | 占位图的 URL 地址。 | | `rotation` | `int` | [struct-cpp-html-13-9-2 details](#table-slot-struct-cpp-html-13-9-2) | **struct-cpp-html-13-7-2 details** 是否镜像混合视频流中的视频区域。 - `true`:镜像视频区域。 - `false`:不镜像视频区域。 **struct-cpp-html-13-9-2 details** 混合视频流中视频区域的旋转角度。 - `0`:不旋转。 - `1`:顺时针旋转 90°。 - `2`:顺时针旋转 180°。 - `3`:顺时针旋转 270°。 ## MediaRecorderConfiguration [#mediarecorderconfiguration] ```cpp struct MediaRecorderConfiguration { const char* storagePath; MediaRecorderContainerFormat containerFormat; MediaRecorderStreamType streamType; int maxDurationMs; int recorderInfoUpdateInterval; int width; int height; int fps; int sample_rate; int channel_num; agora::rtc::VIDEO_SOURCE_TYPE videoSourceType; MediaRecorderConfiguration() : storagePath(NULL), containerFormat(FORMAT_MP4), streamType(STREAM_TYPE_BOTH), maxDurationMs(120000), recorderInfoUpdateInterval(0), width(1280), height(720), fps(30), sample_rate(48000), channel_num(1), videoSourceType(rtc::VIDEO_SOURCE_CAMERA_PRIMARY) {} MediaRecorderConfiguration(const char* path, MediaRecorderContainerFormat format, MediaRecorderStreamType type, int duration, int interval) : storagePath(path), containerFormat(format), streamType(type), maxDurationMs(duration), recorderInfoUpdateInterval(interval), width(1280), height(720), fps(30), sample_rate(48000), channel_num(1), videoSourceType(rtc::VIDEO_SOURCE_CAMERA_PRIMARY) {} }; ``` 配置本地音视频录制。 #### 成员参数 [#成员参数-14] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `storagePath` | `const char*` | [struct-cpp-html-14-1-2 details](#table-slot-struct-cpp-html-14-1-2) | | `containerFormat` | `MediaRecorderContainerFormat` | 录制文件的格式。详见 [`MediaRecorderContainerFormat`](/zh-CN/api-reference/local-server-recording/cpp/enum#mediarecordercontainerformat)。 | | `streamType` | `MediaRecorderStreamType` | 录制内容类型。详见 [`MediaRecorderStreamType`](/zh-CN/api-reference/local-server-recording/cpp/enum#mediarecorderstreamtype)。 | | `maxDurationMs` | `int` | 最大录制时长,单位为毫秒。默认值为 120000。 | | `recorderInfoUpdateInterval` | `int` | 录制信息更新的时间间隔,单位为毫秒。取值范围为 [1000, 10000]。根据该值,SDK 会触发 [`onRecorderInfoUpdated`](/zh-CN/api-reference/local-server-recording/cpp/iagoramediartcrecordereventhandler#onrecorderinfoupdated) 回调报告录制信息更新。 | | `width` | `int` | 视频宽度。 | | `height` | `int` | 视频高度。 | | `fps` | `int` | 视频帧率。 | | `sample_rate` | `int` | 音频采样率。 | | `channel_num` | `int` | 音频声道数。 | | `videoSourceType` | `agora::rtc::VIDEO_SOURCE_TYPE` | 仅用于外部频道录制的视频源类型。详见 [`VIDEO_SOURCE_TYPE`](/zh-CN/api-reference/local-server-recording/cpp/enum#video_source_type)。 | **struct-cpp-html-14-1-2 details** 录制文件的绝对路径(包括文件扩展名)。例如,在 Windows 上为 `C:\Users\\AppData\Local\Agora\\example.mp4`,在 iOS 上为 `/App Sandbox/Library/Caches/example.mp4`,在 macOS 上为 `/Library/Logs/example.mp4`,在 Android 上为 `/storage/emulated/0/Android/data//files/example.mp4`。 :::warning[注意] 请确保指定路径存在且可写。 ::: ## RecorderInfo [#recorderinfo] ```cpp struct RecorderInfo { const char* fileName; unsigned int durationMs; unsigned int fileSize; RecorderInfo() : fileName(NULL), durationMs(0), fileSize(0) {} RecorderInfo(const char* name, unsigned int dur, unsigned int size) : fileName(name), durationMs(dur), fileSize(size) {} }; ``` 录制文件的信息。 #### 成员参数 [#成员参数-15] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `fileName` | `const char*` | 录制文件的绝对路径。 | | `durationMs` | `unsigned int` | 录制时长,单位为毫秒。 | | `fileSize` | `unsigned int` | 录制文件的大小,单位为字节。 | ## VideoFrame [#videoframe] ```cpp struct VideoFrame { VIDEO_PIXEL_FORMAT type; int width; int height; int yStride; int uStride; int vStride; uint8_t* yBuffer; uint8_t* uBuffer; uint8_t* vBuffer; int rotation; int64_t renderTimeMs; int avsync_type; uint8_t* metadata_buffer; int metadata_size; void* sharedContext; int textureId; void* d3d11Texture2d; float matrix[16]; uint8_t* alphaBuffer; ALPHA_STITCH_MODE alphaStitchMode; void* pixelBuffer; IVideoFrameMetaInfo* metaInfo; Hdr10MetadataInfo hdr10MetadataInfo; ColorSpace colorSpace; }; ``` 用于描述视频帧的相关参数信息。 #### 成员参数 [#成员参数-16] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `type` | `VIDEO_PIXEL_FORMAT` | 视频像素格式。详见 [`VIDEO_PIXEL_FORMAT`](/zh-CN/api-reference/local-server-recording/cpp/enum#video_pixel_format)。 | | `width` | `int` | 视频帧的宽度。 | | `height` | `int` | 视频帧的高度。 | | `yStride` | `int` | YUV 数据中 Y 缓冲区的行跨度。 | | `uStride` | `int` | YUV 数据中 U 缓冲区的行跨度。 | | `vStride` | `int` | YUV 数据中 V 缓冲区的行跨度。 | | `yBuffer` | `uint8_t*` | 输出参数,表示 YUV 数据中 Y 缓冲区的指针。 | | `uBuffer` | `uint8_t*` | 输出参数,表示 YUV 数据中 U 缓冲区的指针。 | | `vBuffer` | `uint8_t*` | 输出参数,表示 YUV 数据中 V 缓冲区的指针。 | ## LogConfig [#logconfig] ```cpp struct LogConfig { const char* filePath; uint32_t fileSizeInKB; LOG_LEVEL level; LogConfig() : filePath(NULL), fileSizeInKB(DEFAULT_LOG_SIZE_IN_KB), level(OPTIONAL_LOG_LEVEL_SPECIFIER LOG_LEVEL_INFO) {} }; ``` 日志配置。 #### 成员参数 [#成员参数-17] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `filePath` | `const char*` | 日志文件路径。默认为 `NULL`,表示使用默认路径。 | | `fileSizeInKB` | `uint32_t` | 日志文件大小,单位为 KB。设置为 2048 表示使用默认大小。 | | `level` | `LOG_LEVEL` | 日志级别。设置为 `LOG_LEVEL_INFO` 表示使用默认级别。详见 [`LOG_LEVEL`](/zh-CN/api-reference/local-server-recording/cpp/enum#log_level)。 | ## UserMixerLayout [#usermixerlayout] ```cpp struct UserMixerLayout { user_id_t userId; MixerLayoutConfig config; }; ``` 用于设置用户视频流在合流视频中的布局。 #### 成员参数 [#成员参数-18] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `userId` | `user_id_t` | 要进行合流的视频流所属用户的用户 ID。 | | `config` | `MixerLayoutConfig` | 该用户视频流在合流视频中的布局配置,详见 [`MixerLayoutConfig`](/zh-CN/api-reference/local-server-recording/cpp/struct#mixerlayoutconfig)。 | ## VideoMixingLayout [#videomixinglayout] ```cpp struct VideoMixingLayout { int canvasWidth; int canvasHeight; int canvasFps; uint32_t backgroundColor; const char* backgroundImage; uint32_t userLayoutConfigNum; const UserMixerLayout* userLayoutConfigs; }; ``` 混合视频流的布局配置。 #### 成员参数 [#成员参数-19] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `canvasWidth` | `int` | 混合视频流画布的宽度,单位为像素。 | | `canvasHeight` | `int` | 混合视频流画布的高度,单位为像素。 | | `canvasFps` | `int` | 混合视频流的帧率(FPS)。 | | `backgroundColor` | `uint32_t` | 混合视频流的背景颜色。使用 RGB 十六进制数值表示,不包含前缀 #。例如:0xFFB6C1 表示浅粉色。默认值为 0x000000(黑色)。 | | `backgroundImage` | `const char*` | 混合视频流的背景图像路径。默认值为 NULL,表示无背景图像。若设置该参数,图像格式必须为 PNG 或 JPG。 | | `userLayoutConfigNum` | `uint32_t` | 混合视频流中用户布局的数量。 | | `userLayoutConfigs` | `const UserMixerLayout*` | 用户布局配置数组。详见 [`UserMixerLayout`](/zh-CN/api-reference/local-server-recording/cpp/struct#usermixerlayout)。 | ## RecorderVideoFrameCaptureConfig [#recordervideoframecaptureconfig] ```cpp struct RecorderVideoFrameCaptureConfig { VideoFrameCaptureType videoFrameType; const char* jpgFileStorePath; int jpgCaptureIntervalInSec; IRecorderVideoFrameObserver* observer; }; ``` 用于配置录制器的视频帧采集参数。 #### 成员参数 [#成员参数-20] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `videoFrameType` | `VideoFrameCaptureType` | 视频帧采集类型。详见 [`VideoFrameCaptureType`](/zh-CN/api-reference/local-server-recording/cpp/enum#videoframecapturetype)。 | | `jpgFileStorePath` | `const char*` | [struct-cpp-html-20-2-2 details](#table-slot-struct-cpp-html-20-2-2) | | `jpgCaptureIntervalInSec` | `int` | JPG 视频帧采集的时间间隔,单位为秒。适用于 `VIDEO_FORMAT_JPG_FILE_TYPE` 和 `VIDEO_FORMAT_JPG_FRAME_TYPE`。最小值为 1,默认值为 5。 | | `observer` | `IRecorderVideoFrameObserver*` | 录制器视频帧观察者对象。详见 [`IRecorderVideoFrameObserver`](/zh-CN/api-reference/local-server-recording/cpp/irecordervideoframeobserver)。 | **struct-cpp-html-20-2-2 details** 指定保存 JPG 文件的目录的绝对路径。当 `videoFrameType` 设置为 `VIDEO_FORMAT_JPG_FILE_TYPE` 且 `jpgFileStorePath` 不为空时,JPG 文件将保存到该目录。文件名格式为:"channelId_userId_YYYYMMDDHHMMSS_MS.jpg"。 :::warning[注意] - 请确保在采集 `VIDEO_FORMAT_JPG_FILE_TYPE` 时设置该参数,否则不会采集 JPG 文件。 - 请确保指定的目录已存在且可写。 ::: ## RemoteVideoStatistics [#remotevideostatistics] ```cpp struct RemoteVideoStatistics { int delay; int width; int height; int receivedBitrate; int decoderOutputFrameRate; VIDEO_STREAM_TYPE rxStreamType; }; ``` 远端视频统计信息。 #### 成员参数 [#成员参数-21] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `delay` | `int` | 视频帧的整体延迟(毫秒)。 | | `width` | `int` | 远端视频轨道的宽度(像素)。 | | `height` | `int` | 远端视频轨道的高度(像素)。 | | `receivedBitrate` | `int` | 统计周期内接收到的码率(Kbps)。 | | `decoderOutputFrameRate` | `int` | 远端视频轨道的解码器输出帧率(fps)。 | | `rxStreamType` | `VIDEO_STREAM_TYPE` | 远端视频流类型。详见 [`VIDEO_STREAM_TYPE`](/zh-CN/api-reference/local-server-recording/cpp/enum#video_stream_type)。 | ## RemoteAudioStatistics [#remoteaudiostatistics] ```cpp struct RemoteAudioStatistics { int quality; int networkTransportDelay; int jitterBufferDelay; int audioLossRate; }; ``` 远端音频的统计信息。 #### 成员参数 [#成员参数-22] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `quality` | `int` | 远端音频轨道的音频质量。详见 [`QUALITY_TYPE`](/zh-CN/api-reference/local-server-recording/cpp/enum#quality_type)。 | | `networkTransportDelay` | `int` | 从发送端到接收端的网络传输延迟,单位为毫秒。 | | `jitterBufferDelay` | `int` | 从接收端到抖动缓冲区的延迟,单位为毫秒。 | | `audioLossRate` | `int` | 在统计时间间隔内的音频帧丢失率。 | ## SpeakVolumeInfo [#speakvolumeinfo] ```cpp struct SpeakVolumeInfo { user_id_t userId; unsigned int volume; }; ``` 表示说话者的音量信息。 #### 成员参数 [#成员参数-23] | 参数 | 数据类型 | 描述 | | --- | --- | --- | | `userId` | `user_id_t` | 说话者的用户 ID。 | | `volume` | `unsigned int` | 说话者的音量,范围为 0 到 255。 |