mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[host] NvFBC: user specified privateData for debug
This commit is contained in:
parent
027b27dda1
commit
5518ccb795
@ -34,6 +34,8 @@ using namespace Capture;
|
|||||||
#define NVFBC_LIBRARY_NAME "NvFBC.dll"
|
#define NVFBC_LIBRARY_NAME "NvFBC.dll"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MOPT "privData"
|
||||||
|
|
||||||
NvFBC::NvFBC() :
|
NvFBC::NvFBC() :
|
||||||
m_options(NULL),
|
m_options(NULL),
|
||||||
m_optNoCrop(false),
|
m_optNoCrop(false),
|
||||||
@ -60,10 +62,36 @@ bool NvFBC::Initialize(CaptureOptions * options)
|
|||||||
|
|
||||||
m_options = options;
|
m_options = options;
|
||||||
m_optNoCrop = false;
|
m_optNoCrop = false;
|
||||||
|
|
||||||
|
uint8_t * privData = NULL;
|
||||||
|
NvU32 privDataSize = 0;
|
||||||
|
|
||||||
for (CaptureOptions::const_iterator it = options->cbegin(); it != options->cend(); ++it)
|
for (CaptureOptions::const_iterator it = options->cbegin(); it != options->cend(); ++it)
|
||||||
{
|
{
|
||||||
if (_strcmpi(*it, "nocrop") == 0) { m_optNoCrop = false; continue; }
|
if (_strcmpi(*it, "nocrop") == 0) { m_optNoCrop = false; continue; }
|
||||||
if (_strcmpi(*it, "nowait") == 0) { m_optNoWait = true ; continue; }
|
if (_strcmpi(*it, "nowait") == 0) { m_optNoWait = true ; continue; }
|
||||||
|
|
||||||
|
if (_strnicmp(*it, MOPT " ", sizeof(MOPT)) == 0)
|
||||||
|
{
|
||||||
|
std::string value(*it);
|
||||||
|
value.erase(0, sizeof(MOPT));
|
||||||
|
|
||||||
|
if (value.empty() || value.length() & 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
privDataSize = (NvU32)(value.length() / 2);
|
||||||
|
privData = new uint8_t[privDataSize];
|
||||||
|
uint8_t *p = privData;
|
||||||
|
for (int i = 0; i < value.length(); i += 2, ++p)
|
||||||
|
{
|
||||||
|
char hex[3];
|
||||||
|
#pragma warning(disable:4996)
|
||||||
|
value.copy(hex, 2, i);
|
||||||
|
#pragma warning(restore:4996)
|
||||||
|
hex[2] = 0;
|
||||||
|
*p = (uint8_t)strtoul(hex, NULL, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string nvfbc = Util::GetSystemRoot() + "\\" + NVFBC_LIBRARY_NAME;
|
std::string nvfbc = Util::GetSystemRoot() + "\\" + NVFBC_LIBRARY_NAME;
|
||||||
@ -142,18 +170,26 @@ bool NvFBC::Initialize(CaptureOptions * options)
|
|||||||
|
|
||||||
NvFBCCreateParams params;
|
NvFBCCreateParams params;
|
||||||
ZeroMemory(¶ms, sizeof(NvFBCCreateParams));
|
ZeroMemory(¶ms, sizeof(NvFBCCreateParams));
|
||||||
params.dwVersion = NVFBC_CREATE_PARAMS_VER;
|
params.dwVersion = NVFBC_CREATE_PARAMS_VER;
|
||||||
params.dwInterfaceType = NVFBC_TO_SYS;
|
params.dwInterfaceType = NVFBC_TO_SYS;
|
||||||
params.pDevice = NULL;
|
params.pDevice = NULL;
|
||||||
params.dwAdapterIdx = 0;
|
params.dwAdapterIdx = 0;
|
||||||
|
params.dwPrivateDataSize = privDataSize;
|
||||||
|
params.pPrivateData = privData;
|
||||||
|
|
||||||
if (m_fnCreateEx(¶ms) != NVFBC_SUCCESS)
|
if (m_fnCreateEx(¶ms) != NVFBC_SUCCESS)
|
||||||
{
|
{
|
||||||
|
if (privData)
|
||||||
|
delete [] privData;
|
||||||
|
|
||||||
DEBUG_ERROR("Failed to create an instance of NvFBC");
|
DEBUG_ERROR("Failed to create an instance of NvFBC");
|
||||||
DeInitialize();
|
DeInitialize();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (privData)
|
||||||
|
delete[] privData;
|
||||||
|
|
||||||
m_maxCaptureWidth = params.dwMaxDisplayWidth;
|
m_maxCaptureWidth = params.dwMaxDisplayWidth;
|
||||||
m_maxCaptureHeight = params.dwMaxDisplayHeight;
|
m_maxCaptureHeight = params.dwMaxDisplayHeight;
|
||||||
m_nvFBC = static_cast<NvFBCToSys *>(params.pNvFBC);
|
m_nvFBC = static_cast<NvFBCToSys *>(params.pNvFBC);
|
||||||
|
Loading…
Reference in New Issue
Block a user