Sunshine master
Self-hosted game stream host for Moonlight.
nvenc::nvenc_dynamic_factory Class Reference

Factory bound to the newest NVENC SDK supported by the installed driver. More...

#include <src/nvenc/nvenc_dynamic_factory.h>

Public Types

using create_encoder_fn
 SDK-specific encoder constructor.
 

Public Member Functions

std::unique_ptr< nvenc_d3d11_interfacecreate_nvenc_d3d11_native (ID3D11Device *d3d_device) const
 Create a native Direct3D11 NVENC encoder.
 
std::unique_ptr< nvenc_d3d11_interfacecreate_nvenc_d3d11_on_cuda (ID3D11Device *d3d_device) const
 Create a CUDA NVENC encoder with Direct3D11 input surfaces.
 
 nvenc_dynamic_factory (shared_dll dll, nvenc_sdk_version sdk_version, create_encoder_fn create_native, create_encoder_fn create_on_cuda)
 Construct a factory bound to one NVENC SDK implementation.
 
nvenc_sdk_version sdk_version () const
 Get the SDK implementation selected for this factory.
 

Static Public Member Functions

static std::shared_ptr< nvenc_dynamic_factoryget ()
 Load the NVENC driver and select a compatible SDK implementation.
 
static std::shared_ptr< nvenc_dynamic_factoryget (const nvenc_runtime_api &runtime_api)
 Select a compatible SDK implementation using the supplied runtime operations.
 

Detailed Description

Factory bound to the newest NVENC SDK supported by the installed driver.

Member Typedef Documentation

◆ create_encoder_fn

Initial value:
std::function<std::unique_ptr<nvenc_d3d11_interface>(ID3D11Device *, shared_dll)>
std::shared_ptr< std::remove_pointer_t< HMODULE > > shared_dll
Shared ownership wrapper for a loaded Windows module.
Definition nvenc_shared_dll.h:20

SDK-specific encoder constructor.

Constructor & Destructor Documentation

◆ nvenc_dynamic_factory()

nvenc::nvenc_dynamic_factory::nvenc_dynamic_factory ( shared_dll dll,
nvenc_sdk_version sdk_version,
create_encoder_fn create_native,
create_encoder_fn create_on_cuda )

Construct a factory bound to one NVENC SDK implementation.

Parameters
dllShared NVENC driver module.
sdk_versionSelected SDK version.
create_nativeNative Direct3D11 encoder constructor.
create_on_cudaCUDA-interoperability encoder constructor.

Member Function Documentation

◆ create_nvenc_d3d11_native()

std::unique_ptr< nvenc_d3d11_interface > nvenc::nvenc_dynamic_factory::create_nvenc_d3d11_native ( ID3D11Device * d3d_device) const

Create a native Direct3D11 NVENC encoder.

Parameters
d3d_deviceDirect3D11 device used for encoding.
Returns
SDK-neutral encoder instance.

◆ create_nvenc_d3d11_on_cuda()

std::unique_ptr< nvenc_d3d11_interface > nvenc::nvenc_dynamic_factory::create_nvenc_d3d11_on_cuda ( ID3D11Device * d3d_device) const

Create a CUDA NVENC encoder with Direct3D11 input surfaces.

Parameters
d3d_deviceDirect3D11 device used to create input textures.
Returns
SDK-neutral encoder instance.

◆ get() [1/2]

std::shared_ptr< nvenc_dynamic_factory > nvenc::nvenc_dynamic_factory::get ( )
static

Load the NVENC driver and select a compatible SDK implementation.

Returns
Initialized factory, or an empty pointer when NVENC is unavailable.

◆ get() [2/2]

std::shared_ptr< nvenc_dynamic_factory > nvenc::nvenc_dynamic_factory::get ( const nvenc_runtime_api & runtime_api)
static

Select a compatible SDK implementation using the supplied runtime operations.

Parameters
runtime_apiRuntime operations used to load and query the NVENC driver.
Returns
Initialized factory, or an empty pointer when NVENC is unavailable.

◆ sdk_version()

nvenc_sdk_version nvenc::nvenc_dynamic_factory::sdk_version ( ) const

Get the SDK implementation selected for this factory.

Returns
Selected NVENC SDK version.

The documentation for this class was generated from the following files: