Sunshine master
Self-hosted game stream host for Moonlight.
nvenc_d3d11.h
Go to the documentation of this file.
1
5#pragma once
6#ifdef _WIN32
7
8 // standard includes
9 #include <comdef.h>
10 #include <d3d11.h>
11
12 // local includes
13 #include "nvenc_base.h"
14
15namespace nvenc {
16
17 #ifdef DOXYGEN
21 using ID3D11DevicePtr = ID3D11Device *;
25 using ID3D11Texture2DPtr = ID3D11Texture2D *;
29 using IDXGIDevicePtr = IDXGIDevice *;
33 using IDXGIAdapterPtr = IDXGIAdapter *;
34 #else
35 _COM_SMARTPTR_TYPEDEF(ID3D11Device, IID_ID3D11Device);
36 _COM_SMARTPTR_TYPEDEF(ID3D11Texture2D, IID_ID3D11Texture2D);
37 _COM_SMARTPTR_TYPEDEF(IDXGIDevice, IID_IDXGIDevice);
38 _COM_SMARTPTR_TYPEDEF(IDXGIAdapter, IID_IDXGIAdapter);
39 #endif
40
45 class nvenc_d3d11: public nvenc_base {
46 public:
52 explicit nvenc_d3d11(NV_ENC_DEVICE_TYPE device_type);
54
59 virtual ID3D11Texture2D *get_input_texture() = 0;
60
61 protected:
62 bool init_library() override;
63 bool wait_for_async_event(uint32_t timeout_ms) override;
64
65 private:
66 HMODULE dll = nullptr;
67 };
68
69} // namespace nvenc
70#endif
Abstract platform-agnostic base of standalone NVENC encoder. Derived classes perform platform-specifi...
Definition nvenc_base.h:26
const NV_ENC_DEVICE_TYPE device_type
NVENC device backend used by this encoder instance.
Definition nvenc_base.h:115
Abstract Direct3D11 NVENC encoder. Encapsulates common code used by native and interop implementation...
Definition nvenc_d3d11.h:45
bool wait_for_async_event(uint32_t timeout_ms) override
Optional. Override if you want to create encoder in async mode. In this case must also set async_even...
Definition nvenc_d3d11.cpp:64
bool init_library() override
Required. Used for loading NvEnc library and setting nvenc variable with NvEncodeAPICreateInstance()....
Definition nvenc_d3d11.cpp:28
nvenc_d3d11(NV_ENC_DEVICE_TYPE device_type)
Initialize an NVENC session wrapper for D3D11 input textures.
Definition nvenc_d3d11.cpp:13
virtual ID3D11Texture2D * get_input_texture()=0
Get input surface texture.
Standalone NVENC encoder.
Definition nvenc_base.cpp:94
IDXGIAdapter * IDXGIAdapterPtr
COM smart pointer for IDXGIAdapter.
Definition nvenc_d3d11.h:33
ID3D11Texture2D * ID3D11Texture2DPtr
COM smart pointer for ID3D11Texture2D.
Definition nvenc_d3d11.h:25
IDXGIDevice * IDXGIDevicePtr
COM smart pointer for IDXGIDevice.
Definition nvenc_d3d11.h:29
ID3D11Device * ID3D11DevicePtr
COM smart pointer for ID3D11Device.
Definition nvenc_d3d11.h:21
Declarations for abstract platform-agnostic base of standalone NVENC encoder.