2017-10-31 16:53:06 +00:00
|
|
|
/*
|
2017-12-03 15:31:16 +00:00
|
|
|
Looking Glass - KVM FrameRelay (KVMFR) Client
|
2017-10-31 16:53:06 +00:00
|
|
|
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
|
2017-12-11 17:30:47 +00:00
|
|
|
https://looking-glass.hostfission.com
|
2017-10-31 16:53:06 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2017-10-31 12:21:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-12-03 15:31:16 +00:00
|
|
|
#include "common/KVMFR.h"
|
2017-11-16 09:53:22 +00:00
|
|
|
#include <vector>
|
2017-12-14 19:11:41 +00:00
|
|
|
#include <windows.h>
|
2017-10-31 12:21:05 +00:00
|
|
|
|
2018-10-03 14:07:34 +00:00
|
|
|
struct CursorBuffer
|
2017-12-11 20:56:50 +00:00
|
|
|
{
|
2018-10-03 14:07:34 +00:00
|
|
|
unsigned int bufferSize;
|
|
|
|
char * buffer;
|
|
|
|
unsigned int pointerSize;
|
|
|
|
};
|
2018-05-28 00:34:24 +00:00
|
|
|
|
2018-10-03 14:07:34 +00:00
|
|
|
struct CursorInfo
|
|
|
|
{
|
2017-12-11 20:56:50 +00:00
|
|
|
bool visible;
|
|
|
|
bool hasPos;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
enum CursorType type;
|
|
|
|
unsigned int w, h;
|
2017-12-12 17:47:28 +00:00
|
|
|
unsigned int pitch;
|
2018-10-03 14:07:34 +00:00
|
|
|
CursorBuffer * shape;
|
2017-12-11 20:56:50 +00:00
|
|
|
};
|
|
|
|
|
2017-10-31 14:46:47 +00:00
|
|
|
struct FrameInfo
|
|
|
|
{
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
unsigned int stride;
|
2017-12-16 18:05:56 +00:00
|
|
|
unsigned int pitch;
|
2017-10-31 14:46:47 +00:00
|
|
|
void * buffer;
|
|
|
|
size_t bufferSize;
|
|
|
|
};
|
|
|
|
|
2017-12-07 19:24:17 +00:00
|
|
|
enum GrabStatus
|
|
|
|
{
|
|
|
|
GRAB_STATUS_OK,
|
2018-07-25 17:08:52 +00:00
|
|
|
GRAB_STATUS_TIMEOUT,
|
2017-12-07 19:24:17 +00:00
|
|
|
GRAB_STATUS_REINIT,
|
2017-12-11 20:56:50 +00:00
|
|
|
GRAB_STATUS_CURSOR,
|
2017-12-07 19:24:17 +00:00
|
|
|
GRAB_STATUS_ERROR
|
|
|
|
};
|
|
|
|
|
2017-11-16 09:53:22 +00:00
|
|
|
typedef std::vector<const char *> CaptureOptions;
|
|
|
|
|
2017-12-14 19:22:22 +00:00
|
|
|
class ICapture
|
2017-10-31 12:21:05 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-12-14 19:22:22 +00:00
|
|
|
virtual const char * GetName() = 0;
|
|
|
|
|
2018-07-23 15:11:19 +00:00
|
|
|
virtual bool CanInitialize() = 0;
|
2017-12-14 19:22:22 +00:00
|
|
|
virtual bool Initialize(CaptureOptions * options) = 0;
|
|
|
|
virtual void DeInitialize() = 0;
|
|
|
|
virtual bool ReInitialize() = 0;
|
|
|
|
virtual enum FrameType GetFrameType() = 0;
|
|
|
|
virtual size_t GetMaxFrameSize() = 0;
|
2018-09-29 17:50:43 +00:00
|
|
|
virtual enum GrabStatus Capture() = 0;
|
|
|
|
virtual enum GrabStatus GetFrame(struct FrameInfo & frame) = 0;
|
2018-10-03 14:07:34 +00:00
|
|
|
virtual bool GetCursor(CursorInfo & cursor) = 0;
|
|
|
|
virtual void FreeCursor(CursorInfo & cursor) = 0;
|
2018-09-29 17:50:43 +00:00
|
|
|
virtual enum GrabStatus DiscardFrame() = 0;
|
2017-12-14 19:22:22 +00:00
|
|
|
};
|