mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Amlogic: implement CAP_FLAG_AT_END mode
The OSD will use 20Hz for frame capture frequency The video capture frequency is based on the amlvideodri capture module
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
// Hyperion-AmLogic includes
|
||||
#include "AmlogicWrapper.h"
|
||||
|
||||
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz) :
|
||||
_timer(this),
|
||||
// Linux includes
|
||||
#include <unistd.h>
|
||||
|
||||
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight) :
|
||||
_thread(this),
|
||||
_grabber(grabWidth, grabHeight)
|
||||
{
|
||||
_timer.setSingleShot(false);
|
||||
_timer.setInterval(updateRate_Hz);
|
||||
|
||||
// Connect capturing to the timeout signal of the timer
|
||||
connect(&_timer, SIGNAL(timeout()), this, SLOT(capture()));
|
||||
connect(&_thread, SIGNAL (started()), this, SLOT(capture()));
|
||||
}
|
||||
|
||||
const Image<ColorRgb> & AmlogicWrapper::getScreenshot()
|
||||
@@ -21,16 +21,20 @@ const Image<ColorRgb> & AmlogicWrapper::getScreenshot()
|
||||
|
||||
void AmlogicWrapper::start()
|
||||
{
|
||||
_timer.start();
|
||||
_thread.start();
|
||||
}
|
||||
|
||||
void AmlogicWrapper::stop()
|
||||
{
|
||||
_timer.stop();
|
||||
_thread.quit();
|
||||
}
|
||||
|
||||
void AmlogicWrapper::capture()
|
||||
{
|
||||
_grabber.grabFrame(_screenshot);
|
||||
emit sig_screenshot(_screenshot);
|
||||
while (_thread.isRunning())
|
||||
{
|
||||
_grabber.grabFrame(_screenshot);
|
||||
emit sig_screenshot(_screenshot);
|
||||
usleep(1 * 1000);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
// QT includes
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
|
||||
// Hyperion-Dispmanx includes
|
||||
#include <grabber/AmlogicGrabber.h>
|
||||
@@ -9,12 +9,12 @@ class AmlogicWrapper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz);
|
||||
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight);
|
||||
|
||||
const Image<ColorRgb> & getScreenshot();
|
||||
|
||||
///
|
||||
/// Starts the timed capturing of screenshots
|
||||
/// Starts the threaded capturing of screenshots
|
||||
///
|
||||
void start();
|
||||
|
||||
@@ -25,18 +25,17 @@ signals:
|
||||
|
||||
private slots:
|
||||
///
|
||||
/// Performs a single screenshot capture and publishes the capture screenshot on the screenshot signal.
|
||||
/// Performs screenshot captures and publishes the capture screenshot on the screenshot signal.
|
||||
///
|
||||
void capture();
|
||||
|
||||
private:
|
||||
/// The QT timer to generate capture-publish events
|
||||
QTimer _timer;
|
||||
/// The QT thread to generate capture-publish events
|
||||
QThread _thread;
|
||||
|
||||
/// The grabber for creating screenshots
|
||||
AmlogicGrabber _grabber;
|
||||
|
||||
// image buffers
|
||||
Image<ColorRgb> _screenshot;
|
||||
|
||||
};
|
||||
|
@@ -37,7 +37,6 @@ int main(int argc, char ** argv)
|
||||
// create the option parser and initialize all parser
|
||||
Parser parser("AmLogic capture application for Hyperion. Will automatically search a Hyperion server if -a option isn't used. Please note that if you have more than one server running it's more or less random which one will be used.");
|
||||
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10", 1, 25);
|
||||
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096);
|
||||
IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "160", 160, 4096);
|
||||
BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
|
||||
@@ -55,7 +54,7 @@ int main(int argc, char ** argv)
|
||||
parser.showHelp(0);
|
||||
}
|
||||
|
||||
AmlogicWrapper amlWrapper(argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser));
|
||||
AmlogicWrapper amlWrapper(argWidth.getInt(parser), argHeight.getInt(parser));
|
||||
|
||||
if (parser.isSet(argScreenshot))
|
||||
{
|
||||
|
Reference in New Issue
Block a user