mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-09-20 01:11:32 +00:00
[host] app: cleanup local variables during init.
This commit is contained in:
parent
6b65c7e339
commit
ad65561511
@ -815,45 +815,47 @@ int app_main(int argc, char * argv[])
|
|||||||
int throttleUs = throttleFps ? 1000000 / throttleFps : 0;
|
int throttleUs = throttleFps ? 1000000 / throttleFps : 0;
|
||||||
uint64_t previousFrameTime = 0;
|
uint64_t previousFrameTime = 0;
|
||||||
|
|
||||||
const char * ifaceName = option_get_string("app", "capture");
|
|
||||||
CaptureInterface * iface = NULL;
|
|
||||||
for(int i = 0; CaptureInterfaces[i]; ++i)
|
|
||||||
{
|
{
|
||||||
iface = CaptureInterfaces[i];
|
const char * ifaceName = option_get_string("app", "capture");
|
||||||
if (*ifaceName && strcasecmp(ifaceName, iface->shortName))
|
CaptureInterface * iface = NULL;
|
||||||
continue;
|
for(int i = 0; CaptureInterfaces[i]; ++i)
|
||||||
|
|
||||||
DEBUG_INFO("Trying : %s", iface->getName());
|
|
||||||
|
|
||||||
if (!iface->create(captureGetPointerBuffer, capturePostPointerBuffer))
|
|
||||||
{
|
{
|
||||||
|
iface = CaptureInterfaces[i];
|
||||||
|
if (*ifaceName && strcasecmp(ifaceName, iface->shortName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
DEBUG_INFO("Trying : %s", iface->getName());
|
||||||
|
|
||||||
|
if (!iface->create(captureGetPointerBuffer, capturePostPointerBuffer))
|
||||||
|
{
|
||||||
|
iface = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iface->init())
|
||||||
|
break;
|
||||||
|
|
||||||
|
iface->free();
|
||||||
iface = NULL;
|
iface = NULL;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iface->init())
|
if (!iface)
|
||||||
break;
|
{
|
||||||
|
if (*ifaceName)
|
||||||
|
DEBUG_ERROR("Specified capture interface not supported");
|
||||||
|
else
|
||||||
|
DEBUG_ERROR("Failed to find a supported capture interface");
|
||||||
|
exitcode = LG_HOST_EXIT_FAILED;
|
||||||
|
goto fail_lgmp;
|
||||||
|
}
|
||||||
|
|
||||||
iface->free();
|
DEBUG_INFO("Using : %s", iface->getName());
|
||||||
iface = NULL;
|
DEBUG_INFO("Capture Method : %s", iface->asyncCapture ?
|
||||||
|
"Asynchronous" : "Synchronous");
|
||||||
|
|
||||||
|
app.iface = iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!iface)
|
|
||||||
{
|
|
||||||
if (*ifaceName)
|
|
||||||
DEBUG_ERROR("Specified capture interface not supported");
|
|
||||||
else
|
|
||||||
DEBUG_ERROR("Failed to find a supported capture interface");
|
|
||||||
exitcode = LG_HOST_EXIT_FAILED;
|
|
||||||
goto fail_lgmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_INFO("Using : %s", iface->getName());
|
|
||||||
DEBUG_INFO("Capture Method : %s", iface->asyncCapture ?
|
|
||||||
"Asynchronous" : "Synchronous");
|
|
||||||
|
|
||||||
app.iface = iface;
|
|
||||||
|
|
||||||
if (!lgmpSetup(&shmDev))
|
if (!lgmpSetup(&shmDev))
|
||||||
{
|
{
|
||||||
exitcode = LG_HOST_EXIT_FATAL;
|
exitcode = LG_HOST_EXIT_FATAL;
|
||||||
@ -928,14 +930,14 @@ int app_main(int argc, char * argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t captureStart = microtime();
|
const uint64_t captureStart = microtime();
|
||||||
switch(iface->capture())
|
switch(app.iface->capture())
|
||||||
{
|
{
|
||||||
case CAPTURE_RESULT_OK:
|
case CAPTURE_RESULT_OK:
|
||||||
previousFrameTime = captureStart;
|
previousFrameTime = captureStart;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAPTURE_RESULT_TIMEOUT:
|
case CAPTURE_RESULT_TIMEOUT:
|
||||||
if (!iface->asyncCapture)
|
if (!app.iface->asyncCapture)
|
||||||
if (app.frameValid && lgmpHostQueueNewSubs(app.frameQueue) > 0)
|
if (app.frameValid && lgmpHostQueueNewSubs(app.frameQueue) > 0)
|
||||||
{
|
{
|
||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
@ -956,7 +958,7 @@ int app_main(int argc, char * argv[])
|
|||||||
goto fail_capture;
|
goto fail_capture;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!iface->asyncCapture)
|
if (!app.iface->asyncCapture)
|
||||||
sendFrame();
|
sendFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,7 +989,7 @@ fail_threads:
|
|||||||
captureStop();
|
captureStop();
|
||||||
|
|
||||||
fail_capture:
|
fail_capture:
|
||||||
iface->free();
|
app.iface->free();
|
||||||
LG_LOCK_FREE(app.pointerLock);
|
LG_LOCK_FREE(app.pointerLock);
|
||||||
|
|
||||||
fail_lgmp:
|
fail_lgmp:
|
||||||
|
Loading…
Reference in New Issue
Block a user