diff --git a/c-host/app.c b/c-host/app.c index 55c4c39f..50d75cd3 100644 --- a/c-host/app.c +++ b/c-host/app.c @@ -288,10 +288,7 @@ int app_main() } app.reinit = false; - bool frameUpdate = false; - bool pointerUpdate = false; - - switch(iface->capture(&frameUpdate, &pointerUpdate)) + switch(iface->capture()) { case CAPTURE_RESULT_OK: break; diff --git a/c-host/capture/interface.h b/c-host/capture/interface.h index a9b89669..4cc9d174 100644 --- a/c-host/capture/interface.h +++ b/c-host/capture/interface.h @@ -33,10 +33,17 @@ CaptureResult; typedef enum CaptureFormat { - CAPTURE_FMT_BGRA, - CAPTURE_FMT_RGBA, + // frame formats + CAPTURE_FMT_BGRA , + CAPTURE_FMT_RGBA , CAPTURE_FMT_RGBA10, CAPTURE_FMT_YUV420, + + // pointer formats + CAPTURE_FMT_COLOR , + CAPTURE_FMT_MONO , + CAPTURE_FMT_MASKED, + CAPTURE_FMT_MAX } CaptureFormat; @@ -52,6 +59,16 @@ typedef struct CaptureFrame } CaptureFrame; +typedef struct CapturePointer +{ + int x, y; + CaptureFormat format; + unsigned int width, height; + unsigned int pitch; + void * data; +} +CapturePointer; + typedef struct CaptureInterface { const char * (*getName )(); @@ -61,10 +78,9 @@ typedef struct CaptureInterface void (*free )(); unsigned int (*getMaxFrameSize)(); - CaptureResult (*capture)( - bool * hasFrameUpdate, - bool * hasPointerUpdate); + CaptureResult (*capture)(); - bool (*getFrame)(CaptureFrame * frame); + bool (*getFrame )(CaptureFrame * frame ); + bool (*getPointer)(CapturePointer * pointer); } CaptureInterface; \ No newline at end of file diff --git a/c-host/linux/capture/xcb.c b/c-host/linux/capture/xcb.c index c65535f1..b4939e36 100644 --- a/c-host/linux/capture/xcb.c +++ b/c-host/linux/capture/xcb.c @@ -168,7 +168,7 @@ static unsigned int xcb_getMaxFrameSize() return this->width * this->height * 4; } -static CaptureResult xcb_capture(bool * hasFrameUpdate, bool * hasPointerUpdate) +static CaptureResult xcb_capture() { assert(this); assert(this->initialized); @@ -186,7 +186,6 @@ static CaptureResult xcb_capture(bool * hasFrameUpdate, bool * hasPointerUpdate) this->seg, 0); - *hasFrameUpdate = true; this->hasFrame = true; os_signalEvent(this->frameEvent); } @@ -223,6 +222,11 @@ static bool xcb_getFrame(CaptureFrame * frame) return true; } +static bool xcb_getPointer(CapturePointer * pointer) +{ + return false; +} + struct CaptureInterface Capture_XCB = { .getName = xcb_getName, @@ -232,5 +236,6 @@ struct CaptureInterface Capture_XCB = .free = xcb_free, .getMaxFrameSize = xcb_getMaxFrameSize, .capture = xcb_capture, - .getFrame = xcb_getFrame + .getFrame = xcb_getFrame, + .getPointer = xcb_getPointer }; \ No newline at end of file diff --git a/c-host/windows/capture/dxgi.c b/c-host/windows/capture/dxgi.c index ecf80d52..14870710 100644 --- a/c-host/windows/capture/dxgi.c +++ b/c-host/windows/capture/dxgi.c @@ -472,7 +472,7 @@ static unsigned int dxgi_getMaxFrameSize() return this->height * this->pitch; } -inline static CaptureResult dxgi_capture_int(bool * hasFrameUpdate, bool * hasPointerUpdate) +inline static CaptureResult dxgi_capture_int() { assert(this); assert(this->initialized); @@ -553,14 +553,12 @@ inline static CaptureResult dxgi_capture_int(bool * hasFrameUpdate, bool * hasPo this->texWIndex = 0; ID3D11Texture2D_Release(src); - *hasFrameUpdate = true; } } if (frameInfo.PointerShapeBufferSize > 0) { os_signalEvent(this->pointerEvent); - *hasPointerUpdate = true; } IDXGIResource_Release(res); @@ -615,6 +613,11 @@ static bool dxgi_getFrame(CaptureFrame * frame) return true; } +static bool dxgi_getPointer(CapturePointer * pointer) +{ + return false; +} + static CaptureResult dxgi_releaseFrame() { assert(this); @@ -656,5 +659,6 @@ struct CaptureInterface Capture_DXGI = .free = dxgi_free, .getMaxFrameSize = dxgi_getMaxFrameSize, .capture = dxgi_capture, - .getFrame = dxgi_getFrame + .getFrame = dxgi_getFrame, + .getPointer = dxgi_getPointer }; \ No newline at end of file