7 #pragma once // NOLINT(build/header_guard)
10 #include "IAgoraLog.h"
11 #include "AgoraRefPtr.h"
12 #include "NGIAgoraVideoFrame.h"
13 #include "AgoraMediaBase.h"
14 #if defined(WEBRTC_IOS)
15 #include <coreVideo/CVPixelBuffer.h>
22 uint32_t captured_frame_width;
23 uint32_t captured_frame_height;
24 uint32_t total_captured_frames;
25 uint64_t per_frame_cap_time_ms;
26 uint64_t per_capture_cpu_cycles;
27 bool capture_mouse_cursor;
29 uint32_t real_capture_fps;
30 uint32_t capture_out_fps;
34 : capture_type(-1), captured_frame_width(0), captured_frame_height(0),
35 total_captured_frames(0), per_frame_cap_time_ms(0),
36 per_capture_cpu_cycles(0), capture_mouse_cursor(
true),
37 target_fps(0), real_capture_fps(0),
38 capture_out_fps(0), drop_fps(0) {}
45 virtual int postEvent(
const char* key,
const char* value) = 0;
46 virtual void printLog(commons::LOG_LEVEL level,
const char* format, ...) = 0;
47 virtual void printLog(commons::LOG_LEVEL level,
const char* fromat, va_list) = 0;
49 virtual bool timeToPushVideo() = 0;
52 #if defined(WEBRTC_IOS)
53 virtual int pushVideoFrame(CVPixelBufferRef pixelBuffer, int64_t timestamp_ms, uint32_t rotation) = 0;
55 #if defined(WEBRTC_WIN)
56 virtual void recycleVideoCache() = 0;
67 #if defined (__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || defined(__OHOS__)
72 : dimensions(640, 360), frameRate(15) {}
76 #if !defined(__linux__)
77 enum class CapturerMode {
80 kScreenCaptureKit = 10,
100 bool disable_frame_transparent_check;
101 #if !defined(__linux__)
102 CapturerMode capturerMode = CapturerMode::kUnspecified;
104 bool captureAudio =
false;
105 int audio_channel_count = 2;
106 int audio_sample_rate = 48000;
107 bool excludeCurrentProcessAudio =
true;
111 : type(CaptureScreen), screen_rect(), region_offset(), display_id(0), window_id(NULL), window_focused(
false), disable_avf(
false), disable_frame_transparent_check(
false) { }
122 bool unskip_system_window;
123 bool ignore_unresponsive;
125 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
131 ApiType api_type = ApiType::kUnspecified;
145 virtual int initVideo(
const VideoCaptureConfig& config) = 0;
147 virtual int startVideoCapture(
const VideoCaptureConfig& config) = 0;
148 virtual int stopVideoCapture() = 0;
149 virtual int stopVideoCaptureAsync() = 0;
151 virtual CaptureMode getVideoCaptureMode() = 0;
154 virtual bool isAudioCaptureSupported() {
157 virtual int startAudioCapture(
const AudioCaptureConfig& config) {
158 return -ERR_NOT_SUPPORTED;
160 virtual int stopAudioCapture() {
161 return -ERR_NOT_SUPPORTED;
163 virtual int setAudioVolume(uint32_t volume) {
164 return -ERR_NOT_SUPPORTED;
166 virtual int setFrameRate(
int fps) {
167 return -ERR_NOT_SUPPORTED;
171 return -ERR_NOT_SUPPORTED;
174 return -ERR_NOT_SUPPORTED;
176 virtual int setExcludeWindowList(
void*
const * handles,
int count) {
177 return -ERR_NOT_SUPPORTED;
179 virtual int captureMouseCursor(
bool capture) {
180 return -ERR_NOT_SUPPORTED;
183 return -ERR_NOT_SUPPORTED;
185 virtual int getProfilingStats(ScreenCaptureProfilingStatistics& stats) {
186 return -ERR_NOT_SUPPORTED;
188 virtual int getScreenDimensions(
int& width,
int& height) {
189 return ERR_NOT_SUPPORTED;
191 virtual int setProperty(
const char* key,
const char* json_value) {
192 return -ERR_NOT_SUPPORTED;
194 virtual int setCustomContext(
const char* key,
const void* context) {
195 return -ERR_NOT_SUPPORTED;
197 virtual int getProperty(
const char* key,
char* json_value,
int& length) {
198 return -ERR_NOT_SUPPORTED;
200 virtual int setHighLight(
bool isHighLight,
unsigned int color,
int width) {
201 return -ERR_NOT_SUPPORTED;
203 virtual int setContentType(
int contentType) {
204 return -ERR_NOT_SUPPORTED;
206 virtual void* getCustomContext(
const char* key) {
209 virtual void* getScreenCaptureSources(
const ScreenSourceListOption& option) {
212 virtual void setFrameCopy(
bool frameCopy) {};
213 #if defined(WEBRTC_ANDROID) && !defined(RTC_EXCLUDE_JAVA)
214 virtual void setSmoothCapture(
bool smoothCapture) {};
215 virtual void setResetVitualDisplay(
bool reset) {};
217 #if defined(WEBRTC_ANDROID)
218 virtual int setExternalMediaProjection(
void* mediaProjection) {
219 return -ERR_NOT_SUPPORTED;