mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[c-host] change getFrame/Pointer to return a real status
This commit is contained in:
parent
496fd79714
commit
88c2e55acf
12
c-host/app.c
12
c-host/app.c
@ -86,12 +86,20 @@ static int frameThread(void * opaque)
|
||||
|
||||
while(app.running)
|
||||
{
|
||||
CaptureResult result;
|
||||
CaptureFrame frame;
|
||||
|
||||
frame.data = app.frame[frameIndex];
|
||||
if (!app.iface->getFrame(&frame))
|
||||
result = app.iface->getFrame(&frame);
|
||||
if (result == CAPTURE_RESULT_REINIT)
|
||||
{
|
||||
app.reinit = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == CAPTURE_RESULT_ERROR)
|
||||
{
|
||||
DEBUG_ERROR("Failed to get the frame");
|
||||
app.reinit = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,7 @@ typedef struct CaptureInterface
|
||||
unsigned int (*getMaxFrameSize)();
|
||||
|
||||
CaptureResult (*capture )();
|
||||
|
||||
bool (*getFrame )(CaptureFrame * frame );
|
||||
bool (*getPointer)(CapturePointer * pointer);
|
||||
CaptureResult (*getFrame )(CaptureFrame * frame );
|
||||
CaptureResult (*getPointer)(CapturePointer * pointer);
|
||||
}
|
||||
CaptureInterface;
|
@ -579,22 +579,22 @@ static CaptureResult dxgi_capture(bool * hasFrameUpdate, bool * hasPointerUpdate
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool dxgi_getFrame(CaptureFrame * frame)
|
||||
static CaptureResult dxgi_getFrame(CaptureFrame * frame)
|
||||
{
|
||||
assert(this);
|
||||
assert(this->initialized);
|
||||
|
||||
if (this->reinit)
|
||||
return true;
|
||||
return CAPTURE_RESULT_REINIT;
|
||||
|
||||
if (!os_waitEvent(this->frameEvent, TIMEOUT_INFINITE))
|
||||
{
|
||||
DEBUG_ERROR("Failed to wait on the frame event");
|
||||
return false;
|
||||
return CAPTURE_RESULT_ERROR;
|
||||
}
|
||||
|
||||
if (this->reinit)
|
||||
return true;
|
||||
return CAPTURE_RESULT_REINIT;
|
||||
|
||||
Texture * tex = &this->texture[this->texRIndex];
|
||||
|
||||
@ -610,12 +610,28 @@ static bool dxgi_getFrame(CaptureFrame * frame)
|
||||
if (++this->texRIndex == MAX_TEXTURES)
|
||||
this->texRIndex = 0;
|
||||
|
||||
return true;
|
||||
return CAPTURE_RESULT_OK;
|
||||
}
|
||||
|
||||
static bool dxgi_getPointer(CapturePointer * pointer)
|
||||
static CaptureResult dxgi_getPointer(CapturePointer * pointer)
|
||||
{
|
||||
return false;
|
||||
assert(this);
|
||||
assert(this->initialized);
|
||||
|
||||
if (this->reinit)
|
||||
return CAPTURE_RESULT_REINIT;
|
||||
|
||||
if (!os_waitEvent(this->pointerEvent, TIMEOUT_INFINITE))
|
||||
{
|
||||
DEBUG_ERROR("Failed to wait on the pointer event");
|
||||
return CAPTURE_RESULT_ERROR;
|
||||
}
|
||||
|
||||
if (this->reinit)
|
||||
return CAPTURE_RESULT_REINIT;
|
||||
|
||||
|
||||
return CAPTURE_RESULT_OK;
|
||||
}
|
||||
|
||||
static CaptureResult dxgi_releaseFrame()
|
||||
|
Loading…
Reference in New Issue
Block a user