2019-02-28 16:35:30 +11:00
|
|
|
/*
|
|
|
|
Looking Glass - KVM FrameRelay (KVMFR) Client
|
|
|
|
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
|
|
|
https://looking-glass.hostfission.com
|
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2019-10-01 23:17:20 +10:00
|
|
|
#include "common/framebuffer.h"
|
2019-02-28 16:35:30 +11:00
|
|
|
|
|
|
|
typedef enum CaptureResult
|
|
|
|
{
|
2019-03-04 17:55:45 +11:00
|
|
|
CAPTURE_RESULT_OK ,
|
|
|
|
CAPTURE_RESULT_REINIT ,
|
2019-02-28 16:35:30 +11:00
|
|
|
CAPTURE_RESULT_TIMEOUT,
|
|
|
|
CAPTURE_RESULT_ERROR
|
|
|
|
}
|
|
|
|
CaptureResult;
|
|
|
|
|
2019-03-02 20:33:21 +11:00
|
|
|
typedef enum CaptureFormat
|
|
|
|
{
|
2019-03-04 17:45:19 +11:00
|
|
|
// frame formats
|
2020-10-11 19:22:31 +11:00
|
|
|
CAPTURE_FMT_BGRA ,
|
|
|
|
CAPTURE_FMT_RGBA ,
|
|
|
|
CAPTURE_FMT_RGBA10 ,
|
|
|
|
CAPTURE_FMT_RGBA16F,
|
2019-03-04 17:45:19 +11:00
|
|
|
|
|
|
|
// pointer formats
|
|
|
|
CAPTURE_FMT_COLOR ,
|
|
|
|
CAPTURE_FMT_MONO ,
|
|
|
|
CAPTURE_FMT_MASKED,
|
|
|
|
|
2019-03-02 20:33:21 +11:00
|
|
|
CAPTURE_FMT_MAX
|
|
|
|
}
|
|
|
|
CaptureFormat;
|
|
|
|
|
2021-01-18 13:53:29 +11:00
|
|
|
typedef enum CaptureRotation
|
|
|
|
{
|
|
|
|
CAPTURE_ROT_0,
|
|
|
|
CAPTURE_ROT_90,
|
|
|
|
CAPTURE_ROT_180,
|
|
|
|
CAPTURE_ROT_270
|
|
|
|
}
|
|
|
|
CaptureRotation;
|
|
|
|
|
2019-03-02 20:33:21 +11:00
|
|
|
typedef struct CaptureFrame
|
|
|
|
{
|
2021-01-18 13:53:29 +11:00
|
|
|
unsigned int formatVer;
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
unsigned int pitch;
|
|
|
|
unsigned int stride;
|
|
|
|
CaptureFormat format;
|
|
|
|
CaptureRotation rotation;
|
2019-03-02 20:33:21 +11:00
|
|
|
}
|
|
|
|
CaptureFrame;
|
|
|
|
|
2019-03-04 17:45:19 +11:00
|
|
|
typedef struct CapturePointer
|
|
|
|
{
|
2020-01-26 17:25:14 +11:00
|
|
|
bool positionUpdate;
|
2019-03-04 17:45:19 +11:00
|
|
|
int x, y;
|
2019-03-04 19:26:02 +11:00
|
|
|
bool visible;
|
|
|
|
|
|
|
|
bool shapeUpdate;
|
2019-03-04 17:45:19 +11:00
|
|
|
CaptureFormat format;
|
2020-08-20 13:46:18 +10:00
|
|
|
unsigned int hx, hy;
|
2019-03-04 17:45:19 +11:00
|
|
|
unsigned int width, height;
|
|
|
|
unsigned int pitch;
|
|
|
|
}
|
|
|
|
CapturePointer;
|
|
|
|
|
2020-01-09 15:42:32 +11:00
|
|
|
typedef bool (*CaptureGetPointerBuffer )(void ** data, uint32_t * size);
|
|
|
|
typedef void (*CapturePostPointerBuffer)(CapturePointer pointer);
|
|
|
|
|
2019-03-02 20:33:21 +11:00
|
|
|
typedef struct CaptureInterface
|
2019-02-28 16:35:30 +11:00
|
|
|
{
|
2021-02-26 23:35:20 -05:00
|
|
|
const char *shortName;
|
2019-02-28 20:50:22 +11:00
|
|
|
const char * (*getName )();
|
2019-05-09 22:06:58 +10:00
|
|
|
void (*initOptions )();
|
|
|
|
|
2020-01-09 15:42:32 +11:00
|
|
|
bool(*create)(
|
|
|
|
CaptureGetPointerBuffer getPointerBufferFn,
|
|
|
|
CapturePostPointerBuffer postPointerBufferFn
|
|
|
|
);
|
|
|
|
|
|
|
|
bool (*init )();
|
2019-04-10 21:07:56 +10:00
|
|
|
void (*stop )();
|
2019-02-28 20:50:22 +11:00
|
|
|
bool (*deinit )();
|
|
|
|
void (*free )();
|
|
|
|
unsigned int (*getMaxFrameSize)();
|
2021-01-04 16:01:24 -05:00
|
|
|
unsigned int (*getMouseScale )();
|
2019-03-01 15:45:46 +11:00
|
|
|
|
2019-03-04 17:55:45 +11:00
|
|
|
CaptureResult (*capture )();
|
2020-01-13 19:30:49 +11:00
|
|
|
CaptureResult (*waitFrame )(CaptureFrame * frame);
|
|
|
|
CaptureResult (*getFrame )(FrameBuffer * frame);
|
2019-03-02 20:33:21 +11:00
|
|
|
}
|
2020-01-26 17:25:14 +11:00
|
|
|
CaptureInterface;
|