Agora C++ API Reference for All Platforms
screen_capture_i.h
1 //
2 // Agora Media SDK
3 //
4 // Created by Sting Feng in 2015-05.
5 // Copyright (c) 2015 Agora IO. All rights reserved.
6 //
7 #pragma once
8 
9 #include "AgoraRefPtr.h"
10 #include "NGIAgoraExtensionScreenSource.h"
11 #include "NGIAgoraScreenCapturer.h"
12 #include "main/core/video/base/video_frame/video_content_type.h"
13 #include "main/core/video/base/video_frame/video_frame.h"
14 #include "main/core/video/base/video_source_interface.h"
15 #include "modules/desktop_capture/desktop_capturer.h"
16 
17 namespace agora {
18 namespace rtc {
19 
20 class IScreenCaptureObserver;
21 class AudioPcmDataSinkInterface;
22 
24 public:
28  };
29  public:
30  virtual ~IScreenCapturerEx() {}
31  virtual int StartCapture() = 0;
32  virtual int StopCapture() = 0;
34  std::weak_ptr<::rtc::VideoSinkInterface<webrtc::VideoFrame>> dataCallback) = 0;
35  virtual int CaptureMouseCursor(bool capture) = 0;
36  virtual int GetScreenDimensions(VideoDimensions& dimension) = 0;
37  virtual int SetOutputDimensions(VideoDimensions dimension) {return 0;};
38  virtual int SetContentType(agora::VideoContentSubType type) {return 0;};
39  virtual void GetContentType(agora::VideoContentType& type, agora::VideoContentSubType& subtype) {};
40  virtual bool FocusOnSelectedSource() = 0;
41  virtual void SetHighLight(bool isHighLight, unsigned int color, int width) {}
42  virtual void SetVideoQoEPusher(std::weak_ptr<agora::rtc::VideoStatsEventsPusher> pusher) = 0;
43 
44 #if defined (WEBRTC_MAC)
45  virtual bool isAudioCaptureSupported() = 0;
46  virtual int startAudioCapture() = 0;
47  virtual int stopAudioCapture() = 0;
48  virtual void addPcmDataSink(AudioPcmDataSinkInterface* sink) = 0;
49  virtual void removePcmDataSink(AudioPcmDataSinkInterface* sink) = 0;
50 #endif
51 
52 #if defined(_WIN32) || (defined(__APPLE__) && !TARGET_OS_IPHONE && TARGET_OS_MAC) || (defined(__linux__) && !defined(__ANDROID__) && !defined(__OHOS__))
53  virtual int initWithDisplayIdLLApiInternal(int64_t displayId, const rtc::ScreenCaptureConfiguration& config) = 0;
54 #endif
55 
56 #if defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__) && !defined (__OHOS__))
57  virtual int initWithScreenRectLLApiInternal(const rtc::Rectangle& screenRect, const rtc::Rectangle& regionRect) = 0;
58 #endif
59  virtual int initWithWindowIdLLApiInternal(view_t windowId, const rtc::ScreenCaptureConfiguration& config) = 0;
62  virtual int setFrameRateLLApiInternal(int rate) = 0;
63 #if defined(__ANDROID__)
64  virtual int initWithMediaProjectionPermissionResultDataLLApiInternal(void* data, const VideoDimensions& dimensions) = 0;
65 #endif
66 #if defined(_WIN32)
67  virtual int InitUsingLastRegionSetting() { return -ERR_NOT_SUPPORTED; }
68  virtual void SetCaptureSource(bool allow_magnification_api, bool allow_directx_capturer) {}
69  virtual void GetCaptureSource(bool& allow_magnification_api, bool& allow_directx_capturer) {}
70  virtual void SetAllowUseWGC(bool allow_use_wgc) {}
71  virtual void GetAllowUseWGC(bool& allow_use_wgc) {}
72  virtual void SetCaptureToTexture(bool capture_to_texture) {}
73  virtual void GetCaptureToTexture(bool& capture_to_texture) {}
74 #endif // _WIN32
75 
76 #if defined(_WIN32) || (defined(WEBRTC_MAC) && !defined(WEBRTC_IOS))
77  virtual void ForcedUsingScreenCapture(bool using_screen_capture) {}
78 
79  virtual void SetExcludeWindowList(const std::vector<void *>& window_list) = 0;
80  virtual webrtc::DesktopCapturer::SourceId GetSourceId() = 0;
81  virtual int GetCaptureType() = 0;
82 #endif // _WIN32 || (WEBRTC_MAC&&!WEBRTC_IOS)
84  return -ERR_NOT_SUPPORTED;
85  }
87  return -ERR_NOT_SUPPORTED;
88  }
90  return nullptr;
91  }
92  virtual void deinit() {};
93  virtual void attachStatsSpace(uint64_t stats_space) {}
94 };
95 
97 public:
99  (void) state;
100  }
101 protected:
103 };
104 
105 #if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || defined(__OHOS__)
106 class AudioPcmDataSinkInterface;
108  public:
109  virtual int startVideoCapture() = 0;
110  virtual int stopVideoCapture() = 0;
111  virtual int startAudioCapture() = 0;
112  virtual int stopAudioCapture() = 0;
113  virtual void addPcmDataSink(AudioPcmDataSinkInterface* sink) = 0;
114  virtual void removePcmDataSink(AudioPcmDataSinkInterface* sink) = 0;
115  virtual void deinit() {};
116  virtual void attachStatsSpace(uint64_t stats_space) {}
117  virtual void SetVideoQoEPusher(std::weak_ptr<agora::rtc::VideoStatsEventsPusher> pusher) = 0;
118  virtual int setScreenCaptureDimensionsLLApiInternal(const VideoDimensions& dimensions) = 0;
119  virtual int updateScreenCaptureRegionLLApiInternal(const rtc::Rectangle& regionRect) = 0;
120  virtual int setFrameRateLLApiInternal(int fps) = 0;
121  virtual int setAudioRecordConfigLLApiInternal(int channels, int sampleRate) = 0;
122  virtual int setAudioVolumeLLApiInternal(uint32_t volume) = 0;
123 };
124 #endif
125 
126 } // namespace rtc
127 } // namespace agora
agora::rtc::IScreenCapturerEx::InitUsingLastRegionSetting
virtual int InitUsingLastRegionSetting()
Definition: screen_capture_i.h:67
agora::rtc::IScreenCapturerEx::GetContentType
virtual void GetContentType(agora::VideoContentType &type, agora::VideoContentSubType &subtype)
Definition: screen_capture_i.h:39
agora::rtc::IScreenCapturerEx::setFrameRateLLApiInternal
virtual int setFrameRateLLApiInternal(int rate)=0
agora::rtc::IScreenCapturerEx::GetAllowUseWGC
virtual void GetAllowUseWGC(bool &allow_use_wgc)
Definition: screen_capture_i.h:71
agora::rtc::IScreenCapturerEx::GetCaptureType
virtual int GetCaptureType()=0
agora::rtc::IScreenCapturerEx::ForcedUsingScreenCapture
virtual void ForcedUsingScreenCapture(bool using_screen_capture)
Definition: screen_capture_i.h:77
agora::rtc::IScreenCaptureObserver
Definition: screen_capture_i.h:96
agora::rtc::IScreenCaptureObserver::onScreenCaptureStateChanged
virtual void onScreenCaptureStateChanged(IScreenCapturerEx::SCREEN_CAPTURER_STATE state)
Definition: screen_capture_i.h:98
agora::rtc::IScreenCapturerEx::SetHighLight
virtual void SetHighLight(bool isHighLight, unsigned int color, int width)
Definition: screen_capture_i.h:41
agora::rtc::IScreenCapturerEx::SCREEN_CAPTURER_STATE
SCREEN_CAPTURER_STATE
Definition: screen_capture_i.h:25
agora::rtc::Rectangle
The location of the target area relative to the screen or window. If you do not set this parameter,...
Definition: AgoraBase.h:2354
agora::rtc::IScreenCapturerEx::SCREEN_CAPTURER_STOPPED
@ SCREEN_CAPTURER_STOPPED
Definition: screen_capture_i.h:27
agora::rtc::IScreenCapturerEx::SetExcludeWindowList
virtual void SetExcludeWindowList(const std::vector< void * > &window_list)=0
agora::view_t
void * view_t
Definition: AgoraBase.h:862
agora::rtc::IScreenCapturerEx::startAudioCapture
virtual int startAudioCapture()=0
agora::rtc::IScreenCapturerEx::setScreenOrientationLLApiInternal
virtual int setScreenOrientationLLApiInternal(VIDEO_ORIENTATION orientation)=0
agora::rtc::IScreenCapturerEx::SetOutputDimensions
virtual int SetOutputDimensions(VideoDimensions dimension)
Definition: screen_capture_i.h:37
agora::rtc::IScreenCapturerEx::RegisterCaptureDataCallback
virtual void RegisterCaptureDataCallback(std::weak_ptr<::rtc::VideoSinkInterface< webrtc::VideoFrame >> dataCallback)=0
agora::rtc::IScreenCapturerEx::unregisterScreenCaptureObserver
virtual int unregisterScreenCaptureObserver(IScreenCaptureObserver *observer)
Definition: screen_capture_i.h:86
agora::rtc::IScreenCapturerEx::deinit
virtual void deinit()
Definition: screen_capture_i.h:92
agora::rtc::IScreenCapturerEx::FocusOnSelectedSource
virtual bool FocusOnSelectedSource()=0
agora::rtc::IScreenCapturerEx2::SetVideoQoEPusher
virtual void SetVideoQoEPusher(std::weak_ptr< agora::rtc::VideoStatsEventsPusher > pusher)=0
agora::rtc::IScreenCapturerEx::registerScreenCaptureObserver
virtual int registerScreenCaptureObserver(IScreenCaptureObserver *observer)
Definition: screen_capture_i.h:83
agora::rtc::IScreenCapturerEx::updateScreenCaptureRegionLLApiInternal
virtual int updateScreenCaptureRegionLLApiInternal(const rtc::Rectangle &rect)=0
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::IScreenCaptureSource::ScreenSourceListOption
Definition: NGIAgoraExtensionScreenSource.h:115
agora::rtc::IScreenCapturerEx2::setAudioRecordConfigLLApiInternal
virtual int setAudioRecordConfigLLApiInternal(int channels, int sampleRate)=0
agora::rtc::IScreenCapturer
Definition: NGIAgoraScreenCapturer.h:19
agora::rtc::IScreenCaptureObserver::~IScreenCaptureObserver
virtual ~IScreenCaptureObserver()
Definition: screen_capture_i.h:102
agora::rtc::IScreenCapturerEx::CaptureMouseCursor
virtual int CaptureMouseCursor(bool capture)=0
agora::rtc::IScreenCapturerEx2::removePcmDataSink
virtual void removePcmDataSink(AudioPcmDataSinkInterface *sink)=0
agora::rtc::VIDEO_ORIENTATION
VIDEO_ORIENTATION
The clockwise rotation of the video.
Definition: AgoraBase.h:1013
agora::rtc::IScreenCapturerEx2::setFrameRateLLApiInternal
virtual int setFrameRateLLApiInternal(int fps)=0
agora::rtc::IScreenCapturerEx2::updateScreenCaptureRegionLLApiInternal
virtual int updateScreenCaptureRegionLLApiInternal(const rtc::Rectangle &regionRect)=0
agora::rtc::IScreenCapturerEx::StopCapture
virtual int StopCapture()=0
agora::rtc::IScreenCapturerEx::initWithMediaProjectionPermissionResultDataLLApiInternal
virtual int initWithMediaProjectionPermissionResultDataLLApiInternal(void *data, const VideoDimensions &dimensions)=0
agora::rtc::IScreenCapturerEx::GetCaptureSource
virtual void GetCaptureSource(bool &allow_magnification_api, bool &allow_directx_capturer)
Definition: screen_capture_i.h:69
agora::rtc::IScreenCapturerEx::SetCaptureToTexture
virtual void SetCaptureToTexture(bool capture_to_texture)
Definition: screen_capture_i.h:72
agora::rtc::IScreenCapturerEx::getScreenCaptureSources
virtual void * getScreenCaptureSources(const IScreenCaptureSource::ScreenSourceListOption &option)
Definition: screen_capture_i.h:89
agora::rtc::IScreenCapturerEx::initWithScreenRectLLApiInternal
virtual int initWithScreenRectLLApiInternal(const rtc::Rectangle &screenRect, const rtc::Rectangle &regionRect)=0
agora::rtc::IScreenCapturerEx::SetVideoQoEPusher
virtual void SetVideoQoEPusher(std::weak_ptr< agora::rtc::VideoStatsEventsPusher > pusher)=0
agora::rtc::IScreenCapturerEx::SetCaptureSource
virtual void SetCaptureSource(bool allow_magnification_api, bool allow_directx_capturer)
Definition: screen_capture_i.h:68
agora::rtc::IScreenCapturerEx2::startAudioCapture
virtual int startAudioCapture()=0
agora::rtc::IScreenCapturer2
Definition: NGIAgoraScreenCapturer.h:146
agora::ERR_NOT_SUPPORTED
@ ERR_NOT_SUPPORTED
Definition: AgoraBase.h:502
agora::rtc::IScreenCapturerEx2::deinit
virtual void deinit()
Definition: screen_capture_i.h:115
agora::rtc::IScreenCapturerEx::GetCaptureToTexture
virtual void GetCaptureToTexture(bool &capture_to_texture)
Definition: screen_capture_i.h:73
agora::rtc::IScreenCapturerEx::initWithDisplayIdLLApiInternal
virtual int initWithDisplayIdLLApiInternal(int64_t displayId, const rtc::ScreenCaptureConfiguration &config)=0
agora::rtc::IScreenCapturerEx::GetScreenDimensions
virtual int GetScreenDimensions(VideoDimensions &dimension)=0
agora::rtc::IScreenCapturerEx2::stopAudioCapture
virtual int stopAudioCapture()=0
agora::rtc::IScreenCapturerEx2
Definition: screen_capture_i.h:107
agora::rtc::IScreenCapturerEx::stopAudioCapture
virtual int stopAudioCapture()=0
agora::rtc::IScreenCapturerEx::GetSourceId
virtual webrtc::DesktopCapturer::SourceId GetSourceId()=0
agora::rtc::IScreenCapturerEx::removePcmDataSink
virtual void removePcmDataSink(AudioPcmDataSinkInterface *sink)=0
agora::rtc::IScreenCapturerEx::SetContentType
virtual int SetContentType(agora::VideoContentSubType type)
Definition: screen_capture_i.h:38
agora::rtc::IScreenCapturerEx2::stopVideoCapture
virtual int stopVideoCapture()=0
agora::rtc::IScreenCapturerEx::SCREEN_CAPTURER_STARTED
@ SCREEN_CAPTURER_STARTED
Definition: screen_capture_i.h:26
agora::rtc::IScreenCapturerEx
Definition: screen_capture_i.h:23
agora::rtc::ScreenCaptureConfiguration
The configuration of the captured screen.
Definition: IAgoraRtcEngine.h:992
agora::rtc::IScreenCapturerEx::isAudioCaptureSupported
virtual bool isAudioCaptureSupported()=0
agora::rtc::IScreenCapturerEx::~IScreenCapturerEx
virtual ~IScreenCapturerEx()
Definition: screen_capture_i.h:30
agora::rtc::VideoDimensions
The video dimension.
Definition: AgoraBase.h:1178
agora::rtc::IScreenCapturerEx::attachStatsSpace
virtual void attachStatsSpace(uint64_t stats_space)
Definition: screen_capture_i.h:93
agora::rtc::IScreenCapturerEx2::attachStatsSpace
virtual void attachStatsSpace(uint64_t stats_space)
Definition: screen_capture_i.h:116
agora::rtc::IScreenCapturerEx2::setScreenCaptureDimensionsLLApiInternal
virtual int setScreenCaptureDimensionsLLApiInternal(const VideoDimensions &dimensions)=0
agora::rtc::IScreenCapturerEx2::addPcmDataSink
virtual void addPcmDataSink(AudioPcmDataSinkInterface *sink)=0
agora::rtc::IScreenCapturerEx::addPcmDataSink
virtual void addPcmDataSink(AudioPcmDataSinkInterface *sink)=0
agora::rtc::IScreenCapturerEx::SetAllowUseWGC
virtual void SetAllowUseWGC(bool allow_use_wgc)
Definition: screen_capture_i.h:70
agora::rtc::IScreenCapturerEx::initWithWindowIdLLApiInternal
virtual int initWithWindowIdLLApiInternal(view_t windowId, const rtc::ScreenCaptureConfiguration &config)=0
rtc::VideoSinkInterface
Definition: video_node_i.h:32
agora::rtc::IScreenCapturerEx2::startVideoCapture
virtual int startVideoCapture()=0
rtc
Definition: video_node_i.h:28
agora::rtc::IScreenCapturerEx2::setAudioVolumeLLApiInternal
virtual int setAudioVolumeLLApiInternal(uint32_t volume)=0
agora::rtc::IScreenCapturerEx::StartCapture
virtual int StartCapture()=0