Skip to content

Commit 2d1b095

Browse files
committed
feat: support content moderation
1 parent bd6617c commit 2d1b095

9 files changed

Lines changed: 46 additions & 3 deletions

File tree

windows/APIExample/APIExample/APIExample.rc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ BEGIN
9393
LTEXT "Channel Name",IDC_STATIC_CHANNELNAME,335,349,48,8
9494
EDITTEXT IDC_EDIT_CHANNELNAME,395,347,129,12,ES_AUTOHSCROLL
9595
PUSHBUTTON "JoinChannel",IDC_BUTTON_JOINCHANNEL,539,347,50,14
96-
LTEXT "",IDC_STATIC_DETAIL,79,370,400,27
96+
LTEXT "",IDC_STATIC_DETAIL,95,367,400,27
9797
COMBOBOX IDC_COMBO_ENCODER,260,348,60,30,CBS_DROPDOWNLIST | WS_VSCROLL
98-
CONTROL "Report",IDC_CHECK_REPORT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,368,54,10
98+
CONTROL "Report",IDC_CHECK_REPORT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,368,59,10
99+
CONTROL "Moderation",IDC_CHECK_MODERATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,380,52,10
99100
END
100101

101102
IDD_DIALOG_RTMPINJECT DIALOGEX 0, 0, 632, 400

windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void CLiveBroadcastingDlg::DoDataExchange(CDataExchange* pDX)
109109
DDX_Control(pDX, IDC_STATIC_DETAIL, m_staDetail);
110110
DDX_Control(pDX, IDC_COMBO_ENCODER, m_cmbVideoEncoder);
111111
DDX_Control(pDX, IDC_CHECK_REPORT, m_chkReport);
112+
DDX_Control(pDX, IDC_CHECK_MODERATION, m_chkModeration);
112113
}
113114

114115

@@ -131,11 +132,13 @@ BEGIN_MESSAGE_MAP(CLiveBroadcastingDlg, CDialogEx)
131132
ON_MESSAGE(WM_MSGID(EID_LOCAL_VIDEO_STATE_CHANGED), &CLiveBroadcastingDlg::onEIDLocalVideoStateChanged)
132133
ON_MESSAGE(WM_MSGID(EID_REMOTE_VIDEO_STATS), &CLiveBroadcastingDlg::onEIDRemoteVideoStats)
133134
ON_MESSAGE(WM_MSGID(EID_REMOTE_VIDEO_STATE_CHANGED), &CLiveBroadcastingDlg::onEIDRemoteVideoStateChanged)
135+
ON_MESSAGE(WM_MSGID(EID_CONTENT_INSPECT_RESULT), &CLiveBroadcastingDlg::onEIDContentInspectResult)
134136

135137
ON_WM_SHOWWINDOW()
136138
ON_LBN_SELCHANGE(IDC_LIST_INFO_BROADCASTING, &CLiveBroadcastingDlg::OnSelchangeListInfoBroadcasting)
137139
ON_STN_CLICKED(IDC_STATIC_VIDEO, &CLiveBroadcastingDlg::OnStnClickedStaticVideo)
138140
ON_BN_CLICKED(IDC_CHECK_REPORT, &CLiveBroadcastingDlg::OnBnClickedCheckReport)
141+
ON_BN_CLICKED(IDC_CHECK_MODERATION, &CLiveBroadcastingDlg::OnBnClickedModeration)
139142
END_MESSAGE_MAP()
140143

141144

@@ -176,6 +179,7 @@ void CLiveBroadcastingDlg::InitCtrlText()
176179
m_staChannelName.SetWindowText(commonCtrlChannel);
177180
m_btnJoinChannel.SetWindowText(commonCtrlJoinChannel);
178181
m_chkReport.SetWindowText(liveBraodcastingReport);
182+
m_chkModeration.SetWindowText(liveBraodcastingModeration);
179183
}
180184

