[c-host] initial stubs for pointer support

This commit is contained in:
Geoffrey McRae 2019-03-04 17:45:19 +11:00
parent 40a1b860bf
commit 496fd79714
4 changed files with 39 additions and 17 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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
};

View File

@ -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
};