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)
72 : dimensions(640, 360), frameRate(15) {}
76 #if !defined(__linux__)
77 enum class CapturerMode {
80 kScreenCaptureKit = 10,
100 #if !defined(__linux__)
101 CapturerMode capturerMode = CapturerMode::kUnspecified;
103 bool captureAudio =
false;
104 int audio_channel_count = 2;
105 int audio_sample_rate = 48000;
106 bool excludeCurrentProcessAudio =
true;
108 bool disable_frame_transparent_check;
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;
136 virtual int initVideo(
const VideoCaptureConfig& config) = 0;
138 virtual int startVideoCapture(
const VideoCaptureConfig& config) = 0;
139 virtual int stopVideoCapture() = 0;
140 virtual int stopVideoCaptureAsync() = 0;
142 virtual CaptureMode getVideoCaptureMode() = 0;
145 virtual bool isAudioCaptureSupported() {
148 virtual int startAudioCapture(
const AudioCaptureConfig& config) {
149 return -ERR_NOT_SUPPORTED;
151 virtual int stopAudioCapture() {
152 return -ERR_NOT_SUPPORTED;
154 virtual int setAudioVolume(uint32_t volume) {
155 return -ERR_NOT_SUPPORTED;
157 virtual int setFrameRate(
int fps) {
158 return -ERR_NOT_SUPPORTED;
162 return -ERR_NOT_SUPPORTED;
165 return -ERR_NOT_SUPPORTED;
167 virtual int setExcludeWindowList(
void*
const * handles,
int count) {
168 return -ERR_NOT_SUPPORTED;
170 virtual int captureMouseCursor(
bool capture) {
171 return -ERR_NOT_SUPPORTED;
174 return -ERR_NOT_SUPPORTED;
176 virtual int getProfilingStats(ScreenCaptureProfilingStatistics& stats) {
177 return -ERR_NOT_SUPPORTED;
179 virtual int getScreenDimensions(
int& width,
int& height) {
180 return ERR_NOT_SUPPORTED;
182 virtual int setProperty(
const char* key,
const char* json_value) {
183 return -ERR_NOT_SUPPORTED;
185 virtual int setCustomContext(
const char* key,
const void* context) {
186 return -ERR_NOT_SUPPORTED;
188 virtual int getProperty(
const char* key,
char* json_value,
int& length) {
189 return -ERR_NOT_SUPPORTED;
191 virtual int setHighLight(
bool isHighLight,
unsigned int color,
int width) {
192 return -ERR_NOT_SUPPORTED;
194 virtual int setContentType(
int contentType) {
195 return -ERR_NOT_SUPPORTED;
197 virtual void* getCustomContext(
const char* key) {
200 virtual void* getScreenCaptureSources(
const ScreenSourceListOption& option) {
203 virtual void setFrameCopy(
bool frameCopy) {};
204 #if defined(WEBRTC_ANDROID) && !defined(RTC_EXCLUDE_JAVA)
205 virtual void setSmoothCapture(
bool smoothCapture) {};
206 virtual void setResetVitualDisplay(
bool reset) {};
208 #if defined(WEBRTC_ANDROID)
209 virtual int setExternalMediaProjection(
void* mediaProjection) {
210 return -ERR_NOT_SUPPORTED;