mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[host] added DXGI Desktop Duplication support
This commit is contained in:
parent
44d7e9e77c
commit
7d83af9410
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[submodule "vendor/kvm-guest-drivers-windows"]
|
[submodule "vendor/kvm-guest-drivers-windows"]
|
||||||
path = vendor/kvm-guest-drivers-windows
|
path = vendor/kvm-guest-drivers-windows
|
||||||
url = https://github.com/virtio-win/kvm-guest-drivers-windows.git
|
url = https://github.com/virtio-win/kvm-guest-drivers-windows.git
|
||||||
|
[submodule "vendor/DXGICaptureSample"]
|
||||||
|
path = vendor/DXGICaptureSample
|
||||||
|
url = https://github.com/pgurenko/DXGICaptureSample.git
|
||||||
|
@ -19,10 +19,12 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "DXGI.h"
|
#include "DXGI.h"
|
||||||
using namespace Capture;
|
using namespace Capture;
|
||||||
|
|
||||||
DXGI::DXGI() :
|
#include "common\debug.h"
|
||||||
m_initialized(false)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
DXGI::DXGI() :
|
||||||
|
m_initialized(false),
|
||||||
|
m_manager(NULL)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DXGI::~DXGI()
|
DXGI::~DXGI()
|
||||||
@ -35,12 +37,32 @@ bool DXGI::Initialize()
|
|||||||
if (m_initialized)
|
if (m_initialized)
|
||||||
DeInitialize();
|
DeInitialize();
|
||||||
|
|
||||||
|
if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("CoInitializeEx failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_manager = new DXGIManager();
|
||||||
|
m_manager->SetCaptureSource(CSDesktop);
|
||||||
|
|
||||||
|
RECT rect;
|
||||||
|
m_manager->GetOutputRect(rect);
|
||||||
|
m_width = rect.right - rect.left;
|
||||||
|
m_height = rect.bottom - rect.top;
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DXGI::DeInitialize()
|
void DXGI::DeInitialize()
|
||||||
{
|
{
|
||||||
|
if (m_manager)
|
||||||
|
{
|
||||||
|
delete m_manager;
|
||||||
|
m_manager = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +71,7 @@ FrameType DXGI::GetFrameType()
|
|||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
return FRAME_TYPE_INVALID;
|
return FRAME_TYPE_INVALID;
|
||||||
|
|
||||||
return FrameType();
|
return FRAME_TYPE_ARGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameComp DXGI::GetFrameCompression()
|
FrameComp DXGI::GetFrameCompression()
|
||||||
@ -57,15 +79,39 @@ FrameComp DXGI::GetFrameCompression()
|
|||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
return FRAME_COMP_NONE;
|
return FRAME_COMP_NONE;
|
||||||
|
|
||||||
return FrameComp();
|
return FRAME_COMP_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DXGI::GetMaxFrameSize()
|
size_t DXGI::GetMaxFrameSize()
|
||||||
{
|
{
|
||||||
return size_t();
|
if (!m_initialized);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return m_width * m_height * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DXGI::GrabFrame(FrameInfo & frame)
|
bool DXGI::GrabFrame(FrameInfo & frame)
|
||||||
{
|
{
|
||||||
return false;
|
RECT rect;
|
||||||
|
m_manager->GetOutputRect(rect);
|
||||||
|
m_width = rect.right - rect.left;
|
||||||
|
m_height = rect.bottom - rect.top;
|
||||||
|
|
||||||
|
HRESULT result;
|
||||||
|
for(int i = 0; i < 2; ++i)
|
||||||
|
{
|
||||||
|
result = m_manager->GetOutputBits((BYTE*)frame.buffer, rect);
|
||||||
|
if (SUCCEEDED(result))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(result))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
frame.width = m_width;
|
||||||
|
frame.height = m_height;
|
||||||
|
frame.stride = m_width;
|
||||||
|
frame.outSize = m_width * m_height * 4;
|
||||||
|
return true;
|
||||||
}
|
}
|
@ -19,6 +19,10 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ICapture.h"
|
#include "ICapture.h"
|
||||||
|
#include <vendor\DXGICaptureSample\DXGICaptureSample\DXGIManager.h>
|
||||||
|
|
||||||
|
#define W32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
namespace Capture
|
namespace Capture
|
||||||
{
|
{
|
||||||
@ -35,6 +39,9 @@ namespace Capture
|
|||||||
bool GrabFrame(struct FrameInfo & frame);
|
bool GrabFrame(struct FrameInfo & frame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
|
DXGIManager * m_manager;
|
||||||
|
unsigned int m_width;
|
||||||
|
unsigned int m_height;
|
||||||
};
|
};
|
||||||
};
|
};
|
@ -96,7 +96,7 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;d3d11.lib;dxgi.lib;gdiplus.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
@ -113,7 +113,7 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;d3d11.lib;dxgi.lib;gdiplus.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
@ -134,7 +134,7 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;d3d11.lib;dxgi.lib;gdiplus.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
@ -155,11 +155,12 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;setupapi.lib;d3d11.lib;dxgi.lib;gdiplus.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\vendor\DXGICaptureSample\DXGICaptureSample\DXGIManager.cpp" />
|
||||||
<ClCompile Include="Capture\DXGI.cpp" />
|
<ClCompile Include="Capture\DXGI.cpp" />
|
||||||
<ClCompile Include="Capture\NvFBC.cpp" />
|
<ClCompile Include="Capture\NvFBC.cpp" />
|
||||||
<ClCompile Include="ivshmem.cpp" />
|
<ClCompile Include="ivshmem.cpp" />
|
||||||
@ -168,6 +169,7 @@
|
|||||||
<ClCompile Include="Service.cpp" />
|
<ClCompile Include="Service.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\vendor\DXGICaptureSample\DXGICaptureSample\DXGIManager.h" />
|
||||||
<ClInclude Include="CaptureFactory.h" />
|
<ClInclude Include="CaptureFactory.h" />
|
||||||
<ClInclude Include="Capture\DXGI.h" />
|
<ClInclude Include="Capture\DXGI.h" />
|
||||||
<ClInclude Include="Capture\NvFBC.h" />
|
<ClInclude Include="Capture\NvFBC.h" />
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
<ClCompile Include="Capture\DXGI.cpp">
|
<ClCompile Include="Capture\DXGI.cpp">
|
||||||
<Filter>Source Files\Capture</Filter>
|
<Filter>Source Files\Capture</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\vendor\DXGICaptureSample\DXGICaptureSample\DXGIManager.cpp">
|
||||||
|
<Filter>Source Files\Capture</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="ivshmem.h">
|
<ClInclude Include="ivshmem.h">
|
||||||
@ -65,5 +68,8 @@
|
|||||||
<ClInclude Include="Capture\DXGI.h">
|
<ClInclude Include="Capture\DXGI.h">
|
||||||
<Filter>Header Files\Capture</Filter>
|
<Filter>Header Files\Capture</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\vendor\DXGICaptureSample\DXGICaptureSample\DXGIManager.h">
|
||||||
|
<Filter>Header Files\Capture</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
1
vendor/DXGICaptureSample
vendored
Submodule
1
vendor/DXGICaptureSample
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 9e304f24b5b11bbd1c61a9c1c528693cd2843c5d
|
Loading…
Reference in New Issue
Block a user