Sunshine master
Self-hosted game stream host for Moonlight.
nvenc_shared_dll.h
Go to the documentation of this file.
1
5#pragma once
6#ifdef _WIN32
7
8 // standard includes
9 #include <memory>
10 #include <type_traits>
11
12 // platform includes
13 #include <Windows.h>
14
15namespace nvenc {
16
20 using shared_dll = std::shared_ptr<std::remove_pointer_t<HMODULE>>;
21
31 void operator()(HMODULE dll) const {
32 if (dll) {
33 FreeLibrary(dll);
34 }
35 }
36 };
37
44 inline shared_dll make_shared_dll(HMODULE dll) {
45 return shared_dll(dll, shared_dll_deleter {});
46 }
47
48} // namespace nvenc
49#endif
Standalone NVENC encoder.
Definition nvenc_base.cpp:185
std::shared_ptr< std::remove_pointer_t< HMODULE > > shared_dll
Shared ownership wrapper for a loaded Windows module.
Definition nvenc_shared_dll.h:20
shared_dll make_shared_dll(HMODULE dll)
Wrap a Windows module handle in shared ownership.
Definition nvenc_shared_dll.h:44
Release a Windows module when its final shared owner is destroyed.
Definition nvenc_shared_dll.h:25
void operator()(HMODULE dll) const
Release the module.
Definition nvenc_shared_dll.h:31