Skip to content

transparent render for windows #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions windows/APIExample/APIExample/APIExample.rc
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,20 @@ BEGIN
EDITTEXT IDC_EDIT_TOKEN,69,363,128,29,ES_AUTOHSCROLL
END

IDD_DIALOG_TRANSPARENT_BG DIALOGEX 0, 0, 632, 400
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Channel Name",IDC_STATIC_CHANNELNAME,136,360,48,8
EDITTEXT IDC_EDIT_CHANNELNAME,216,358,172,13,ES_AUTOHSCROLL
PUSHBUTTON "JoinChannel",IDC_BUTTON_JOINCHANNEL,420,358,75,14
LTEXT "",IDC_STATIC_DETAIL,23,370,412,27
LTEXT "",IDC_STATIC_VIDEO,0,0,419,147
LTEXT "",IDC_STATIC_VIDEO_RIGHT,233,175,176,136
LTEXT "",IDC_STATIC_VIDEO_LEFT,2,173,171,136
LISTBOX IDC_LIST_INFO_BROADCASTING,491,0,139,312,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
END


/////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -907,6 +921,14 @@ BEGIN
HORZGUIDE, 163
END

IDD_DIALOG_VOLUME, DIALOG
BEGIN
END

IDD_DIALOG_PEPORT_IN_CALL, DIALOG
BEGIN
END

IDD_DIALOG_REGIONAL_CONNECTION, DIALOG
BEGIN
END
Expand Down Expand Up @@ -1048,6 +1070,12 @@ BEGIN
HORZGUIDE, 348
HORZGUIDE, 363
END

IDD_DIALOG_TRANSPARENT_BG, DIALOG
BEGIN
RIGHTMARGIN, 630
BOTTOMMARGIN, 397
END
END
#endif // APSTUDIO_INVOKED

Expand Down Expand Up @@ -1187,6 +1215,11 @@ BEGIN
0
END

IDD_DIALOG_TRANSPARENT_BG AFX_DIALOG_LAYOUT
BEGIN
0
END


