From bee221c18d57395368cf06f0a0f9bca58a0573ae Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 10 Apr 2019 22:23:56 +1000 Subject: [PATCH] [c-host] add ability to provide NvFBC privData --- VERSION | 2 +- .../Windows/capture/NVFBC/src/nvfbc.c | 26 +++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index b0047c76..5bad1341 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -a12-148-gda7c66419a+1 \ No newline at end of file +a12-149-g878eb057d1+1 \ No newline at end of file diff --git a/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c b/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c index 2921699b..f595859c 100644 --- a/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/c-host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -85,13 +85,35 @@ static bool nvfbc_create() if (!NvFBCInit()) return false; - this = (struct iface *)calloc(sizeof(struct iface), 1); + int bufferLen = GetEnvironmentVariable("NVFBC_PRIV_DATA", NULL, 0); + uint8_t * privData = NULL; + int privDataLen = 0; - if (!NvFBCToSysCreate(NULL, 0, &this->nvfbc, &this->maxWidth, &this->maxHeight)) + if(bufferLen) { + char * buffer = malloc(bufferLen); + GetEnvironmentVariable("NVFBC_PRIV_DATA", buffer, bufferLen); + + privDataLen = (bufferLen - 1) / 2; + privData = (uint8_t *)malloc(privDataLen); + char hex[3] = {0}; + for(int i = 0; i < privDataLen; ++i) + { + memcpy(hex, &buffer[i*2], 2); + privData[i] = (uint8_t)strtoul(hex, NULL, 16); + } + + free(buffer); + } + + this = (struct iface *)calloc(sizeof(struct iface), 1); + if (!NvFBCToSysCreate(privData, privDataLen, &this->nvfbc, &this->maxWidth, &this->maxHeight)) + { + free(privData); nvfbc_free(); return false; } + free(privData); this->frameEvent = os_createEvent(true); if (!this->frameEvent)