mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor/Create APT/DNF Repository (#1648)
This commit is contained in:
98
include/grabber/amlogic/AmlogicGrabber.h
Normal file
98
include/grabber/amlogic/AmlogicGrabber.h
Normal file
@@ -0,0 +1,98 @@
|
||||
#pragma once
|
||||
|
||||
// Utils includes
|
||||
#include <utils/ColorBgr.h>
|
||||
#include <utils/ColorRgba.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
#include <grabber/framebuffer/FramebufferFrameGrabber.h>
|
||||
|
||||
///
|
||||
///
|
||||
class AmlogicGrabber : public Grabber
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Construct a AmlogicGrabber that will capture snapshots with specified dimensions.
|
||||
///
|
||||
///
|
||||
AmlogicGrabber();
|
||||
~AmlogicGrabber() override;
|
||||
|
||||
///
|
||||
/// @brief Setup a new capture screen, will free the previous one
|
||||
/// @return True on success, false if no screen is found
|
||||
///
|
||||
bool setupScreen();
|
||||
|
||||
///
|
||||
/// 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)
|
||||
/// @return Zero on success else negative
|
||||
///
|
||||
int grabFrame(Image<ColorRgb> & image);
|
||||
|
||||
///
|
||||
/// @brief Discover AmLogic screens available (for configuration).
|
||||
///
|
||||
/// @param[in] params Parameters used to overwrite discovery default behaviour
|
||||
///
|
||||
/// @return A JSON structure holding a list of devices found
|
||||
///
|
||||
QJsonObject discover(const QJsonObject& params);
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
void setVideoMode(VideoMode mode) override;
|
||||
|
||||
///
|
||||
/// @brief Apply new crop values, on errors reject the values
|
||||
///
|
||||
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom) override;
|
||||
|
||||
///
|
||||
/// @brief Apply new width/height values, on errors (collide with cropping) reject the values
|
||||
/// @return True on success else false
|
||||
///
|
||||
bool setWidthHeight(int width, int height) override;
|
||||
|
||||
///
|
||||
/// @brief Apply new framerate
|
||||
/// @param fps framesPerSecond
|
||||
///
|
||||
bool setFramerate(int fps) override;
|
||||
|
||||
///
|
||||
/// @brief Apply new pixelDecimation
|
||||
///
|
||||
bool setPixelDecimation(int pixelDecimation) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns true if video is playing over the amlogic chip
|
||||
* @return True if video is playing else false
|
||||
*/
|
||||
bool isVideoPlaying();
|
||||
void closeDevice(int &fd);
|
||||
bool openDevice(int &fd, const char* dev);
|
||||
|
||||
int grabFrame_amvideocap(Image<ColorRgb> & image);
|
||||
|
||||
/** The snapshot/capture device of the amlogic video chip */
|
||||
int _captureDev;
|
||||
int _videoDev;
|
||||
|
||||
Image<ColorBgr> _image_bgr;
|
||||
void* _image_ptr;
|
||||
ssize_t _bytesToRead;
|
||||
|
||||
int _lastError;
|
||||
bool _videoPlaying;
|
||||
FramebufferFrameGrabber _fbGrabber;
|
||||
int _grabbingModeNotification;
|
||||
};
|
34
include/grabber/amlogic/AmlogicWrapper.h
Normal file
34
include/grabber/amlogic/AmlogicWrapper.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <hyperion/GrabberWrapper.h>
|
||||
#include <grabber/amlogic/AmlogicGrabber.h>
|
||||
|
||||
///
|
||||
/// The Amlogic uses an instance of the AmlogicGrabber to obtain ImageRgb's from the
|
||||
/// displayed content. This ImageRgb is processed to a ColorRgb for each led and committed to the
|
||||
/// attached Hyperion.
|
||||
///
|
||||
class AmlogicWrapper : public GrabberWrapper
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
///
|
||||
/// Constructs the Amlogic frame grabber
|
||||
///
|
||||
/// @param[in] grabWidth The width of the grabbed image [pixels]
|
||||
/// @param[in] grabHeight The height of the grabbed images [pixels]
|
||||
/// @param[in] pixelDecimation Decimation factor for image [pixels]
|
||||
///
|
||||
AmlogicWrapper(int pixelDecimation=GrabberWrapper::DEFAULT_PIXELDECIMATION,
|
||||
int updateRate_Hz=GrabberWrapper::DEFAULT_RATE_HZ);
|
||||
|
||||
public slots:
|
||||
///
|
||||
/// Performs a single frame grab and computes the led-colors
|
||||
///
|
||||
void action() override;
|
||||
|
||||
private:
|
||||
/// The actual grabber
|
||||
AmlogicGrabber _grabber;
|
||||
};
|
Reference in New Issue
Block a user