diff --git a/windows/APIExample/APIExample/APIExample.rc b/windows/APIExample/APIExample/APIExample.rc index b18a2de3d..8efcfb2cc 100755 --- a/windows/APIExample/APIExample/APIExample.rc +++ b/windows/APIExample/APIExample/APIExample.rc @@ -295,7 +295,7 @@ BEGIN COMBOBOX IDC_COMBO_AUDIO_SCENARIO,84,372,218,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Dest Channel Name",IDC_STATIC_Dest_Channel_Name,8,329,64,8 EDITTEXT IDC_EDIT_DEST_CHANNEL_NAME,84,327,218,14,ES_AUTOHSCROLL - CONTROL "Forward Audio Stream",IDC_CHECK_SECOND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,323,330,79,10 + CONTROL "Forward Audio Stream",IDC_CHECK_SECOND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,323,330,94,10 END IDD_DIALOG_AUDIO_MIX DIALOGEX 0, 0, 632, 400 @@ -714,6 +714,7 @@ BEGIN EDITTEXT IDC_EDIT_CHANNELNAME,71,326,218,13,ES_AUTOHSCROLL PUSHBUTTON "JoinChannel",IDC_BUTTON_JOINCHANNEL,307,326,50,14 LTEXT "",IDC_STATIC_DETAIL,442,325,181,58 + CONTROL "HDR",IDC_CHECK_HDR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,390,327,30,10 END IDD_DIALOG_MULTI_VIDEO_SOURCE_TRACKS DIALOGEX 0, 0, 632, 400 diff --git a/windows/APIExample/APIExample/APIExample.vcxproj b/windows/APIExample/APIExample/APIExample.vcxproj index 5d3926e92..f165aabe2 100644 --- a/windows/APIExample/APIExample/APIExample.vcxproj +++ b/windows/APIExample/APIExample/APIExample.vcxproj @@ -122,7 +122,9 @@ if exist en.ini (copy en.ini $(SolutionDir)$(Configuration)) copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(SolutionDir)$(Configuration) copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Configuration) if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Configuration)) -if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration)) +if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration)) +if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration)) + @@ -169,6 +171,7 @@ copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(Solutio copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Platform)\$(Configuration) if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)$(Configuration)) if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration)) +if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration)) @@ -215,7 +218,8 @@ copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(Solutio copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Configuration) if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Configuration)) -if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration)) +if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration)) +if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration)) @@ -263,7 +267,8 @@ if exist en.ini (copy en.ini $(SolutionDir)$(Platform)\$(Configuration)) copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.jpg $(SolutionDir)$(Platform)\$(Configuration) if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration)) -if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration)) +if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (copy $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 $(SolutionDir)$(Configuration)) +if exist $(SolutionDir)APIExample\res\hdr_1280_720.yuv (copy $(SolutionDir)APIExample\res\hdr_1280_720.yuv $(SolutionDir)$(Configuration)) PerMonitorHighDPIAware @@ -408,6 +413,7 @@ if exist $(SolutionDir)APIExample\res\yuvj_full_range_alpha_1280_540_left.mp4 (c Document + diff --git a/windows/APIExample/APIExample/APIExample.vcxproj.filters b/windows/APIExample/APIExample/APIExample.vcxproj.filters index 6bd3ba077..b012a6003 100644 --- a/windows/APIExample/APIExample/APIExample.vcxproj.filters +++ b/windows/APIExample/APIExample/APIExample.vcxproj.filters @@ -266,9 +266,6 @@ Basic\JoinChannelVideoByToken - - - Advanced\CrossChannel Advanced\Metadata @@ -440,6 +437,9 @@ Advanced\Beauty + + Source Files + @@ -459,6 +459,7 @@ Resource Files + diff --git a/windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp b/windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp index 4f84f69f3..aee3bab02 100644 --- a/windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp +++ b/windows/APIExample/APIExample/Advanced/AudioProfile/CAgoraAudioProfile.cpp @@ -321,15 +321,15 @@ void CAgoraAudioProfile::joinSecondChannelAndStartAudioMixer() LocalAudioMixerConfiguration config; config.syncWithLocalMic = false; config.streamCount = 2; - config.sourceStreams = sourceStreams; + config.audioInputStreams = sourceStreams; MixedAudioStream remoteStream( AUDIO_SOURCE_REMOTE_CHANNEL); - remoteStream.channelName = mainchannelName; - config.sourceStreams[0] = remoteStream; + remoteStream.channelId = mainchannelName; + config.audioInputStreams[0] = remoteStream; MixedAudioStream remoteStream2(AUDIO_SOURCE_MICROPHONE); - remoteStream2.channelName = mainchannelName; - config.sourceStreams[1] = remoteStream2; + remoteStream2.channelId = mainchannelName; + config.audioInputStreams[1] = remoteStream2; int ret = m_rtcEngine->startLocalAudioMixer(config); if (ret != 0) { diff --git a/windows/APIExample/APIExample/Advanced/CrossChannel/CAgoraCrossChannelDlg.cpp b/windows/APIExample/APIExample/Advanced/CrossChannel/CAgoraCrossChannelDlg.cpp index 367602195..432ae9fad 100644 --- a/windows/APIExample/APIExample/Advanced/CrossChannel/CAgoraCrossChannelDlg.cpp +++ b/windows/APIExample/APIExample/Advanced/CrossChannel/CAgoraCrossChannelDlg.cpp @@ -270,18 +270,31 @@ void CAgoraCrossChannelDlg::OnBnClickedButtonAddCrossChannel() AfxMessageBox(_T("The channel and user ID cannot be empty")); return; } - ChannelMediaInfo mediaInfo; + std::string szChannel = cs2utf8(strChannel); std::string szToken = cs2utf8(strToken); - mediaInfo.channelName = new char[strChannel.GetLength() + 1]; - mediaInfo.token = new char[strToken.GetLength() + 1]; - mediaInfo.uid = _ttol(strUID); - strcpy_s(const_cast(mediaInfo.channelName), strChannel.GetLength() + 1, szChannel.data()); - strcpy_s(const_cast(mediaInfo.token), strToken.GetLength() + 1, szToken.data()); - //add mediaInfo to vector. - m_vecChannelMedias.push_back(mediaInfo); - m_cmbCrossChannelList.AddString(strChannel); - m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1); + auto it = std::find_if(m_vecChannelMedias.begin(), m_vecChannelMedias.end(), + [&](const ChannelMediaInfo& info) { + return info.channelName == szChannel && info.token == szToken; + }); + + if (it == m_vecChannelMedias.end()) { + ChannelMediaInfo mediaInfo; + mediaInfo.channelName = new char[strChannel.GetLength() + 1]; + mediaInfo.token = new char[strToken.GetLength() + 1]; + mediaInfo.uid = _ttol(strUID); + strcpy_s(const_cast(mediaInfo.channelName), strChannel.GetLength() + 1, szChannel.data()); + strcpy_s(const_cast(mediaInfo.token), strToken.GetLength() + 1, szToken.data()); + //add mediaInfo to vector. + m_vecChannelMedias.push_back(mediaInfo); + m_cmbCrossChannelList.AddString(strChannel); + m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1); + } + else + { + AfxMessageBox(_T("already added for same channel and token")); + } + } //remove combobox item @@ -293,20 +306,19 @@ void CAgoraCrossChannelDlg::OnBnClickedButtonRemoveCrossChannel2() m_cmbCrossChannelList.GetWindowText(strChannelName); std::string szChannelName = cs2utf8(strChannelName); - int offset = 0; - //erase media info from m_vecChannelMedias - for (auto & mediaInfo : m_vecChannelMedias) - { - if (szChannelName.compare(mediaInfo.channelName) == 0) - { - delete mediaInfo.channelName; - delete mediaInfo.token; - m_vecChannelMedias.erase(m_vecChannelMedias.begin() + offset); - } - offset++; + auto it = std::find_if(m_vecChannelMedias.begin(), m_vecChannelMedias.end(), + [&szChannelName](const ChannelMediaInfo& info) { + return info.channelName == szChannelName; + }); + + if (it != m_vecChannelMedias.end()) { + delete it->channelName; + delete it->token; + m_vecChannelMedias.erase(it); } m_cmbCrossChannelList.DeleteString(nSel); m_cmbCrossChannelList.SetCurSel(m_cmbCrossChannelList.GetCount() - 1); + } //start media relay or stop media relay @@ -315,6 +327,11 @@ void CAgoraCrossChannelDlg::OnBnClickedButtonStartMediaRelay() if (!m_startMediaRelay) { int nDestCount = m_vecChannelMedias.size(); + if (nDestCount<=0) + { + AfxMessageBox(_T("please config target channel config first")); + return; + } ChannelMediaInfo *lpDestInfos = new ChannelMediaInfo[nDestCount]; for (int nIndex = 0; nIndex < nDestCount; nIndex++) { lpDestInfos[nIndex].channelName = m_vecChannelMedias[nIndex].channelName; diff --git a/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.cpp b/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.cpp index 977f862a6..3763dbae8 100755 --- a/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.cpp +++ b/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.cpp @@ -10,6 +10,7 @@ BEGIN_MESSAGE_MAP(PushExternalVideoYUV, CDialogEx) ON_MESSAGE(WM_MSGID(EID_USER_OFFLINE), &PushExternalVideoYUV::OnEIDUserOffline) ON_MESSAGE(WM_MSGID(EID_REMOTE_VIDEO_STATE_CHANGED), &PushExternalVideoYUV::OnEIDRemoteVideoStateChanged) ON_BN_CLICKED(IDC_BUTTON_JOINCHANNEL, &PushExternalVideoYUV::OnClickedButtonJoinchannel) + ON_BN_CLICKED(IDC_CHECK_HDR, &PushExternalVideoYUV::OnBnClickedCheckHdr) END_MESSAGE_MAP() IMPLEMENT_DYNAMIC(PushExternalVideoYUV, CDialogEx) @@ -17,7 +18,7 @@ IMPLEMENT_DYNAMIC(PushExternalVideoYUV, CDialogEx) PushExternalVideoYUV::PushExternalVideoYUV(CWnd* pParent /*=nullptr*/) : CDialogEx(PushExternalVideoYUV::IDD, pParent) { - + } PushExternalVideoYUV::~PushExternalVideoYUV() @@ -33,6 +34,7 @@ void PushExternalVideoYUV::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_EDIT_CHANNELNAME, m_edtChannel); DDX_Control(pDX, IDC_BUTTON_JOINCHANNEL, m_btnJoinChannel); DDX_Control(pDX, IDC_LIST_INFO_BROADCASTING, m_lstInfo); + DDX_Control(pDX, IDC_CHECK_HDR, mCbHdr); } //set control text from config. @@ -81,19 +83,21 @@ bool PushExternalVideoYUV::InitAgora() m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("setClientRole broadcaster")); m_rtcEngine->enableVideo(); - + //query interface agora::AGORA_IID_MEDIA_ENGINE in the engine. m_mediaEngine.queryInterface(m_rtcEngine, agora::rtc::AGORA_IID_MEDIA_ENGINE); if (m_mediaEngine.get() == NULL) return FALSE; - + ret = m_mediaEngine->setExternalVideoSource(true, false); m_lstInfo.InsertString(m_lstInfo.GetCount(), _T("setExternalVideoSource enable=true, useTexture=false")); VideoEncoderConfiguration config; - config.dimensions.width = YUVReader::VIDEO_WIDTH; - config.dimensions.height = YUVReader::VIDEO_HEIGHT; + //config.dimensions.width = YUVReader::VIDEO_WIDTH; + //config.dimensions.height = YUVReader::VIDEO_HEIGHT; + config.dimensions.width = WIDHT_HDR; + config.dimensions.height = HEIGHT_HDR; //set video encoder configuration. m_rtcEngine->setVideoEncoderConfiguration(config); @@ -107,7 +111,28 @@ bool PushExternalVideoYUV::InitAgora() m_videoFrame.cropTop = 0; m_videoFrame.format = agora::media::base::VIDEO_PIXEL_I420; m_videoFrame.type = agora::media::base::ExternalVideoFrame::VIDEO_BUFFER_TYPE::VIDEO_BUFFER_RAW_DATA; - m_imgBuffer = new BYTE[YUVReader::VIDEO_FRAME_SIZE]{0}; + m_imgBuffer = new BYTE[YUVReader::VIDEO_FRAME_SIZE]{ 0 }; + + m_imgBuffer16 = new uint16_t[WIDHT_HDR * HEIGHT_HDR * 1.5]{ 0 }; + CString videoUrl = GetExePath() + _T("\\hdr_1280_720.yuv"); + std::string tmp = cs2utf8(videoUrl); + std::ifstream file(tmp, std::ios::binary); + if (!file) { + AfxMessageBox(_T("open hdr file failed")); + } + file.seekg(0, std::ios::end); + std::streamsize fileSize = file.tellg(); + file.seekg(0, std::ios::beg); + if (fileSize % sizeof(uint16_t) != 0) { + AfxMessageBox(_T(" hdr file format is wrong")); + } + std::vector fileBuffer(fileSize); + if (!file.read(fileBuffer.data(), fileSize)) { + AfxMessageBox(_T("read hdr file failed")); + } + file.close(); + uint16_t* uint16Buffer = reinterpret_cast(fileBuffer.data()); + memcpy_s(m_imgBuffer16, fileSize, uint16Buffer, fileSize); m_rtcEngine->startPreview(VIDEO_SOURCE_CUSTOM); return true; @@ -121,10 +146,13 @@ void PushExternalVideoYUV::UnInitAgora() if (m_rtcEngine) { yuvReader.stop(); if (m_imgBuffer) { - delete m_imgBuffer; + delete[] m_imgBuffer; m_imgBuffer = nullptr; } - + if (m_imgBuffer16) { + delete[] m_imgBuffer16; + m_imgBuffer16 = nullptr; + } if (m_joinChannel) m_joinChannel = !m_rtcEngine->leaveChannel(); @@ -153,7 +181,7 @@ void PushExternalVideoYUV::UnInitAgora() BOOL PushExternalVideoYUV::OnInitDialog() { CDialogEx::OnInitDialog(); - + RECT rcArea; m_staVideoArea.GetClientRect(&rcArea); @@ -180,6 +208,8 @@ void PushExternalVideoYUV::ResumeStatus() m_remoteVideoWnd.SetUID(0); m_localVideoWnd.Reset(); m_localVideoWnd.SetUID(0); + mCbHdr.SetCheck(FALSE); + isUseHdr = false; } @@ -244,7 +274,8 @@ void PushExternalVideoYUV::OnClickedButtonJoinchannel() //leave channel in the engine. if (0 == m_rtcEngine->leaveChannel()) { strInfo.Format(_T("leave channel %s"), getCurrentTime()); - + mCbHdr.SetCheck(FALSE); + isUseHdr = false; yuvReader.stop(); m_remoteVideoWnd.Reset(); m_remoteVideoWnd.SetUID(0); @@ -259,9 +290,35 @@ void PushExternalVideoYUV::OnClickedButtonJoinchannel() } void PushExternalVideoYUV::OnYUVRead(int width, int height, unsigned char* buffer, int size) { - memcpy_s(m_imgBuffer, size, buffer, size); - m_videoFrame.buffer = m_imgBuffer; - m_videoFrame.timestamp = m_rtcEngine->getCurrentMonotonicTimeInMs(); + agora::media::base::ColorSpace colorSpace; + if (isUseHdr) + { + m_videoFrame.buffer = m_imgBuffer16; + colorSpace.range= agora::media::base::ColorSpace::RangeID::RANGEID_LIMITED; + colorSpace.transfer = agora::media::base::ColorSpace::TransferID::TRANSFERID_ARIB_STD_B67; + colorSpace.matrix = agora::media::base::ColorSpace::MatrixID::MATRIXID_BT2020_NCL; + colorSpace.primaries = agora::media::base::ColorSpace::PrimaryID::PRIMARYID_BT2020; + m_videoFrame.colorSpace = colorSpace; + m_videoFrame.stride = WIDHT_HDR; + m_videoFrame.height = HEIGHT_HDR; + m_videoFrame.timestamp = m_rtcEngine->getCurrentMonotonicTimeInMs(); + m_videoFrame.format = agora::media::base::VIDEO_PIXEL_I010; + } + else + { + memcpy_s(m_imgBuffer, size, buffer, size); + /*colorSpace.range = agora::media::base::ColorSpace::RangeID::RANGEID_FULL; + colorSpace.transfer = agora::media::base::ColorSpace::TransferID::TRANSFERID_BT709; + colorSpace.matrix = agora::media::base::ColorSpace::MatrixID::MATRIXID_BT709; + colorSpace.primaries = agora::media::base::ColorSpace::PrimaryID::PRIMARYID_BT709;*/ + m_videoFrame.colorSpace = colorSpace; + m_videoFrame.stride = width; + m_videoFrame.height = height; + m_videoFrame.buffer = m_imgBuffer; + m_videoFrame.timestamp = m_rtcEngine->getCurrentMonotonicTimeInMs(); + m_videoFrame.format = agora::media::base::VIDEO_PIXEL_I420; + } + if (m_joinChannel && m_mediaEngine.get() != nullptr) { m_mediaEngine->pushVideoFrame(&m_videoFrame); } @@ -385,7 +442,7 @@ LRESULT PushExternalVideoYUV::OnEIDRemoteVideoStateChanged(WPARAM wParam, LPARAM is called without a user ID specified. The server will automatically assign one parameters: channel:channel name. - uid: user ID¡£If the UID is specified in the joinChannel, that ID is returned here; + uid: user ID��If the UID is specified in the joinChannel, that ID is returned here; Otherwise, use the ID automatically assigned by the Agora server. elapsed: The Time from the joinChannel until this event occurred (ms). */ @@ -407,7 +464,7 @@ void PushExternalVideoYUVEventHandler::onJoinChannelSuccess(const char* channel, parameters: uid: remote user/anchor ID for newly added channel. elapsed: The joinChannel is called from the local user to the delay triggered - by the callback£¨ms). + by the callback��ms). */ void PushExternalVideoYUVEventHandler::onUserJoined(uid_t uid, int elapsed) { @@ -477,3 +534,20 @@ void PushExternalVideoYUVEventHandler::onRemoteVideoStateChanged(uid_t uid, REMO ::PostMessage(m_hMsgHanlder, WM_MSGID(EID_REMOTE_VIDEO_STATE_CHANGED), (WPARAM)stateChanged, 0); } } + + +void PushExternalVideoYUV::OnBnClickedCheckHdr() +{ + agora::rtc::HDR_CAPABILITY capability = agora::rtc::HDR_CAPABILITY::HDR_CAPABILITY_UNKNOWN; + + m_rtcEngine->queryHDRCapability(VIDEO_MODULE_HARDWARE_ENCODER, capability); + if (capability == HDR_CAPABILITY::HDR_CAPABILITY_SUPPORTED) { + isUseHdr = !isUseHdr; + } + else { + isUseHdr = false; + mCbHdr.SetCheck(FALSE); + MessageBox(_T("The current device does not support HDR")); + } + +} diff --git a/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h b/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h index c44640556..072c6e511 100755 --- a/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h +++ b/windows/APIExample/APIExample/Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h @@ -4,6 +4,7 @@ #include "DirectShow/AGDShowVideoCapture.h" #include "YUVReader.h" #include +#include class PushExternalVideoYUVEventHandler : public IRtcEngineEventHandler { @@ -18,7 +19,7 @@ class PushExternalVideoYUVEventHandler : public IRtcEngineEventHandler { is called without a user ID specified. The server will automatically assign one parameters: channel:channel name. - uid: user ID¡£If the UID is specified in the joinChannel, that ID is returned here; + uid: user ID��If the UID is specified in the joinChannel, that ID is returned here; Otherwise, use the ID automatically assigned by the Agora server. elapsed: The Time from the joinChannel until this event occurred (ms). */ @@ -124,7 +125,10 @@ class PushExternalVideoYUV : public CDialogEx bool m_joinChannel = false; bool m_initialize = false; BYTE* m_imgBuffer = nullptr; - + uint16_t* m_imgBuffer16 = nullptr; + const int WIDHT_HDR = 1280; + const int HEIGHT_HDR = 720; + bool isUseHdr = false; DECLARE_MESSAGE_MAP() public: @@ -142,4 +146,7 @@ class PushExternalVideoYUV : public CDialogEx private: YUVReader yuvReader; +public: + afx_msg void OnBnClickedCheckHdr(); + CButton mCbHdr; }; diff --git a/windows/APIExample/APIExample/res/hdr_1280_720.yuv b/windows/APIExample/APIExample/res/hdr_1280_720.yuv new file mode 100644 index 000000000..ff4898a01 Binary files /dev/null and b/windows/APIExample/APIExample/res/hdr_1280_720.yuv differ diff --git a/windows/APIExample/APIExample/resource.h b/windows/APIExample/APIExample/resource.h index e8e8825d1..038d0364e 100755 --- a/windows/APIExample/APIExample/resource.h +++ b/windows/APIExample/APIExample/resource.h @@ -169,6 +169,7 @@ #define IDC_CHECK_REPORT 1054 #define IDC_CHECK_AUDIO_SOURCE_MUTE 1054 #define IDC_CHECK_VIRTUAL_BG 1054 +#define IDC_CHECK_HDR 1054 #define IDC_STATIC_ADUIO_PROFILE 1055 #define IDC_CHK_REPLACE_MICROPHONE 1055 #define IDC_STATIC_ADUIO_SCENARIO 1056 @@ -444,6 +445,7 @@ #define IDC_CHECK4 1167 #define IDC_CHECK_EXTENTION 1167 #define IDC_SLIDER__SHAPE_STYLE_INTENSITY 1168 +#define IDC_COMBO1 1168 #define IDC_COMBO_LASH_STYLE 1169 #define IDC_SLIDER__LASH_STRENGTH 1170 #define IDC_COMBO_LASH_COLOR 1171 @@ -466,7 +468,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 181 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1168 +#define _APS_NEXT_CONTROL_VALUE 1169 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/windows/APIExample/APIExample/stdafx.cpp b/windows/APIExample/APIExample/stdafx.cpp index e818aec38..80205d351 100755 --- a/windows/APIExample/APIExample/stdafx.cpp +++ b/windows/APIExample/APIExample/stdafx.cpp @@ -352,9 +352,17 @@ std::string cs2ANSI(CString str) } CString utf82cs(std::string utf8) { - TCHAR szBuf[2048] = { 0 }; + /* TCHAR szBuf[2048] = { 0 }; MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), 2048, szBuf, 2048); - return szBuf; + return szBuf;*/ + int len = MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, NULL, 0); + if (len == 0) + { + return CString(); + } + std::vector buffer(len); + MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, buffer.data(), len); + return CString(buffer.data()); }