181185
//create all video window to save m_videoWnds.
@@ -850,7 +854,27 @@ LRESULT CLiveBroadcastingDlg::onEIDRemoteVideoStateChanged(WPARAM wParam, LPARAM
850854
return 0;
851855
}
852856

857+
LRESULT CLiveBroadcastingDlg::onEIDContentInspectResult(WPARAM wParam, LPARAM lParam) {
858+
CString strInfo = _T("===onContentInspectResult===");
859+
m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo);
860+
CONTENT_INSPECT_RESULT result = (CONTENT_INSPECT_RESULT)wParam;
861+
strInfo.Format(_T("mod result:%d"), result);
862+
m_lstInfo.InsertString(m_lstInfo.GetCount(), strInfo);
863+
return 0;
864+
}
865+
853866
void CLiveBroadcastingDlg::OnBnClickedCheckReport()
854867
{
855868
m_eventHandler.SetReport(m_chkReport.GetCheck() != 0);
856869
}
870+
871+
void CLiveBroadcastingDlg::OnBnClickedModeration()
872+
{
873+
ContentInspectConfig config;
874+
ContentInspectModule module;
875+
module.type = CONTENT_INSPECT_MODERATION;
876+
module.frequency = 5;
877+
config.moduleCount = 1;
878+
config.modules[0] = module;
879+
m_rtcEngine->enableContentInspect(m_chkModeration.GetCheck() != 0, config);
880+
}

windows/APIExample/APIExample/Basic/LiveBroadcasting/CLiveBroadcastingDlg.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,17 @@ class CLiveBroadcastingRtcEngineEventHandler
158158

159159
}
160160
}
161+
162+
virtual void onContentInspectResult(media::CONTENT_INSPECT_RESULT result) {
163+
if (m_hMsgHanlder) {
164+
::PostMessage(m_hMsgHanlder, WM_MSGID(EID_CONTENT_INSPECT_RESULT), (WPARAM)result, 0);
165+
}
166+
}
161167
void SetReport(bool b) {report = b;}
162168
private:
163169
HWND m_hMsgHanlder;
164170
bool report = false;
171+
bool moderation = false;
165172
};
166173

167174
class CLiveBroadcastingDlg : public CDialogEx
@@ -212,6 +219,7 @@ class CLiveBroadcastingDlg : public CDialogEx
212219
afx_msg LRESULT onEIDLocalVideoStateChanged(WPARAM wParam, LPARAM lParam);
213220
afx_msg LRESULT onEIDRemoteVideoStats(WPARAM wParam, LPARAM lParam);
214221
afx_msg LRESULT onEIDRemoteVideoStateChanged(WPARAM wParam, LPARAM lParam);
222+
afx_msg LRESULT onEIDContentInspectResult(WPARAM wParam, LPARAM lParam);
215223
private:
216224
//set control text from config.
217225
void InitCtrlText();
@@ -251,5 +259,7 @@ class CLiveBroadcastingDlg : public CDialogEx
251259
virtual BOOL PreTranslateMessage(MSG* pMsg);
252260
CComboBox m_cmbVideoEncoder;
253261
CButton m_chkReport;
262+
CButton m_chkModeration;
254263
afx_msg void OnBnClickedCheckReport();
264+
afx_msg void OnBnClickedModeration();
255265
};

windows/APIExample/APIExample/Language.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ extern wchar_t beautyAudioCtrlParam1[INFO_LEN];
312312
extern wchar_t beautyAudioCtrlParam2[INFO_LEN];
313313

314314
extern wchar_t liveBraodcastingReport[INFO_LEN];
315+
extern wchar_t liveBraodcastingModeration[INFO_LEN];
315316
extern wchar_t SpatialAudio[INFO_LEN];
316317
extern wchar_t SpatialAudioInitInfo[INFO_LEN];
317318

windows/APIExample/APIExample/en.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ CrossChannel.Ctrl.StopMediaRelay = StopMediaRelay
241241
CrossChannel.Ctrl.UpdateMediaRelay = UpdateMediaRelay
242242

