Skip to content

Commit

Permalink
[host] xcb: update capture interface functions
Browse files Browse the repository at this point in the history
  • Loading branch information
VMFortress committed Feb 12, 2024
1 parent acb8824 commit e42f4b6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions host/platform/Linux/capture/XCB/src/xcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ static void xcb_initOptions(void)
option_register(options);
}

static bool xcb_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPointerBuffer postPointerBufferFn)
static bool xcb_create(
CaptureGetPointerBuffer getPointerBufferFn,
CapturePostPointerBuffer postPointerBufferFn,
unsigned frameBuffers)
{
DEBUG_ASSERT(!this);
this = calloc(1, sizeof(*this));
Expand All @@ -106,7 +109,7 @@ static bool xcb_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPo
return true;
}

static bool xcb_init(void)
static bool xcb_init(void * ivshmemBase, unsigned * alignSize)
{
DEBUG_ASSERT(this);
DEBUG_ASSERT(!this->initialized);
Expand Down Expand Up @@ -241,7 +244,8 @@ static void xcb_free(void)
this = NULL;
}

static CaptureResult xcb_capture(void)
static CaptureResult xcb_capture(
unsigned frameBufferIndex, FrameBuffer * frameBuffer)
{
DEBUG_ASSERT(this);
DEBUG_ASSERT(this->initialized);
Expand All @@ -266,8 +270,8 @@ static CaptureResult xcb_capture(void)
return CAPTURE_RESULT_OK;
}

static CaptureResult xcb_waitFrame(CaptureFrame * frame,
const size_t maxFrameSize)
static CaptureResult xcb_waitFrame(unsigned frameBufferIndex,
CaptureFrame * frame, const size_t maxFrameSize)
{
lgWaitEvent(this->frameEvent, TIMEOUT_INFINITE);

Expand All @@ -290,7 +294,8 @@ static CaptureResult xcb_waitFrame(CaptureFrame * frame,
return CAPTURE_RESULT_OK;
}

static CaptureResult xcb_getFrame(FrameBuffer * frame, int frameIndex)
static CaptureResult xcb_getFrame(unsigned frameBufferIndex,
FrameBuffer * frameBuffer, const size_t maxFrameSize)
{
DEBUG_ASSERT(this);
DEBUG_ASSERT(this->initialized);
Expand All @@ -303,7 +308,7 @@ static CaptureResult xcb_getFrame(FrameBuffer * frame, int frameIndex)
return CAPTURE_RESULT_ERROR;
}

framebuffer_write(frame, this->data, this->pitch);
framebuffer_write(frameBuffer, this->data, this->pitch);
free(img);

this->hasFrame = false;
Expand Down Expand Up @@ -371,7 +376,7 @@ static int pointerThread(void * unused)
pointer.height = curReply->height;
pointer.pitch = curReply->width * 4;

this->postPointerBufferFn(pointer);
this->postPointerBufferFn(&pointer);
}

free(curReply);
Expand Down

0 comments on commit e42f4b6

Please sign in to comment.