From 9a9d84cd1f96badc52091a3bebe84261b2d286fc Mon Sep 17 00:00:00 2001 From: arcnmx Date: Thu, 14 Dec 2017 14:18:31 -0500 Subject: [PATCH] [host] remove ATL, mingw doesn't support it --- host/Capture/DXGI.cpp | 20 ++++++++++---------- host/Capture/DXGI.h | 26 +++++++++++++++++++------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/host/Capture/DXGI.cpp b/host/Capture/DXGI.cpp index 88c56aa9..572c3315 100644 --- a/host/Capture/DXGI.cpp +++ b/host/Capture/DXGI.cpp @@ -26,11 +26,11 @@ using namespace Capture; DXGI::DXGI() : m_options(NULL), m_initialized(false), - m_dxgiFactory(NULL), - m_device(NULL), - m_deviceContext(NULL), - m_dup(NULL), - m_texture(NULL), + m_dxgiFactory(), + m_device(), + m_deviceContext(), + m_dup(), + m_texture(), m_pointer(NULL) { } @@ -56,10 +56,10 @@ bool DXGI::Initialize(CaptureOptions * options) } bool done = false; - CComPtr adapter; + IDXGIAdapter1Ptr adapter; for (int i = 0; m_dxgiFactory->EnumAdapters1(i, &adapter) != DXGI_ERROR_NOT_FOUND; i++) { - CComPtr output; + IDXGIOutputPtr output; for (int i = 0; adapter->EnumOutputs(i, &output) != DXGI_ERROR_NOT_FOUND; i++) { DXGI_OUTPUT_DESC outputDesc; @@ -233,7 +233,7 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame) return GRAB_STATUS_ERROR; DXGI_OUTDUPL_FRAME_INFO frameInfo; - CComPtr res; + IDXGIResourcePtr res; HRESULT status; bool cursorUpdate = false; @@ -363,7 +363,7 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame) return GRAB_STATUS_ERROR; } - CComQIPtr src = res; + ID3D11Texture2DPtr src(res); if (!src) { m_dup->ReleaseFrame(); @@ -380,7 +380,7 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame) res.Release(); src.Release(); - CComQIPtr surface = m_texture; + IDXGISurface1Ptr surface(m_texture); if (!surface) { DEBUG_ERROR("Failed to get IDXGISurface1"); diff --git a/host/Capture/DXGI.h b/host/Capture/DXGI.h index f4749209..8a82a5d7 100644 --- a/host/Capture/DXGI.h +++ b/host/Capture/DXGI.h @@ -25,7 +25,19 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include -#include +#include +#include + +_COM_SMARTPTR_TYPEDEF(IDXGIFactory1, IID_IDXGIFactory1); +_COM_SMARTPTR_TYPEDEF(ID3D11Device, IID_ID3D11Device); +_COM_SMARTPTR_TYPEDEF(ID3D11DeviceContext, IID_ID3D11DeviceContext); +_COM_SMARTPTR_TYPEDEF(IDXGIOutput1, IID_IDXGIOutput1); +_COM_SMARTPTR_TYPEDEF(IDXGIOutput, IID_IDXGIOutput); +_COM_SMARTPTR_TYPEDEF(IDXGIAdapter1, IID_IDXGIAdapter1); +_COM_SMARTPTR_TYPEDEF(IDXGIOutputDuplication, IID_IDXGIOutputDuplication); +_COM_SMARTPTR_TYPEDEF(ID3D11Texture2D, IID_ID3D11Texture2D); +_COM_SMARTPTR_TYPEDEF(IDXGIResource, IID_IDXGIResource); +_COM_SMARTPTR_TYPEDEF(IDXGISurface1, IID_IDXGISurface1); namespace Capture { @@ -61,13 +73,13 @@ namespace Capture unsigned int m_width; unsigned int m_height; - CComPtr m_dxgiFactory; - CComPtr m_device; + IDXGIFactory1Ptr m_dxgiFactory; + ID3D11DevicePtr m_device; D3D_FEATURE_LEVEL m_featureLevel; - CComPtr m_deviceContext; - CComQIPtr m_output; - CComPtr m_dup; - CComPtr m_texture; + ID3D11DeviceContextPtr m_deviceContext; + IDXGIOutput1Ptr m_output; + IDXGIOutputDuplicationPtr m_dup; + ID3D11Texture2DPtr m_texture; BYTE * m_pointer; UINT m_pointerBufSize; UINT m_pointerSize;