2020-03-26 14:21:34 +08:00
|
|
|
|
|
|
|
#ifndef ZN_LIBVNC_CAMERA_H
|
|
|
|
#define ZN_LIBVNC_CAMERA_H
|
|
|
|
|
|
|
|
#include "zm_camera.h"
|
2020-03-29 06:17:19 +08:00
|
|
|
#include "zm_swscale.h"
|
2020-03-26 14:21:34 +08:00
|
|
|
|
2020-03-26 15:08:00 +08:00
|
|
|
#if HAVE_LIBVNC
|
2020-03-26 14:21:34 +08:00
|
|
|
#include <rfb/rfbclient.h>
|
2020-11-18 00:08:11 +08:00
|
|
|
|
2021-02-18 02:40:12 +08:00
|
|
|
// Older versions of libvncserver defined a max macro in rfb/rfbproto.h
|
|
|
|
// Undef it here so it doesn't collide with std::max
|
|
|
|
// TODO: Remove this once xenial support is dropped
|
|
|
|
#ifdef max
|
|
|
|
#undef max
|
|
|
|
#endif
|
|
|
|
|
2020-03-26 14:21:34 +08:00
|
|
|
// Used by vnc callbacks
|
2020-11-18 00:08:11 +08:00
|
|
|
struct VncPrivateData {
|
2020-03-26 14:21:34 +08:00
|
|
|
uint8_t *buffer;
|
2020-03-28 02:15:15 +08:00
|
|
|
uint8_t width;
|
|
|
|
uint8_t height;
|
2020-03-26 14:21:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class VncCamera : public Camera {
|
|
|
|
protected:
|
|
|
|
rfbClient *mRfb;
|
|
|
|
VncPrivateData mVncData;
|
2020-03-29 06:17:19 +08:00
|
|
|
SWScale scale;
|
|
|
|
AVPixelFormat mImgPixFmt;
|
2020-03-26 14:21:34 +08:00
|
|
|
std::string mHost;
|
|
|
|
std::string mPort;
|
|
|
|
std::string mUser;
|
|
|
|
std::string mPass;
|
|
|
|
public:
|
|
|
|
VncCamera(
|
2021-02-08 02:12:39 +08:00
|
|
|
const Monitor *monitor,
|
2020-03-26 14:21:34 +08:00
|
|
|
const std::string &host,
|
|
|
|
const std::string &port,
|
|
|
|
const std::string &user,
|
|
|
|
const std::string &pass,
|
|
|
|
int p_width,
|
|
|
|
int p_height,
|
|
|
|
int p_colours,
|
|
|
|
int p_brightness,
|
|
|
|
int p_contrast,
|
|
|
|
int p_hue,
|
|
|
|
int p_colour,
|
|
|
|
bool p_capture,
|
2021-02-24 23:09:21 +08:00
|
|
|
bool p_record_audio);
|
2020-03-26 14:21:34 +08:00
|
|
|
|
|
|
|
~VncCamera();
|
|
|
|
|
2021-04-20 23:48:12 +08:00
|
|
|
int PreCapture() override;
|
|
|
|
int PrimeCapture() override;
|
|
|
|
int Capture(ZMPacket &packet) override;
|
|
|
|
int PostCapture() override;
|
|
|
|
int Close() override;
|
2020-03-26 14:21:34 +08:00
|
|
|
};
|
|
|
|
|
2020-03-26 15:08:00 +08:00
|
|
|
#endif // HAVE_LIBVNC
|
2020-03-26 15:52:34 +08:00
|
|
|
#endif // ZN_LIBVNC_CAMERA_H
|