/////////////////////////////////////////////////////////////////////////////
//
Expand Down
12 changes: 10 additions & 2 deletions windows/APIExample/APIExample/APIExample.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(solutionDir)ThirdParty\libFFmpeg\include;$(solutionDir)ThirdParty\Boost;$(SolutionDir)sdk\high_level_api\include;$(solutionDir)ThirdParty\libYUV;$(ProjectDir)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
Expand All @@ -121,7 +121,8 @@ if exist zh-cn.ini (copy zh-cn.ini $(SolutionDir)$(Configuration))
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))</Command>
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))</Command>
</PostBuildEvent>
<Manifest>
<AdditionalManifestFiles>
Expand Down Expand Up @@ -167,6 +168,7 @@ if exist en.ini (copy en.ini $(SolutionDir)$(Platform)\$(Configuration))
copy $(SolutionDir)APIExample\Advanced\LocalVideoTranscoding\agora.png $(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))
</Command>
</PostBuildEvent>
<Manifest>
Expand Down Expand Up @@ -267,6 +269,7 @@ if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration))
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="AbstractMediaPlayerSourceObserver.h" />
<ClInclude Include="Advanced\AudioEffect\CAgoraEffectDlg.h" />
<ClInclude Include="Advanced\AudioMixing\CAgoraAudioMixingDlg.h" />
<ClInclude Include="Advanced\AudioProfile\CAgoraAudioProfile.h" />
Expand Down Expand Up @@ -295,6 +298,7 @@ if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration))
<ClInclude Include="Advanced\RTMPStream\AgoraRtmpStreaming.h" />
<ClInclude Include="Advanced\ScreenShare\AgoraScreenCapture.h" />
<ClInclude Include="Advanced\SpatialAudio\CAgoraSpatialAudioDlg.h" />
<ClInclude Include="Advanced\TransparentBg\TransparentBgDialog.h" />
<ClInclude Include="AGVideoTestWnd.h" />
<ClInclude Include="AGVideoWnd.h" />
<ClInclude Include="APIExample.h" />
Expand All @@ -319,6 +323,7 @@ if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration))
<ClInclude Include="YUVReader.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AbstractMediaPlayerSourceObserver.cpp" />
<ClCompile Include="Advanced\AudioEffect\CAgoraEffectDlg.cpp" />
<ClCompile Include="Advanced\AudioMixing\CAgoraAudioMixingDlg.cpp" />
<ClCompile Include="Advanced\AudioProfile\CAgoraAudioProfile.cpp" />
Expand Down Expand Up @@ -347,6 +352,7 @@ if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration))
<ClCompile Include="Advanced\RTMPStream\AgoraRtmpStreaming.cpp" />
<ClCompile Include="Advanced\ScreenShare\AgoraScreenCapture.cpp" />
<ClCompile Include="Advanced\SpatialAudio\CAgoraSpatialAudioDlg.cpp" />
<ClCompile Include="Advanced\TransparentBg\TransparentBgDialog.cpp" />
<ClCompile Include="AGVideoTestWnd.cpp" />
<ClCompile Include="AGVideoWnd.cpp" />
<ClCompile Include="APIExample.cpp" />
Expand Down Expand Up @@ -395,6 +401,7 @@ if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration))
<CopyFileToFolders Include="sample.yuv">
<FileType>Document</FileType>
</CopyFileToFolders>
<None Include="res\wave2.bin" />
<None Include="zh-cn.ini" />
</ItemGroup>
<ItemGroup>
Expand All @@ -418,6 +425,7 @@ if exist sample.yuv (copy sample.yuv $(SolutionDir)$(Platform)\$(Configuration))
<FileType>Document</FileType>
</CopyFileToFolders>
<Media Include="res\ID_TEST_AUDIO.wav" />
<Media Include="res\yuvj_full_range_alpha_1280_540_left.mp4" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
21 changes: 21 additions & 0 deletions windows/APIExample/APIExample/APIExample.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
<Filter Include="Advanced\Metadata">
<UniqueIdentifier>{ed782797-3b06-44a9-8894-6b9d93d0dfea}</UniqueIdentifier>
</Filter>
<Filter Include="Advanced\TransparentBg">
<UniqueIdentifier>{2a74c488-9982-4577-8594-8320c71beb6d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="APIExample.h">
Expand Down Expand Up @@ -264,6 +267,12 @@
<ClInclude Include="Advanced\Metadata\CAgoraMetaDataDlg.h">
<Filter>Advanced\Metadata</Filter>
</ClInclude>
<ClInclude Include="Advanced\TransparentBg\TransparentBgDialog.h">
<Filter>Advanced\TransparentBg</Filter>
</ClInclude>
<ClInclude Include="AbstractMediaPlayerSourceObserver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="APIExample.cpp">
Expand Down Expand Up @@ -404,6 +413,12 @@
<ClCompile Include="Advanced\Metadata\CAgoraMetaDataDlg.cpp">
<Filter>Advanced\Metadata</Filter>
</ClCompile>
<ClCompile Include="Advanced\TransparentBg\TransparentBgDialog.cpp">
<Filter>Advanced\TransparentBg</Filter>
</ClCompile>
<ClCompile Include="AbstractMediaPlayerSourceObserver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="APIExample.rc">
Expand All @@ -420,6 +435,9 @@
<None Include="en.ini">
<Filter>Resource Files</Filter>
</None>
<None Include="res\wave2.bin">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="res\APIExample.ico">
Expand All @@ -442,6 +460,9 @@
<Media Include="res\ID_TEST_AUDIO.wav">
<Filter>Resource Files</Filter>
</Media>
<Media Include="res\yuvj_full_range_alpha_1280_540_left.mp4">
<Filter>Resource Files</Filter>
</Media>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="res\audiomixing.wav">
Expand Down
17 changes: 17 additions & 0 deletions windows/APIExample/APIExample/APIExampleDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ void CAPIExampleDlg::InitSceneDialog()
m_pMultiChannelDlg->Create(CAgoraMultiChannelDlg::IDD);
m_pMultiChannelDlg->MoveWindow(&rcWnd);

//transparent bg
m_vecAdvanced.push_back(TransparentBackground);

//inject
m_pRtmpInjectDlg = new CAgoraRtmpInjectionDlg(&m_staMainArea);
m_pRtmpInjectDlg->Create(CAgoraRtmpInjectionDlg::IDD);
Expand Down Expand Up @@ -382,6 +385,12 @@ void CAPIExampleDlg::InitSceneDialog()
m_pMultiVideoSourceTracks = new MultiVideoSourceTracks(&m_staMainArea);
m_pMultiVideoSourceTracks->Create(MultiVideoSourceTracks::IDD);
m_pMultiVideoSourceTracks->MoveWindow(&rcWnd);

// transparent bg
m_TransparentDlg = new CTransparentBgDlg(&m_staMainArea);
m_TransparentDlg->Create(CTransparentBgDlg::IDD);
m_TransparentDlg->MoveWindow(&rcWnd);

}

