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>
|
|
|
|
|
2017-09-03 13:48:16 +02:00
|
|
|
class IonBuffer;
|
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
|
|
|
|
///
|
|
|
|
AmlogicGrabber(const unsigned width, const unsigned height);
|
|
|
|
~AmlogicGrabber();
|
|
|
|
|
|
|
|
///
|
|
|
|
/// 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);
|
|
|
|
int grabFrame_ge2d(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;
|
2017-09-03 13:48:16 +02:00
|
|
|
int _ge2dDev;
|
2017-09-01 08:50:37 +02:00
|
|
|
|
|
|
|
Image<ColorBgr> _image_bgr;
|
2017-08-12 07:55:32 +02:00
|
|
|
|
2017-09-01 08:50:37 +02:00
|
|
|
int _lastError;
|
|
|
|
bool _videoPlaying;
|
|
|
|
FramebufferFrameGrabber _fbGrabber;
|
|
|
|
int _grabbingModeNotification;
|
2017-09-03 13:48:16 +02:00
|
|
|
bool _ge2dAvailable;
|
|
|
|
void* _ge2dVideoBufferPtr;
|
|
|
|
IonBuffer* _ge2dIonBuffer;
|
2015-08-07 14:37:41 +02:00
|
|
|
};
|