forked from AgoraIO-Extensions/Electron-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagora_video_source.h
executable file
·199 lines (164 loc) · 6.84 KB
/
agora_video_source.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
* Copyright (c) 2018 Agora.io
* All rights reserved.
* Proprietary and Confidential -- Agora.io
*/
/*
* Created by Wang Yongli, 2018
*/
#ifndef AGORA_VIDEO_SOURCE_SINK_H
#define AGORA_VIDEO_SOURCE_SINK_H
#include "IAgoraRtcEngine.h"
#include "node_error.h"
#include <string>
#include "video_source_ipc.h"
namespace agora{
namespace rtc{
/**
* Video source need join the same channel, this class used to monitor video source's event.
* More event maybe needed in future.
*/
class IAgoraVideoSourceEventHandler
{
public:
virtual ~IAgoraVideoSourceEventHandler(){}
/**
* Video source joined channel success event.
* @param uid : video source's uid.
*/
virtual void onVideoSourceJoinedChannel(agora::rtc::uid_t uid) = 0;
/**
* Video source request new token event.
*/
virtual void onVideoSourceRequestNewToken() = 0;
/**
* Video source leaved channel event.
*/
virtual void onVideoSourceLeaveChannel() = 0;
virtual void onVideoSourceExit() = 0;
};
/**
* This is video source stub interface.
*/
class AgoraVideoSource
{
public:
virtual ~AgoraVideoSource(){}
/**
* To initialize Video source.
* @param eventHandler : video source event handler.
*/
virtual bool initialize(IAgoraVideoSourceEventHandler *eventHandler, const char* appid) = 0;
/**
* To ask video source to join channel with specified parameters.
* @param token : token if it is enabled.
* @param cname : channel name.
* @param chan_info : channel information
* @param uid : uid of video source.
*/
virtual node_error join(const char* token, const char* cname, const char* chan_info, uid_t uid) = 0;
/**
* To ask video source to leave channel.
*/
virtual node_error leave() = 0;
/**
* To start receive local video of video source.
*/
virtual node_error startPreview() = 0;
/**
* To stop receive local video of video source.
*/
virtual node_error stopPreview() = 0;
/**
* Release video source.
*/
virtual node_error release() = 0;
/**
* To ask video source begin to share screen.
* @param id : window id whose window will be shared. if the value is 0, then desktop is shared.
* @param captureFreq : video frequency, 0-15.
* @param rect : the shared area
* @param bitrate : bitrate of video
*/
virtual node_error captureScreen(agora::rtc::IRtcEngine::WindowIDType id, int captureFreq, agora::rtc::Rect* rect, int bitrate) = 0;
/**
* To update shared window area
* @param rect : updated area
*/
virtual node_error updateScreenCapture(agora::rtc::Rect* rect) = 0;
/**
* To stop screen share
*/
virtual node_error stopCaptureScreen() = 0;
/**
* To renew video source's token.
* @param token : new token
*/
virtual node_error renewVideoSourceToken(const char* token) = 0;
/**
* To set video source channel profile
* @param profile : video source's channel profile
*/
virtual node_error setVideoSourceChannelProfile(agora::rtc::CHANNEL_PROFILE_TYPE profile, const char* permissionKey) = 0;
/**
* To set video source's video profile
* @param profile : the video source's video profile
* @param swapWidthAndHeight : whether adjust width and height
*/
virtual node_error setVideoSourceVideoProfile(agora::rtc::VIDEO_PROFILE_TYPE profile, bool swapWidthAndHeight) = 0;
/**
* Enable interoperability with the Agora Web SDK.
* @param enabled : whether interoperability with the Agora Web SDK is enabled
*/
virtual node_error enableWebSdkInteroperability(bool enabled) = 0;
/**
* Enable dual stream mode with the Agora Web SDK.
* @param enabled : whether dual stream with the Agora Web SDK is enabled
*/
virtual node_error enableDualStreamMode(bool enabled) = 0;
/**
* set log file path of videosource
* @param file : filepath of log
*/
virtual node_error setLogFile(const char* file) = 0;
/**
* To set parameters for video source.
*/
virtual void setParameters(const char* parameters) = 0;
/**
* set screenshare content hint
*/
virtual node_error setScreenCaptureContentHint(VideoContentHint contentHint) = 0;
/**
* start screen capture by screen rect
*/
virtual node_error startScreenCaptureByScreen(ScreenIDType screenId, const Rectangle & regionRect, const agora::rtc::ScreenCaptureParameters & captureParams) = 0;
/**
* start screen capture by windowId
*/
virtual node_error startScreenCaptureByWindow(agora::rtc::IRtcEngine::WindowIDType windowId, const Rectangle & regionRect, const agora::rtc::ScreenCaptureParameters & captureParams) = 0;
/**
* start screen capture by windowId
*/
virtual node_error updateScreenCaptureParameters(const agora::rtc::ScreenCaptureParameters & captureParams) = 0;
/**
* Enable loopbackRecording
* @param enabled : whether enable loopbackRecording
*/
virtual node_error enableLoopbackRecording(bool enabled, const char* deviceName) = 0;
/**
* Enable audio
*/
virtual node_error enableAudio() = 0;
/**
* Set addon logfile path
*/
virtual node_error setAddonLogFile(const char* filePath) = 0;
};
/**
* Video source may be has different implementation on different platforms. The API is used to generate video source.
*/
AgoraVideoSource* createVideoSource();
}
}
#endif