2015-08-07 14:37:41 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Utils includes
|
2015-08-20 09:51:44 +02:00
|
|
|
#include <utils/ColorBgr.h>
|
2017-09-03 13:48:16 +02:00
|
|
|
#include <utils/ColorRgba.h>
|
2017-08-04 23:08:15 +02:00
|
|
|
#include <hyperion/Grabber.h>
|
2017-09-01 08:50:37 +02:00
|
|
|
#include <grabber/FramebufferFrameGrabber.h>
|
|
|
|
|
2015-08-07 14:37:41 +02:00
|
|
|
///
|
|
|
|
///
|
2017-08-04 23:08:15 +02:00
|
|
|
class AmlogicGrabber : public Grabber
|
2015-08-07 14:37:41 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
/// Construct a AmlogicGrabber that will capture snapshots with specified dimensions.
|
|
|
|
///
|
|
|
|
/// @param[in] width The width of the captured screenshot
|
|
|
|
/// @param[in] height The heigth of the captured screenshot
|
|
|
|
///
|
2019-03-27 08:07:45 +01:00
|
|
|
AmlogicGrabber(const unsigned width, const unsigned height);
|
2020-07-12 09:19:59 +02:00
|
|
|
~AmlogicGrabber() override;
|
2015-08-07 14:37:41 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
/// 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)
|
2015-08-20 09:51:44 +02:00
|
|
|
/// @return Zero on success else negative
|
2015-08-07 14:37:41 +02:00
|
|
|
///
|
2017-08-12 07:55:32 +02:00
|
|
|
int grabFrame(Image<ColorRgb> & image);
|
2015-08-07 14:37:41 +02:00
|
|
|
|
2017-08-12 07:55:32 +02:00
|
|
|
private:
|
2015-08-20 09:51:44 +02:00
|
|
|
/**
|
|
|
|
* Returns true if video is playing over the amlogic chip
|
|
|
|
* @return True if video is playing else false
|
|
|
|
*/
|
|
|
|
bool isVideoPlaying();
|
2017-09-01 08:50:37 +02:00
|
|
|
void closeDev(int &fd);
|
2017-09-03 13:48:16 +02:00
|
|
|
bool openDev(int &fd, const char* dev);
|
|
|
|
|
|
|
|
int grabFrame_amvideocap(Image<ColorRgb> & image);
|
2017-08-12 07:55:32 +02:00
|
|
|
|
2015-08-07 14:37:41 +02:00
|
|
|
/** The snapshot/capture device of the amlogic video chip */
|
2017-09-01 08:50:37 +02:00
|
|
|
int _captureDev;
|
|
|
|
int _videoDev;
|
|
|
|
|
|
|
|
Image<ColorBgr> _image_bgr;
|
2019-02-08 09:38:31 +01:00
|
|
|
void* _image_ptr;
|
|
|
|
ssize_t _bytesToRead;
|
|
|
|
|
2017-09-01 08:50:37 +02:00
|
|
|
int _lastError;
|
|
|
|
bool _videoPlaying;
|
|
|
|
FramebufferFrameGrabber _fbGrabber;
|
|
|
|
int _grabbingModeNotification;
|
2015-08-07 14:37:41 +02:00
|
|
|
};
|