native_avscreen_capture.h

概述

声明用于构造屏幕录制对象的API。

库: libnative_avscreen_capture.so

引用文件: <multimedia/player_framework/native_avscreen_capture.h>

系统能力: SystemCapability.Multimedia.Media.AVScreenCapture

起始版本: 10

相关模块:AVScreenCapture

汇总

函数

名称 描述
struct OH_AVScreenCapture * OH_AVScreenCapture_Create (void) 实例化对象,创建OH_AVScreenCapture。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Init (struct OH_AVScreenCapture *capture, OH_AVScreenCaptureConfig config) 初始化OH_AVScreenCapture相关参数,包括下发的音频麦克风采样相关参数(可选),音频内录采样相关参数,视频分辨率相关参数。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCapture (struct OH_AVScreenCapture *capture) 开始录屏,采集原始码流。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCaptureWithSurface (struct OH_AVScreenCapture *capture, OHNativeWindow *window) 使用Surface模式录屏。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenCapture (struct OH_AVScreenCapture *capture) 结束录屏,与OH_AVScreenCapture_StartScreenCapture配合使用。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenRecording (struct OH_AVScreenCapture *capture) 启动录屏,调用此接口,可将录屏文件保存。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenRecording (struct OH_AVScreenCapture *capture) 停止录屏,与OH_AVScreenCapture_StartScreenRecording配合使用。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_AcquireAudioBuffer (struct OH_AVScreenCapture *capture, OH_AudioBuffer **audiobuffer, OH_AudioCaptureSourceType type) 获取音频buffer,应用在调用时,需要对audiobuffer分配对应结构体大小的内存,否则会影响音频buffer的获取。
OH_NativeBuffer * OH_AVScreenCapture_AcquireVideoBuffer (struct OH_AVScreenCapture *capture, int32_t *fence, int64_t *timestamp, struct OH_Rect *region) 获取视频buffer,应用在调用时,通过此接口来获取到视频的buffer以及时间戳等信息。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseAudioBuffer (struct OH_AVScreenCapture *capture, OH_AudioCaptureSourceType type) 根据音频类型释放buffer。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseVideoBuffer (struct OH_AVScreenCapture *capture) 根据视频类型释放buffer。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCallback (struct OH_AVScreenCapture *capture, struct OH_AVScreenCaptureCallback callback) 设置监听接口,通过设置监听,可以监听到调用过程中的错误信息,以及是否有可用的视频buffer和音频buffer。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Release (struct OH_AVScreenCapture *capture) 释放创建的OH_AVScreenCapture实例,对应OH_AVScreenCapture_Create。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMicrophoneEnabled (struct OH_AVScreenCapture *capture, bool isMicrophone) 设置麦克风开关。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetStateCallback (struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnStateChange callback, void *userData) 设置状态变更处理回调方法,在开始录制前调用。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDataCallback (struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnBufferAvailable callback, void *userData) 设置数据处理回调方法,在开始录制前调用。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetErrorCallback (struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnError callback, void *userData) 设置错误处理回调方法,在开始录制前调用。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCanvasRotation (struct OH_AVScreenCapture *capture, bool canvasRotation) 设置录屏屏幕数据旋转。
struct OH_AVScreenCapture_ContentFilter * OH_AVScreenCapture_CreateContentFilter (void) 创建ContentFilter。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseContentFilter (struct OH_AVScreenCapture_ContentFilter *filter) 释放ContentFilter。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddAudioContent (struct OH_AVScreenCapture_ContentFilter *filter, OH_AVScreenCaptureFilterableAudioContent content) 向ContentFilter实例添加可被过滤的声音类型。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ExcludeContent (struct OH_AVScreenCapture *capture, struct OH_AVScreenCapture_ContentFilter *filter) 向OH_AVScreenCapture实例设置内容过滤器ContentFilter。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddWindowContent (struct OH_AVScreenCapture_ContentFilter *filter, int32_t *windowIDs, int32_t windowCount) 向ContentFilter实例添加可被过滤的窗口ID列表。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ResizeCanvas (struct OH_AVScreenCapture *capture, int32_t width, int32_t height) 调整屏幕的分辨率。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SkipPrivacyMode (struct OH_AVScreenCapture *capture, int32_t *windowIDs, int32_t windowCount) 录屏时豁免隐私窗口。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMaxVideoFrameRate (struct OH_AVScreenCapture *capture, int32_t frameRate) 设置录屏的最大帧率。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ShowCursor (struct OH_AVScreenCapture *capture, bool showCursor) 设置光标显示开关。
OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDisplayCallback (struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnDisplaySelected callback, void *userData) 设置获取录屏屏幕Id的回调。