Skip to content

Commit e37cd3b

Browse files
committed
[Windows]adapt to the api of sdk version 4.1.0.
1 parent 2ce3af9 commit e37cd3b

10 files changed

Lines changed: 99 additions & 104 deletions

File tree

windows/APIExample/APIExample/Advanced/CustomVideoCapture/CAgoraCaptureVideoDlg.cpp

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ END_MESSAGE_MAP()
3030
True: No ignore.
3131
False: Ignored, the frame data is not sent back to the SDK.
3232
*/
33-
bool CExtendVideoFrameObserver::onCaptureVideoFrame(VideoFrame & videoFrame)
33+
bool CExtendVideoFrameObserver::onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame & videoFrame)
3434
{
3535
int bufSize = videoFrame.width * videoFrame.height * 3 / 2;
3636
int timestamp = GetTickCount();
@@ -64,6 +64,11 @@ bool CExtendVideoFrameObserver::onRenderVideoFrame(const char* channelId, rtc::u
6464
}
6565

6666

67+
bool CExtendVideoFrameObserver::onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame)
68+
{
69+
return false;
70+
}
71+
6772
//set control text from config.
6873
void CAgoraCaptureVideoDlg::InitCtrlText()
6974
{

windows/APIExample/APIExample/Advanced/CustomVideoCapture/CAgoraCaptureVideoDlg.h

100644100755
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CExtendVideoFrameObserver :
3131
True: No ignore.
3232
False: Ignored, the frame data is not sent back to the SDK.
3333
*/
34-
virtual bool onCaptureVideoFrame(VideoFrame& videoFrame) override;
34+
virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) override;
3535
/**
3636
* Occurs each time the SDK receives a video frame sent by the remote user.
3737
*
@@ -51,19 +51,13 @@ class CExtendVideoFrameObserver :
5151
*/
5252
virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame)override;
5353

54-
virtual bool onScreenCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
55-
virtual bool onSecondaryCameraCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
5654
virtual bool onTranscodedVideoFrame(VideoFrame& videoFrame)override { return true; }
57-
virtual bool onSecondaryScreenCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
5855
virtual bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) override { return true; }
5956

6057
virtual bool onPreEncodeVideoFrame(VideoFrame& videoFrame) { return true; }
6158

62-
virtual bool onSecondaryPreEncodeCameraVideoFrame(VideoFrame& videoFrame) override { return true; }
59+
bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) override;
6360

64-
virtual bool onSecondaryPreEncodeScreenVideoFrame(VideoFrame& videoFrame) override { return true; }
65-
66-
virtual bool onPreEncodeScreenVideoFrame(VideoFrame& videoFrame) override { return true; }
6761
private:
6862
LPBYTE m_lpImageBuffer;
6963
LPBYTE m_lpY;

windows/APIExample/APIExample/Advanced/LocalVideoTranscoding/CLocalVideoTranscodingDlg.cpp

100644100755
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "CLocalVideoTranscodingDlg.h"
77
#include "afxdialogex.h"
88

9-
109
// CLocalVideoTranscodingDlg
1110

1211
IMPLEMENT_DYNAMIC(CLocalVideoTranscodingDlg, CDialogEx)
@@ -116,7 +115,7 @@ void CLocalVideoTranscodingDlg::OnBnClickedButtonJoinchannel()
116115
}
117116

118117
//start primary camera capture
119-
int ret = m_rtcEngine->startPrimaryCameraCapture(config);
118+
int ret = m_rtcEngine->startCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY, config);
120119
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("start primary camera capture"));
121120

122121
//start Screen capture
@@ -125,7 +124,7 @@ void CLocalVideoTranscodingDlg::OnBnClickedButtonJoinchannel()
125124
int i = 0;
126125
//screen
127126
++i;
128-
stream_infos[i].sourceType = agora::media::PRIMARY_SCREEN_SOURCE;
127+
stream_infos[i].sourceType = agora::rtc::VIDEO_SOURCE_SCREEN_PRIMARY;
129128

130129
stream_infos[i].x = 0;
131130
stream_infos[i].y = 0;
@@ -135,7 +134,7 @@ void CLocalVideoTranscodingDlg::OnBnClickedButtonJoinchannel()
135134
stream_infos[i].zOrder = 1;
136135
//camera
137136
++i;
138-
stream_infos[i].sourceType = agora::media::PRIMARY_CAMERA_SOURCE;
137+
stream_infos[i].sourceType = VIDEO_SOURCE_CAMERA_PRIMARY;
139138

140139
stream_infos[i].x = 0;
141140
stream_infos[i].y = 360;
@@ -146,7 +145,7 @@ void CLocalVideoTranscodingDlg::OnBnClickedButtonJoinchannel()
146145

147146
//png imge
148147
++i;
149-
stream_infos[i].sourceType = agora::media::RTC_IMAGE_PNG_SOURCE;
148+
stream_infos[i].sourceType = VIDEO_SOURCE_RTC_IMAGE_PNG;
150149

