From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../modules/desktop_capture/win/d3d_device.h | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 third_party/libwebrtc/modules/desktop_capture/win/d3d_device.h (limited to 'third_party/libwebrtc/modules/desktop_capture/win/d3d_device.h') diff --git a/third_party/libwebrtc/modules/desktop_capture/win/d3d_device.h b/third_party/libwebrtc/modules/desktop_capture/win/d3d_device.h new file mode 100644 index 0000000000..aeb9d1823a --- /dev/null +++ b/third_party/libwebrtc/modules/desktop_capture/win/d3d_device.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ +#define MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ + +#include +#include +#include +#include + +#include + +namespace webrtc { + +// A wrapper of ID3D11Device and its corresponding context and IDXGIAdapter. +// This class represents one video card in the system. +class D3dDevice { + public: + D3dDevice(const D3dDevice& other); + D3dDevice(D3dDevice&& other); + ~D3dDevice(); + + ID3D11Device* d3d_device() const { return d3d_device_.Get(); } + + ID3D11DeviceContext* context() const { return context_.Get(); } + + IDXGIDevice* dxgi_device() const { return dxgi_device_.Get(); } + + IDXGIAdapter* dxgi_adapter() const { return dxgi_adapter_.Get(); } + + // Returns all D3dDevice instances on the system. Returns an empty vector if + // anything wrong. + static std::vector EnumDevices(); + + private: + // Instances of D3dDevice should only be created by EnumDevices() static + // function. + D3dDevice(); + + // Initializes the D3dDevice from an IDXGIAdapter. + bool Initialize(const Microsoft::WRL::ComPtr& adapter); + + Microsoft::WRL::ComPtr d3d_device_; + Microsoft::WRL::ComPtr context_; + Microsoft::WRL::ComPtr dxgi_device_; + Microsoft::WRL::ComPtr dxgi_adapter_; +}; + +} // namespace webrtc + +#endif // MODULES_DESKTOP_CAPTURE_WIN_D3D_DEVICE_H_ -- cgit v1.2.3