void CAPIExampleDlg::InitSceneList()
Expand Down Expand Up @@ -604,6 +613,10 @@ void CAPIExampleDlg::CreateScene(CTreeCtrl& treeScene, CString selectedText)
m_pmediaRecorderDlg->InitAgora();
m_pmediaRecorderDlg->ShowWindow(SW_SHOW);
}
else if (selectedText.Compare(TransparentBackground) == 0) {
m_TransparentDlg->InitAgora();
m_TransparentDlg->ShowWindow(SW_SHOW);
}

//Sleep(500);
}
Expand Down Expand Up @@ -709,6 +722,10 @@ void CAPIExampleDlg::ReleaseScene(CTreeCtrl& treeScene, HTREEITEM& hSelectItem)
m_pmediaRecorderDlg->UnInitAgora();
m_pmediaRecorderDlg->ShowWindow(SW_HIDE);
}
else if (str.Compare(TransparentBackground) == 0) {
m_TransparentDlg->UnInitAgora();
m_TransparentDlg->ShowWindow(SW_HIDE);
}
//Sleep(500);
}

Expand Down
2 changes: 2 additions & 0 deletions windows/APIExample/APIExample/APIExampleDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "Advanced/PushExternalVideoYUV/PushExternalVideoYUV.h"
#include "Advanced/MultiVideoSourceTracks/MultiVideoSourceTracks.h"
#include "Advanced/FaceCapture/CAgoraFaceCaptureDlg.h"
#include "Advanced/TransparentBg/TransparentBgDialog.h"
#include <mutex>
#include <vector>
#include <map>
Expand Down Expand Up @@ -108,6 +109,7 @@ class CAPIExampleDlg : public CDialogEx
MultiVideoSourceTracks *m_pMultiVideoSourceTracks = nullptr;
CAgoraFaceCaptureDlg *m_pAgoraFaceCaptureDlg = nullptr;
CDlgBeauty * m_pDlgBeauty = nullptr;
CTransparentBgDlg* m_TransparentDlg = nullptr;
CString m_preSelectedItemText = _T("");
std::vector<CString> m_vecBasic, m_vecAdvanced;
std::mutex m_mutex;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "AbstractMediaPlayerSourceObserver.h"

void AbstractMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason)
{
}

void AbstractMediaPlayerSourceObserver::onPositionChanged(int64_t positionMs, int64_t timestampMs)
{
}

void AbstractMediaPlayerSourceObserver::onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char *message)
{
}

void AbstractMediaPlayerSourceObserver::onMetaData(const void *data, int length)
{
}

void AbstractMediaPlayerSourceObserver::onPlayBufferUpdated(int64_t playCachedBuffer)
{
}

void AbstractMediaPlayerSourceObserver::onPreloadEvent(const char *src, media::base::PLAYER_PRELOAD_EVENT event)
{
}

void AbstractMediaPlayerSourceObserver::onCompleted()
{
}

void AbstractMediaPlayerSourceObserver::onAgoraCDNTokenWillExpire()
{
}

void AbstractMediaPlayerSourceObserver::onPlayerSrcInfoChanged(const media::base::SrcInfo &from, const media::base::SrcInfo &to)
{
}

void AbstractMediaPlayerSourceObserver::onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo &info)
{
}

void AbstractMediaPlayerSourceObserver::onAudioVolumeIndication(int volume)
{
}
27 changes: 27 additions & 0 deletions windows/APIExample/APIExample/AbstractMediaPlayerSourceObserver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once
#include "stdafx.h"
#include <IAgoraMediaPlayerSource.h>
#include <IAgoraRtcEngine.h>
#include <IAgoraMediaEngine.h>

using namespace agora;
using namespace agora::rtc;
class AbstractMediaPlayerSourceObserver :
public IMediaPlayerSourceObserver
{
public:

virtual void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason) override;
void onPositionChanged(int64_t positionMs, int64_t timestampMs) override;
void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override;
void onMetaData(const void* data, int length) override;
void onPlayBufferUpdated(int64_t playCachedBuffer) override;
void onPreloadEvent(const char* src, media::base::PLAYER_PRELOAD_EVENT event) override;
void onCompleted() override;
void onAgoraCDNTokenWillExpire() override;
void onPlayerSrcInfoChanged(const media::base::SrcInfo& from, const media::base::SrcInfo& to) override;
void onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo& info) override;
void onAudioVolumeIndication(int volume) override;

};

Loading