Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Linux capture interfaces to fix host build #1108

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
19 changes: 12 additions & 7 deletions host/platform/Linux/capture/pipewire/src/pipewire.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ static const char * pipewire_getName(void)
return "PipeWire";
}

static bool pipewire_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPointerBuffer postPointerBufferFn)
static bool pipewire_create(
CaptureGetPointerBuffer getPointerBufferFn,
CapturePostPointerBuffer postPointerBufferFn,
unsigned frameBuffers)
{
DEBUG_ASSERT(!this);
pw_init(NULL, NULL);
Expand Down Expand Up @@ -231,7 +234,7 @@ static const struct pw_stream_events streamEvents = {
.param_changed = streamParamChangedCallback,
};

static bool pipewire_init(void)
static bool pipewire_init(void * ivshmemBase, unsigned * alignSize)
{
DEBUG_ASSERT(this);
this->stop = false;
Expand Down Expand Up @@ -400,7 +403,8 @@ static void pipewire_free(void)
this = NULL;
}

static CaptureResult pipewire_capture(void)
static CaptureResult pipewire_capture(
unsigned frameBufferIndex, FrameBuffer * frameBuffer)
{
int result;

Expand All @@ -424,8 +428,8 @@ static CaptureResult pipewire_capture(void)
return CAPTURE_RESULT_OK;
}

static CaptureResult pipewire_waitFrame(CaptureFrame * frame,
const size_t maxFrameSize)
static CaptureResult pipewire_waitFrame(unsigned frameBufferIndex,
CaptureFrame * frame, const size_t maxFrameSize)
{
if (this->stop)
return CAPTURE_RESULT_REINIT;
Expand Down Expand Up @@ -454,12 +458,13 @@ static CaptureResult pipewire_waitFrame(CaptureFrame * frame,
return CAPTURE_RESULT_OK;
}

static CaptureResult pipewire_getFrame(FrameBuffer * frame, int frameIndex)
static CaptureResult pipewire_getFrame(unsigned frameBufferIndex,
FrameBuffer * frameBuffer, const size_t maxFrameSize)
{
if (this->stop || !this->frameData)
return CAPTURE_RESULT_REINIT;

framebuffer_write(frame, this->frameData,
framebuffer_write(frameBuffer, this->frameData,
this->dataHeight * this->pitch);

pw_thread_loop_accept(this->threadLoop);
Expand Down
Loading