148 lines
3.3 KiB
C
Raw Normal View History

#pragma once
#include <QObject>
#include <cstdint>
#include <utils/ColorRgb.h>
#include <utils/Image.h>
#include <utils/VideoMode.h>
#include <utils/VideoStandard.h>
#include <utils/ImageResampler.h>
#include <utils/Logger.h>
#include <utils/Components.h>
2020-06-17 20:55:57 +02:00
#include <QMultiMap>
2018-12-27 23:11:32 +01:00
///
/// @brief The Grabber class is responsible to apply image resizes (with or without ImageResampler)
2021-01-31 13:49:31 +01:00
class Grabber : public QObject
{
Q_OBJECT
public:
Grabber(const QString& grabberName = "", int width=0, int height=0, int cropLeft=0, int cropRight=0, int cropTop=0, int cropBottom=0);
///
/// Set the video mode (2D/3D)
/// @param[in] mode The new video mode
///
virtual void setVideoMode(VideoMode mode);
///
/// Apply new flip mode (vertical/horizontal/both)
/// @param[in] mode The new flip mode
///
virtual void setFlipMode(FlipMode mode);
2018-12-27 23:11:32 +01:00
///
/// @brief Apply new crop values, on errors reject the values
///
virtual void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
2017-11-22 00:52:55 +01:00
2020-06-17 20:55:57 +02:00
///
/// @brief Apply new video input (used from v4l2/MediaFoundation)
2020-06-17 20:55:57 +02:00
/// @param input device input
///
virtual bool setInput(int input);
2018-12-27 23:11:32 +01:00
///
/// @brief Apply new width/height values, on errors (collide with cropping) reject the values
2019-01-07 18:13:49 +01:00
/// @return True on success else false
2018-12-27 23:11:32 +01:00
///
virtual bool setWidthHeight(int width, int height);
2018-12-27 23:11:32 +01:00
///
/// @brief Apply new framerate (used from v4l2/MediaFoundation)
/// @param fps framesPerSecond
///
virtual bool setFramerate(int fps);
2018-12-27 23:11:32 +01:00
///
/// @brief Apply new framerate software decimation (used from v4l2/MediaFoundation)
/// @param decimation how many frames per second to omit
2018-12-27 23:11:32 +01:00
///
virtual void setFpsSoftwareDecimation(int decimation);
2018-12-27 23:11:32 +01:00
///
/// @brief Apply videoStandard (used from v4l2)
2018-12-27 23:11:32 +01:00
///
virtual void setVideoStandard(VideoStandard videoStandard);
2018-12-27 23:11:32 +01:00
///
/// @brief Apply new pixelDecimation (used from v4l2, MediaFoundation, x11, xcb and qt)
///
virtual bool setPixelDecimation(int pixelDecimation);
2018-12-27 23:11:32 +01:00
///
/// @brief Apply display index (used from qt)
2018-12-27 23:11:32 +01:00
///
virtual void setDisplayIndex(int index) {}
2018-12-27 23:11:32 +01:00
///
/// @brief Apply path for device (used from framebuffer)
///
virtual void setDevicePath(const QString& path) {}
2018-12-27 23:11:32 +01:00
///
/// @brief get current resulting height of image (after crop)
///
virtual int getImageWidth() { return _width; }
2018-12-27 23:11:32 +01:00
///
/// @brief get current resulting width of image (after crop)
///
virtual int getImageHeight() { return _height; }
2018-12-27 23:11:32 +01:00
///
/// @brief Prevent the real capture implementation from capturing if disabled
///
void setEnabled(bool enable);
QString getGrabberName() const { return _grabberName; }
protected:
QString _grabberName;
ImageResampler _imageResampler;
bool _useImageResampler;
2017-11-22 00:52:55 +01:00
/// the selected VideoMode
VideoMode _videoMode;
/// the used video standard
VideoStandard _videoStandard;
/// Image size decimation
int _pixelDecimation;
/// the used Flip Mode
FlipMode _flipMode;
/// With of the captured snapshot [pixels]
int _width;
2017-11-22 00:52:55 +01:00
/// Height of the captured snapshot [pixels]
int _height;
2020-06-17 20:55:57 +02:00
/// frame per second
int _fps;
/// fps software decimation
int _fpsSoftwareDecimation;
2020-06-17 20:55:57 +02:00
/// device input
int _input;
/// number of pixels to crop after capturing
int _cropLeft, _cropRight, _cropTop, _cropBottom;
bool _enabled;
/// logger instance
Logger * _log;
};