151150
stream_infos[i].x = 0;
152151
stream_infos[i].y = 0;
@@ -157,7 +156,7 @@ void CLocalVideoTranscodingDlg::OnBnClickedButtonJoinchannel()
157156
stream_infos[i].zOrder = 3;
158157
//jpg image
159158
++i;
160-
stream_infos[i].sourceType = agora::media::RTC_IMAGE_JPEG_SOURCE;
159+
stream_infos[i].sourceType = VIDEO_SOURCE_RTC_IMAGE_JPEG;
161160

162161
stream_infos[i].x = 640 - 64;
163162
stream_infos[i].y = 180 - 64;
@@ -176,7 +175,7 @@ void CLocalVideoTranscodingDlg::OnBnClickedButtonJoinchannel()
176175
// local transcoder configuration
177176
agora::rtc::LocalTranscoderConfiguration transcoder_config;
178177
transcoder_config.streamCount = 4;
179-
transcoder_config.VideoInputStreams = stream_infos;
178+
transcoder_config.videoInputStreams = stream_infos;
180179
transcoder_config.videoOutputConfiguration = encoder_config;
181180
ret = m_rtcEngine->startLocalVideoTranscoder(transcoder_config);
182181
m_lstInfo.InsertString(m_lstInfo.GetCount() , _T("start local video Transcoder"));

windows/APIExample/APIExample/Advanced/LocalVideoTranscoding/CLocalVideoTranscodingDlg.h

100644100755
File mode changed.

windows/APIExample/APIExample/Advanced/MultiVideoSource/CAgoraMutilVideoSourceDlg.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ void CAgoraMutilVideoSourceDlg::UnInitAgora()
354354
//leave channel primary camera
355355
m_joinChannel = !m_rtcEngine->leaveChannel();
356356
//stop primary camera capture
357-
m_rtcEngine->stopPrimaryCameraCapture();
357+
m_rtcEngine->stopCameraCapture(agora::rtc::VIDEO_SOURCE_CAMERA_PRIMARY);
358358
m_conn_camera = 0;
359359
m_joinChannel = false;
360360
}
@@ -366,7 +366,7 @@ void CAgoraMutilVideoSourceDlg::UnInitAgora()
366366
m_bScecondJoin = false;
367367
}
368368
if (m_bStartCapture2) {
369-
m_rtcEngine->stopSecondaryCameraCapture();
369+
m_rtcEngine->stopCameraCapture(agora::rtc::VIDEO_SOURCE_CAMERA_SECONDARY);
370370
m_bStartCapture2 = false;
371371
}
372372

@@ -674,7 +674,7 @@ void CAgoraMutilVideoSourceDlg::OnBnClickedButtonCamera1()
674674
}
675675
}
676676
//start primary camera capture
677-
m_rtcEngine->startPrimaryCameraCapture(config);
677+
m_rtcEngine->startCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY, config);
678678
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("start primary camera capture"));
679679
VideoCanvas canvas;
680680
canvas.uid = 0;
@@ -692,7 +692,7 @@ void CAgoraMutilVideoSourceDlg::OnBnClickedButtonCamera1()
692692
}
693693
else {
694694
//stop primary camera capture
695-
m_rtcEngine->stopPrimaryCameraCapture();
695+
m_rtcEngine->stopCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY);
696696
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("stop primary camera capture"));
697697
m_btnCapture1.SetWindowText(MultiVideoSourceStartCapture);
698698
m_videoWnds[0].Reset();
@@ -727,7 +727,7 @@ void CAgoraMutilVideoSourceDlg::OnBnClickedButtonCamera2()
727727
}
728728

729729
//start secondary camera capture
730-
m_rtcEngine->startSecondaryCameraCapture(config2);
730+
m_rtcEngine->startCameraCapture(VIDEO_SOURCE_CAMERA_SECONDARY, config2);
731731
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("start secondary camera capture"));
732732
m_btnCapture2.SetWindowText(MultiVideoSourceStopCapture);
733733
VideoCanvas canvas;
@@ -750,7 +750,7 @@ void CAgoraMutilVideoSourceDlg::OnBnClickedButtonCamera2()
750750

751751
m_rtcEngine->stopPreview(VIDEO_SOURCE_CAMERA_SECONDARY);
752752
//stop secondary camera capture
753-
m_rtcEngine->stopSecondaryCameraCapture();
753+
m_rtcEngine->stopCameraCapture(VIDEO_SOURCE_CAMERA_SECONDARY);
754754
m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("stop secondary camera capture"));
755755
m_btnCapture2.SetWindowText(MultiVideoSourceStartCapture);
756756

