2015-01-18 00:04:45 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Utils includes
|
2015-01-24 23:42:22 +01:00
|
|
|
#include <utils/ColorRgb.h>
|
2017-08-04 23:08:15 +02:00
|
|
|
#include <hyperion/Grabber.h>
|
2015-01-18 00:04:45 +01:00
|
|
|
|
|
|
|
///
|
2018-12-27 23:11:32 +01:00
|
|
|
/// The FramebufferFrameGrabber is used for creating snapshots of the display (screenshots)
|
2015-01-18 00:04:45 +01:00
|
|
|
///
|
2017-08-04 23:08:15 +02:00
|
|
|
class FramebufferFrameGrabber : public Grabber
|
2015-01-18 00:04:45 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
/// Construct a FramebufferFrameGrabber that will capture snapshots with specified dimensions.
|
|
|
|
///
|
|
|
|
/// @param[in] device The framebuffer device name/path
|
|
|
|
/// @param[in] width The width of the captured screenshot
|
|
|
|
/// @param[in] height The heigth of the captured screenshot
|
|
|
|
///
|
2017-03-04 22:17:42 +01:00
|
|
|
FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height);
|
2015-01-18 00:04:45 +01:00
|
|
|
~FramebufferFrameGrabber();
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Captures a single snapshot of the display and writes the data to the given image. The
|
|
|
|
/// provided image should have the same dimensions as the configured values (_width and
|
|
|
|
/// _height)
|
|
|
|
///
|
|
|
|
/// @param[out] image The snapped screenshot (should be initialized with correct width and
|
|
|
|
/// height)
|
|
|
|
///
|
2017-08-12 07:55:32 +02:00
|
|
|
int grabFrame(Image<ColorRgb> & image);
|
2015-01-18 00:04:45 +01:00
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
///
|
|
|
|
/// @brief Overwrite Grabber.h implememtation
|
|
|
|
///
|
|
|
|
virtual void setDevicePath(const QString& path);
|
|
|
|
|
2015-01-18 00:04:45 +01:00
|
|
|
private:
|
|
|
|
/// Framebuffer file descriptor
|
|
|
|
int _fbfd;
|
|
|
|
|
|
|
|
/// Pointer to framebuffer
|
|
|
|
unsigned char * _fbp;
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2015-01-18 00:04:45 +01:00
|
|
|
/// Framebuffer device e.g. /dev/fb0
|
2018-12-27 23:11:32 +01:00
|
|
|
QString _fbDevice;
|
2015-01-18 00:04:45 +01:00
|
|
|
};
|