mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
implement set videomode via json api (#457)
* implement set videomode via json api * refactor grabbers: - new base class - move shared code to base class * fix osx * rework all cmakelist files with auto file collection. except leddevices (need further restructuring) * store current video and grabbing mode * add json stuff * remove grabbingmode - we do not want to expose it
This commit is contained in:
@@ -1,18 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// STL includes
|
||||
#include <cstdint>
|
||||
#include <utils/Logger.h>
|
||||
// Utils includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorBgr.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
|
||||
///
|
||||
/// The DispmanxFrameGrabber is used for creating snapshots of the display (screenshots) with a
|
||||
/// downsized and scaled resolution.
|
||||
///
|
||||
class AmlogicGrabber
|
||||
class AmlogicGrabber : public Grabber
|
||||
{
|
||||
public:
|
||||
///
|
||||
@@ -24,12 +20,6 @@ public:
|
||||
AmlogicGrabber(const unsigned width, const unsigned height);
|
||||
~AmlogicGrabber();
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
void setVideoMode(const VideoMode videoMode);
|
||||
|
||||
///
|
||||
/// 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
|
||||
@@ -47,14 +37,6 @@ public:
|
||||
*/
|
||||
bool isVideoPlaying();
|
||||
private:
|
||||
|
||||
/// With of the captured snapshot [pixels]
|
||||
const unsigned _width;
|
||||
/// Height of the captured snapshot [pixels]
|
||||
const unsigned _height;
|
||||
|
||||
/** The snapshot/capture device of the amlogic video chip */
|
||||
int _amlogicCaptureDev;
|
||||
|
||||
Logger * _log;
|
||||
};
|
||||
|
@@ -42,11 +42,7 @@ public slots:
|
||||
///
|
||||
virtual void action();
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
void setVideoMode(const VideoMode videoMode);
|
||||
virtual void setVideoMode(const VideoMode mode);
|
||||
|
||||
private:
|
||||
/// The update rate [Hz]
|
||||
|
@@ -4,20 +4,15 @@
|
||||
#pragma GCC system_header
|
||||
#include <bcm_host.h>
|
||||
|
||||
// STL includes
|
||||
#include <cstdint>
|
||||
|
||||
// Utils includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgba.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
|
||||
///
|
||||
/// The DispmanxFrameGrabber is used for creating snapshots of the display (screenshots) with a
|
||||
/// downsized and scaled resolution.
|
||||
///
|
||||
class DispmanxFrameGrabber
|
||||
class DispmanxFrameGrabber : public Grabber
|
||||
{
|
||||
public:
|
||||
///
|
||||
@@ -36,12 +31,6 @@ public:
|
||||
///
|
||||
void setFlags(const int vc_flags);
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
void setVideoMode(const VideoMode videoMode);
|
||||
|
||||
void setCropping(const unsigned cropLeft, const unsigned cropRight,
|
||||
const unsigned cropTop, const unsigned cropBottom);
|
||||
|
||||
@@ -68,23 +57,10 @@ private:
|
||||
/// Flags (transforms) for creating snapshots
|
||||
int _vc_flags;
|
||||
|
||||
/// With of the captured snapshot [pixels]
|
||||
const unsigned _width;
|
||||
/// Height of the captured snapshot [pixels]
|
||||
const unsigned _height;
|
||||
|
||||
// the selected VideoMode
|
||||
VideoMode _videoMode;
|
||||
|
||||
// number of pixels to crop after capturing
|
||||
unsigned _cropLeft, _cropRight, _cropTop, _cropBottom;
|
||||
|
||||
// temp buffer when capturing with unsupported pitch size or
|
||||
// when we need to crop the image
|
||||
ColorRgba* _captureBuffer;
|
||||
|
||||
// size of the capture buffer in Pixels
|
||||
unsigned _captureBufferSize;
|
||||
|
||||
Logger * _log;
|
||||
};
|
||||
|
@@ -1,16 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
// Utils includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/ImageResampler.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
|
||||
///
|
||||
/// The FramebufferFrameGrabber is used for creating snapshots of the display (screenshots)
|
||||
///
|
||||
class FramebufferFrameGrabber
|
||||
class FramebufferFrameGrabber : public Grabber
|
||||
{
|
||||
public:
|
||||
///
|
||||
@@ -23,12 +20,6 @@ public:
|
||||
FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height);
|
||||
~FramebufferFrameGrabber();
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
void setVideoMode(const VideoMode videoMode);
|
||||
|
||||
///
|
||||
/// 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
|
||||
@@ -48,15 +39,4 @@ private:
|
||||
|
||||
/// Framebuffer device e.g. /dev/fb0
|
||||
const QString _fbDevice;
|
||||
|
||||
/// With of the captured snapshot [pixels]
|
||||
const unsigned _width;
|
||||
|
||||
/// Height of the captured snapshot [pixels]
|
||||
const unsigned _height;
|
||||
|
||||
/// Image resampler for downscaling the image
|
||||
ImageResampler * _imgResampler;
|
||||
|
||||
Logger * _log;
|
||||
};
|
||||
|
@@ -4,16 +4,13 @@
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
// Utils includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/ImageResampler.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
|
||||
///
|
||||
/// The OsxFrameGrabber is used for creating snapshots of the display (screenshots)
|
||||
///
|
||||
class OsxFrameGrabber
|
||||
class OsxFrameGrabber : public Grabber
|
||||
{
|
||||
public:
|
||||
///
|
||||
@@ -26,12 +23,6 @@ public:
|
||||
OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height);
|
||||
~OsxFrameGrabber();
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
void setVideoMode(const VideoMode videoMode);
|
||||
|
||||
///
|
||||
/// 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
|
||||
@@ -46,17 +37,6 @@ private:
|
||||
/// display
|
||||
const unsigned _screenIndex;
|
||||
|
||||
/// With of the captured snapshot [pixels]
|
||||
const unsigned _width;
|
||||
|
||||
/// Height of the captured snapshot [pixels]
|
||||
const unsigned _height;
|
||||
|
||||
/// Reference to the captured diaplay
|
||||
CGDirectDisplayID _display;
|
||||
|
||||
/// Image resampler for downscaling the image
|
||||
ImageResampler * _imgResampler;
|
||||
|
||||
Logger * _log;
|
||||
};
|
||||
|
@@ -10,12 +10,9 @@
|
||||
#include <QRectF>
|
||||
|
||||
// util includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/PixelFormat.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/ImageResampler.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
|
||||
// grabber includes
|
||||
#include <grabber/VideoStandard.h>
|
||||
@@ -23,7 +20,7 @@
|
||||
/// Capture class for V4L2 devices
|
||||
///
|
||||
/// @see http://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html
|
||||
class V4L2Grabber : public QObject
|
||||
class V4L2Grabber : public Grabber
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -48,8 +45,6 @@ public slots:
|
||||
int cropTop,
|
||||
int cropBottom);
|
||||
|
||||
void set3D(VideoMode mode);
|
||||
|
||||
void setSignalThreshold(
|
||||
double redSignalThreshold,
|
||||
double greenSignalThreshold,
|
||||
@@ -124,18 +119,16 @@ private:
|
||||
private:
|
||||
QString _deviceName;
|
||||
std::map<QString,QString> _v4lDevices;
|
||||
int _input;
|
||||
VideoStandard _videoStandard;
|
||||
io_method _ioMethod;
|
||||
int _fileDescriptor;
|
||||
int _input;
|
||||
VideoStandard _videoStandard;
|
||||
io_method _ioMethod;
|
||||
int _fileDescriptor;
|
||||
std::vector<buffer> _buffers;
|
||||
|
||||
PixelFormat _pixelFormat;
|
||||
int _width;
|
||||
int _height;
|
||||
int _lineLength;
|
||||
int _frameByteSize;
|
||||
int _frameDecimation;
|
||||
int _lineLength;
|
||||
int _frameByteSize;
|
||||
int _frameDecimation;
|
||||
|
||||
// signal detection
|
||||
int _noSignalCounterThreshold;
|
||||
@@ -151,11 +144,6 @@ private:
|
||||
|
||||
QSocketNotifier * _streamNotifier;
|
||||
|
||||
ImageResampler _imageResampler;
|
||||
|
||||
Logger * _log;
|
||||
bool _initialized;
|
||||
bool _deviceAutoDiscoverEnabled;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -24,7 +24,8 @@ public:
|
||||
double redSignalThreshold,
|
||||
double greenSignalThreshold,
|
||||
double blueSignalThreshold,
|
||||
const int priority);
|
||||
const int priority,
|
||||
bool useGrabbingMode);
|
||||
virtual ~V4L2Wrapper();
|
||||
|
||||
bool getSignalDetectionEnable();
|
||||
@@ -35,7 +36,7 @@ public slots:
|
||||
|
||||
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
|
||||
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
|
||||
void set3D(VideoMode mode);
|
||||
void setVideoMode(VideoMode mode);
|
||||
void setSignalDetectionEnable(bool enable);
|
||||
|
||||
// signals:
|
||||
|
@@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
// Hyperion-utils includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/ImageResampler.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <hyperion/Grabber.h>
|
||||
|
||||
// X11 includes
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrender.h>
|
||||
@@ -11,7 +13,7 @@
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
class X11Grabber
|
||||
class X11Grabber : public Grabber
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -19,12 +21,6 @@ public:
|
||||
|
||||
virtual ~X11Grabber();
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
void setVideoMode(const VideoMode videoMode);
|
||||
|
||||
bool Setup();
|
||||
|
||||
Image<ColorRgb> & grab();
|
||||
@@ -43,21 +39,9 @@ public:
|
||||
/// update dimension according current screen
|
||||
int updateScreenDimensions();
|
||||
|
||||
/// gets resulting height of image
|
||||
const unsigned getImageWidth() { return _croppedWidth; };
|
||||
|
||||
/// gets resulting width of image
|
||||
const unsigned getImageHeight() { return _croppedHeight; };
|
||||
|
||||
private:
|
||||
ImageResampler _imageResampler;
|
||||
|
||||
bool _useXGetImage, _XShmAvailable, _XShmPixmapAvailable, _XRenderAvailable;
|
||||
int _cropLeft;
|
||||
int _cropRight;
|
||||
int _cropTop;
|
||||
int _cropBottom;
|
||||
|
||||
|
||||
XImage* _xImage;
|
||||
XShmSegmentInfo _shminfo;
|
||||
|
||||
@@ -79,14 +63,9 @@ private:
|
||||
|
||||
unsigned _screenWidth;
|
||||
unsigned _screenHeight;
|
||||
unsigned _croppedWidth;
|
||||
unsigned _croppedHeight;
|
||||
|
||||
Image<ColorRgb> _image;
|
||||
|
||||
void freeResources();
|
||||
void setupResources();
|
||||
|
||||
|
||||
Logger * _log;
|
||||
};
|
||||
|
@@ -17,7 +17,6 @@ class ImageProcessor;
|
||||
///
|
||||
class X11Wrapper: public GrabberWrapper
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
///
|
||||
/// Constructs the framebuffer frame grabber with a specified grab size and update rate.
|
||||
|
Reference in New Issue
Block a user