windows/APIExample/APIExample/Advanced/OriginalAudio/CAgoraOriginalAudioDlg.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ class COriginalAudioProcFrameObserver :
3737
{
3838
public:
3939

40-
virtual AudioParams getEarMonitoringAudioParams() override {
41-
return AudioParams();
42-
}
43-
44-
virtual bool onEarMonitoringAudioFrame(AudioFrame& audioFrame) override {
45-
return FALSE;
46-
}
4740

4841
/*
4942
* According to the setting of audio collection frame rate,

windows/APIExample/APIExample/Advanced/OriginalVideo/CAgoraOriginalVideoDlg.cpp

100644100755
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void CAgoraOriginalVideoDlg::OnBnClickedButtonSetOriginalProc()
274274

275275

276276
//see the header file for details
277-
bool CGrayVideoProcFrameObserver::onCaptureVideoFrame(VideoFrame & videoFrame)
277+
bool CGrayVideoProcFrameObserver::onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame & videoFrame)
278278
{
279279
int nSize = videoFrame.height * videoFrame.width;
280280
//set UV to 128 to mask color information
@@ -289,8 +289,13 @@ bool CGrayVideoProcFrameObserver::onRenderVideoFrame(const char* channelId, rtc:
289289
}
290290

291291

292+
bool CGrayVideoProcFrameObserver::onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame)
293+
{
294+
return false;
295+
}
296+
292297
//see the header file for details
293-
bool CAverageFilterVideoProcFrameObserver::onCaptureVideoFrame(VideoFrame & videoFrame)
298+
bool CAverageFilterVideoProcFrameObserver::onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame & videoFrame)
294299
{
295300
static int step = 1;
296301
static bool flag = true;
@@ -449,6 +454,11 @@ void CAverageFilterVideoProcFrameObserver::AverageFiltering(unsigned char * data
449454

450455

451456

457+
bool CAverageFilterVideoProcFrameObserver::onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame)
458+
{
459+
return false;
460+
}
461+
452462
//EID_JOINCHANNEL_SUCCESS message window handler
453463
LRESULT CAgoraOriginalVideoDlg::OnEIDJoinChannelSuccess(WPARAM wParam, LPARAM lParam)
454464
{

windows/APIExample/APIExample/Advanced/OriginalVideo/CAgoraOriginalVideoDlg.h

100644100755
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CGrayVideoProcFrameObserver :
2323
* - true: Do not ignore.
2424
* - false: Ignore, in which case this method does not sent the current video frame to the SDK.
2525
*/
26-
virtual bool onCaptureVideoFrame(VideoFrame& videoFrame)override;
26+
virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame)override;
2727

2828
/**
2929
* Occurs each time the SDK receives a video frame sent by the remote user.
@@ -45,18 +45,13 @@ class CGrayVideoProcFrameObserver :
4545

4646
virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame)override;
4747

48-
virtual bool onScreenCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
49-
virtual bool onSecondaryCameraCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
5048
virtual bool onTranscodedVideoFrame(VideoFrame& videoFrame)override { return true; }
51-
virtual bool onSecondaryScreenCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
5249
virtual bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) override { return true; }
5350
virtual bool onPreEncodeVideoFrame(VideoFrame& videoFrame) { return true; }
5451

55-
virtual bool onSecondaryPreEncodeCameraVideoFrame(VideoFrame& videoFrame) override { return true; }
5652

57-
virtual bool onSecondaryPreEncodeScreenVideoFrame(VideoFrame& videoFrame) override { return true; }
53+
bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) override;
5854

59-
virtual bool onPreEncodeScreenVideoFrame(VideoFrame& videoFrame) override { return true; }
6055
};
6156

6257

@@ -84,7 +79,7 @@ class CAverageFilterVideoProcFrameObserver :
8479
* - true: Do not ignore.
8580
* - false: Ignore, in which case this method does not sent the current video frame to the SDK.
8681
*/
87-
virtual bool onCaptureVideoFrame(VideoFrame& videoFrame)override;
82+
virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame)override;
8883
/**
8984
* Occurs each time the SDK receives a video frame sent by the remote user.
9085
*
@@ -107,18 +102,13 @@ class CAverageFilterVideoProcFrameObserver :
107102
void AverageFiltering(unsigned char * data, int width, int height, int step);
108103

109104

110-
virtual bool onScreenCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
111-
virtual bool onSecondaryCameraCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
112105
virtual bool onTranscodedVideoFrame(VideoFrame& videoFrame)override { return true; }
113-
virtual bool onSecondaryScreenCaptureVideoFrame(VideoFrame& videoFrame)override { return true; }
114106
virtual bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) override { return true; }
115107
virtual bool onPreEncodeVideoFrame(VideoFrame& videoFrame) { return true; }
116108

117-
virtual bool onSecondaryPreEncodeCameraVideoFrame(VideoFrame& videoFrame) override { return true; }
118109

119-
virtual bool onSecondaryPreEncodeScreenVideoFrame(VideoFrame& videoFrame) override { return true; }
110+
bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) override;
120111

121-
virtual bool onPreEncodeScreenVideoFrame(VideoFrame& videoFrame) override { return true; }
122112
};
123113

124114

0 commit comments

Comments
 (0)