243243
LiveBroadcasting.Ctrl.Report = Report
244+
LiveBroadcasting.Ctrl.Moderation = Moderation
244245

245246
Beauty.Face = BeautyFace
246247
BeautyAudio.Ctrl.ReverbPreSet=Preset

windows/APIExample/APIExample/resource.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@
209209
#define IDC_STATIC_AUDIO_EFFECT 1101
210210
#define IDC_SLIDER_SMOOTHNESS 1101
211211
#define IDC_COMBO2 1102
212+
#define IDC_CHECK2 1102
212213
#define IDC_BUTTON_REMOVE 1103
213214
#define IDC_BUTTON_PRELOAD 1104
214215
#define IDC_BUTTON_PLAY_EFFECT 1105
@@ -280,14 +281,15 @@
280281
#define IDC_EDIT_PARAM2 1161
281282
#define IDC_STATIC_PARAM1 1162
282283
#define IDC_STATIC_PARAM2 1163
284+
#define IDC_CHECK_MODERATION 1164
283285

284286
// Next default values for new objects
285287
//
286288
#ifdef APSTUDIO_INVOKED
287289
#ifndef APSTUDIO_READONLY_SYMBOLS
288290
#define _APS_NEXT_RESOURCE_VALUE 149
289291
#define _APS_NEXT_COMMAND_VALUE 32771
290-
#define _APS_NEXT_CONTROL_VALUE 1102
292+
#define _APS_NEXT_CONTROL_VALUE 1103
291293
#define _APS_NEXT_SYMED_VALUE 101
292294
#endif
293295
#endif

windows/APIExample/APIExample/stdafx.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ wchar_t mediaPlayerCtrlUnPublishVideo[INFO_LEN] = { 0 };
281281
wchar_t mediaPlayerCtrlPublishAudio[INFO_LEN] = { 0 };
282282
wchar_t mediaPlayerCtrlUnPublishAudio[INFO_LEN] = { 0 };
283283
wchar_t liveBraodcastingReport[INFO_LEN] = { 0 };
284+
wchar_t liveBraodcastingModeration[INFO_LEN] = { 0 };
284285

285286
wchar_t beautyFace[INFO_LEN] = { 0 };
286287
wchar_t SpatialAudio[INFO_LEN] = { 0 };
@@ -694,6 +695,7 @@ void InitKeyInfomation()
694695

695696

696697
_tcscpy_s(liveBraodcastingReport, INFO_LEN, Str(_T("LiveBroadcasting.Ctrl.Report")));
698+
_tcscpy_s(liveBraodcastingModeration, INFO_LEN, Str(_T("LiveBroadcasting.Ctrl.Moderation")));
697699

698700
_tcscpy_s(beautyFace, INFO_LEN, Str(_T("Beauty.Face")));
699701

windows/APIExample/APIExample/stdafx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ using namespace agora::media;
103103
#define EID_LOCAL_AUDIO_STATE_CHANED 0x00000025
104104
#define EID_REMOTE_AUDIO_STATE_CHANGED 0x00000027
105105
#define EID_AUDIO_EFFECT_FINISHED 0x000000028
106+
#define EID_CONTENT_INSPECT_RESULT 0x000000029
106107
#define EID_CHANNEL_WARN 0x0000000B
107108
#define EID_CHANNEL_ERROR 0x0000000B
108109
#define EID_CHANNEL_REJOIN_CHANENL 0x0000000B

windows/APIExample/APIExample/zh-cn.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ CrossChannel.Ctrl.StartMediaRelay =
258258
CrossChannel.Ctrl.StopMediaRelay = 断开媒体连接
259259
CrossChannel.Ctrl.UpdateMediaRelay = 更新媒体连接
260260
LiveBroadcasting.Ctrl.Report = 上报数据
261+
LiveBroadcasting.Ctrl.Moderation = 视频鉴黄
261262
Beauty.Face = 美颜
262263
BeautyAudio.Ctrl.ReverbPreSet=美声
263264

0 commit comments

Comments
 (0)