mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
commit
b1b2079f97
@ -537,8 +537,6 @@
|
|||||||
"edt_conf_fg_pixelDecimation_expl" : "Bildverkleinerung (Faktor) ausgehend von der original Größe. 1 für unveränderte/originale Größe.",
|
"edt_conf_fg_pixelDecimation_expl" : "Bildverkleinerung (Faktor) ausgehend von der original Größe. 1 für unveränderte/originale Größe.",
|
||||||
"edt_conf_fg_device_title" : "Device",
|
"edt_conf_fg_device_title" : "Device",
|
||||||
"edt_conf_fg_display_title" : "Display",
|
"edt_conf_fg_display_title" : "Display",
|
||||||
"edt_conf_fg_amlogic_grabber_title" : "Amlogic Grabber Device",
|
|
||||||
"edt_conf_fg_ge2d_mode_title" : "Amlogic ge2d Grabber Modus",
|
|
||||||
"edt_conf_fg_display_expl" : "Gebe an von welchem Desktop aufgenommen werden soll. (Multi Monitor Setup)",
|
"edt_conf_fg_display_expl" : "Gebe an von welchem Desktop aufgenommen werden soll. (Multi Monitor Setup)",
|
||||||
"edt_conf_bb_heading_title" : "Schwarze Balken Erkennung",
|
"edt_conf_bb_heading_title" : "Schwarze Balken Erkennung",
|
||||||
"edt_conf_bb_threshold_title" : "Schwelle",
|
"edt_conf_bb_threshold_title" : "Schwelle",
|
||||||
|
@ -538,8 +538,6 @@
|
|||||||
"edt_conf_fg_pixelDecimation_expl" : "Reduce picture size (factor) based on original size. A factor of 1 means no change",
|
"edt_conf_fg_pixelDecimation_expl" : "Reduce picture size (factor) based on original size. A factor of 1 means no change",
|
||||||
"edt_conf_fg_device_title" : "Device",
|
"edt_conf_fg_device_title" : "Device",
|
||||||
"edt_conf_fg_display_title" : "Display",
|
"edt_conf_fg_display_title" : "Display",
|
||||||
"edt_conf_fg_amlogic_grabber_title" : "Amlogic Grabber Device",
|
|
||||||
"edt_conf_fg_ge2d_mode_title" : "Amlogic ge2d Grabber Modus",
|
|
||||||
"edt_conf_fg_display_expl" : "Select which desktop should be captured (multi monitor setup)",
|
"edt_conf_fg_display_expl" : "Select which desktop should be captured (multi monitor setup)",
|
||||||
"edt_conf_bb_heading_title" : "Blackbar detector",
|
"edt_conf_bb_heading_title" : "Blackbar detector",
|
||||||
"edt_conf_bb_threshold_title" : "Threshold",
|
"edt_conf_bb_threshold_title" : "Threshold",
|
||||||
|
@ -162,11 +162,7 @@
|
|||||||
"display" 0,
|
"display" 0,
|
||||||
|
|
||||||
// valid for framebuffer
|
// valid for framebuffer
|
||||||
"device" : "/dev/fb0",
|
"device" : "/dev/fb0"
|
||||||
|
|
||||||
// valid for amlogic
|
|
||||||
"amlogic_grabber" : "amvideocap0",
|
|
||||||
"ge2d_mode" : 1
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/// The black border configuration, contains the following items:
|
/// The black border configuration, contains the following items:
|
||||||
|
@ -88,9 +88,7 @@
|
|||||||
"cropRight" : 0,
|
"cropRight" : 0,
|
||||||
"cropTop" : 0,
|
"cropTop" : 0,
|
||||||
"cropBottom" : 0,
|
"cropBottom" : 0,
|
||||||
"device" : "/dev/fb0",
|
"device" : "/dev/fb0"
|
||||||
"amlogic_grabber" : "amvideocap0",
|
|
||||||
"ge2d_mode" : 1
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"blackborderdetector" :
|
"blackborderdetector" :
|
||||||
|
0
include/bonjour/bonjourrecord.h
Executable file → Normal file
0
include/bonjour/bonjourrecord.h
Executable file → Normal file
0
include/bonjour/bonjourserviceregister.h
Executable file → Normal file
0
include/bonjour/bonjourserviceregister.h
Executable file → Normal file
118
include/grabber/AmlogicGrabber.h
Executable file → Normal file
118
include/grabber/AmlogicGrabber.h
Executable file → Normal file
@ -6,113 +6,6 @@
|
|||||||
#include <hyperion/Grabber.h>
|
#include <hyperion/Grabber.h>
|
||||||
#include <grabber/FramebufferFrameGrabber.h>
|
#include <grabber/FramebufferFrameGrabber.h>
|
||||||
|
|
||||||
class IonBuffer;
|
|
||||||
|
|
||||||
struct rectangle_s {
|
|
||||||
int x; /* X coordinate of its top-left point */
|
|
||||||
int y; /* Y coordinate of its top-left point */
|
|
||||||
int w; /* width of it */
|
|
||||||
int h; /* height of it */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ge2d_para_s {
|
|
||||||
unsigned int color;
|
|
||||||
struct rectangle_s src1_rect;
|
|
||||||
struct rectangle_s src2_rect;
|
|
||||||
struct rectangle_s dst_rect;
|
|
||||||
int op;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct config_planes_s {
|
|
||||||
unsigned long addr;
|
|
||||||
unsigned int w;
|
|
||||||
unsigned int h;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct src_key_ctrl_s {
|
|
||||||
int key_enable;
|
|
||||||
int key_color;
|
|
||||||
int key_mask;
|
|
||||||
int key_mode;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct config_para_s {
|
|
||||||
int src_dst_type;
|
|
||||||
int alu_const_color;
|
|
||||||
unsigned int src_format;
|
|
||||||
unsigned int dst_format; /* add for src&dst all in user space. */
|
|
||||||
|
|
||||||
struct config_planes_s src_planes[4];
|
|
||||||
struct config_planes_s dst_planes[4];
|
|
||||||
struct src_key_ctrl_s src_key;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct src_dst_para_ex_s {
|
|
||||||
int canvas_index;
|
|
||||||
int top;
|
|
||||||
int left;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int format;
|
|
||||||
int mem_type;
|
|
||||||
int color;
|
|
||||||
unsigned char x_rev;
|
|
||||||
unsigned char y_rev;
|
|
||||||
unsigned char fill_color_en;
|
|
||||||
unsigned char fill_mode;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct config_para_ex_s {
|
|
||||||
struct src_dst_para_ex_s src_para;
|
|
||||||
struct src_dst_para_ex_s src2_para;
|
|
||||||
struct src_dst_para_ex_s dst_para;
|
|
||||||
|
|
||||||
/* key mask */
|
|
||||||
struct src_key_ctrl_s src_key;
|
|
||||||
struct src_key_ctrl_s src2_key;
|
|
||||||
|
|
||||||
int alu_const_color;
|
|
||||||
unsigned src1_gb_alpha;
|
|
||||||
unsigned op_mode;
|
|
||||||
unsigned char bitmask_en;
|
|
||||||
unsigned char bytemask_only;
|
|
||||||
unsigned int bitmask;
|
|
||||||
unsigned char dst_xy_swap;
|
|
||||||
|
|
||||||
/* scaler and phase releated */
|
|
||||||
unsigned hf_init_phase;
|
|
||||||
int hf_rpt_num;
|
|
||||||
unsigned hsc_start_phase_step;
|
|
||||||
int hsc_phase_slope;
|
|
||||||
unsigned vf_init_phase;
|
|
||||||
int vf_rpt_num;
|
|
||||||
unsigned vsc_start_phase_step;
|
|
||||||
int vsc_phase_slope;
|
|
||||||
unsigned char src1_vsc_phase0_always_en;
|
|
||||||
unsigned char src1_hsc_phase0_always_en;
|
|
||||||
/* 1bit, 0: using minus, 1: using repeat data */
|
|
||||||
unsigned char src1_hsc_rpt_ctrl;
|
|
||||||
/* 1bit, 0: using minus 1: using repeat data */
|
|
||||||
unsigned char src1_vsc_rpt_ctrl;
|
|
||||||
|
|
||||||
/* canvas info */
|
|
||||||
struct config_planes_s src_planes[4];
|
|
||||||
struct config_planes_s src2_planes[4];
|
|
||||||
struct config_planes_s dst_planes[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct amvideo_grabber_data {
|
|
||||||
int canvas_index;
|
|
||||||
uint32_t canvas0Addr;
|
|
||||||
uint32_t ge2dformat;
|
|
||||||
uint64_t size;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ge2d_mode {
|
|
||||||
ge2d_single = 0,
|
|
||||||
ge2d_combined = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
class AmlogicGrabber : public Grabber
|
class AmlogicGrabber : public Grabber
|
||||||
@ -123,9 +16,8 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param[in] width The width of the captured screenshot
|
/// @param[in] width The width of the captured screenshot
|
||||||
/// @param[in] height The heigth of the captured screenshot
|
/// @param[in] height The heigth of the captured screenshot
|
||||||
/// @param[in] ge2d_mode The ge2d mode, 0: single icotl calls, 1: combined data ioctl call
|
|
||||||
///
|
///
|
||||||
AmlogicGrabber(const unsigned width, const unsigned height, const unsigned ge2d_mode, const QString device);
|
AmlogicGrabber(const unsigned width, const unsigned height);
|
||||||
~AmlogicGrabber();
|
~AmlogicGrabber();
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -149,12 +41,10 @@ private:
|
|||||||
bool openDev(int &fd, const char* dev);
|
bool openDev(int &fd, const char* dev);
|
||||||
|
|
||||||
int grabFrame_amvideocap(Image<ColorRgb> & image);
|
int grabFrame_amvideocap(Image<ColorRgb> & image);
|
||||||
int grabFrame_ge2d(Image<ColorRgb> & image);
|
|
||||||
|
|
||||||
/** The snapshot/capture device of the amlogic video chip */
|
/** The snapshot/capture device of the amlogic video chip */
|
||||||
int _captureDev;
|
int _captureDev;
|
||||||
int _videoDev;
|
int _videoDev;
|
||||||
int _ge2dDev;
|
|
||||||
|
|
||||||
Image<ColorBgr> _image_bgr;
|
Image<ColorBgr> _image_bgr;
|
||||||
void* _image_ptr;
|
void* _image_ptr;
|
||||||
@ -164,10 +54,4 @@ private:
|
|||||||
bool _videoPlaying;
|
bool _videoPlaying;
|
||||||
FramebufferFrameGrabber _fbGrabber;
|
FramebufferFrameGrabber _fbGrabber;
|
||||||
int _grabbingModeNotification;
|
int _grabbingModeNotification;
|
||||||
void* _ge2dVideoBufferPtr;
|
|
||||||
IonBuffer* _ge2dIonBuffer;
|
|
||||||
struct config_para_ex_s _configex;
|
|
||||||
ge2d_para_s _blitRect;
|
|
||||||
int _ge2d_mode;
|
|
||||||
QString _device;
|
|
||||||
};
|
};
|
||||||
|
@ -17,11 +17,8 @@ public:
|
|||||||
///
|
///
|
||||||
/// @param[in] grabWidth The width of the grabbed image [pixels]
|
/// @param[in] grabWidth The width of the grabbed image [pixels]
|
||||||
/// @param[in] grabHeight The height of the grabbed images [pixels]
|
/// @param[in] grabHeight The height of the grabbed images [pixels]
|
||||||
/// @param[in] updateRate_Hz The image grab rate [Hz]
|
|
||||||
/// @param[in] ge2d_mode use single or combine ge2d ioctl call
|
|
||||||
/// @param[in] device amlogic grabber device
|
|
||||||
///
|
///
|
||||||
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const unsigned ge2d_mode, const QString device);
|
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor of this dispmanx frame grabber. Releases any claimed resources.
|
/// Destructor of this dispmanx frame grabber. Releases any claimed resources.
|
||||||
|
0
include/grabber/X11Grabber.h
Executable file → Normal file
0
include/grabber/X11Grabber.h
Executable file → Normal file
@ -24,7 +24,7 @@ class GrabberWrapper : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const unsigned updateRate_Hz);
|
GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned width, unsigned height, const unsigned updateRate_Hz = 0);
|
||||||
|
|
||||||
virtual ~GrabberWrapper();
|
virtual ~GrabberWrapper();
|
||||||
|
|
||||||
|
0
libsrc/bonjour/bonjourserviceregister.cpp
Executable file → Normal file
0
libsrc/bonjour/bonjourserviceregister.cpp
Executable file → Normal file
208
libsrc/grabber/amlogic/AmlogicGrabber.cpp
Executable file → Normal file
208
libsrc/grabber/amlogic/AmlogicGrabber.cpp
Executable file → Normal file
@ -19,25 +19,16 @@
|
|||||||
|
|
||||||
#define VIDEO_DEVICE "/dev/amvideo"
|
#define VIDEO_DEVICE "/dev/amvideo"
|
||||||
#define CAPTURE_DEVICE "/dev/amvideocap0"
|
#define CAPTURE_DEVICE "/dev/amvideocap0"
|
||||||
#define GE2D_DEVICE "/dev/ge2d"
|
|
||||||
|
|
||||||
AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height, const unsigned ge2d_mode, const QString device)
|
AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height)
|
||||||
: Grabber("AMLOGICGRABBER", qMax(160u, width), qMax(160u, height)) // Minimum required width or height is 160
|
: Grabber("AMLOGICGRABBER", qMax(160u, width), qMax(160u, height)) // Minimum required width or height is 160
|
||||||
, _captureDev(-1)
|
, _captureDev(-1)
|
||||||
, _videoDev(-1)
|
, _videoDev(-1)
|
||||||
, _ge2dDev(-1)
|
|
||||||
, _lastError(0)
|
, _lastError(0)
|
||||||
, _fbGrabber("/dev/fb0",width,height)
|
, _fbGrabber("/dev/fb0",width,height)
|
||||||
, _grabbingModeNotification(0)
|
, _grabbingModeNotification(0)
|
||||||
, _ge2dVideoBufferPtr(nullptr)
|
|
||||||
, _ge2dIonBuffer(nullptr)
|
|
||||||
, _ge2d_mode(ge2d_mode)
|
|
||||||
, _device(device)
|
|
||||||
{
|
{
|
||||||
Debug(_log, "constructed(%d x %d), grabber device: %s",_width,_height,QSTRING_CSTR(_device));
|
Debug(_log, "constructed(%d x %d), grabber device: %s",_width,_height, CAPTURE_DEVICE);
|
||||||
|
|
||||||
if (_device.contains("ge2d"))
|
|
||||||
Debug(_log, "'ge2d' device use mode %d",ge2d_mode);
|
|
||||||
|
|
||||||
_image_bgr.resize(_width, _height);
|
_image_bgr.resize(_width, _height);
|
||||||
_bytesToRead = _image_bgr.size();
|
_bytesToRead = _image_bgr.size();
|
||||||
@ -48,7 +39,6 @@ AmlogicGrabber::~AmlogicGrabber()
|
|||||||
{
|
{
|
||||||
closeDev(_captureDev);
|
closeDev(_captureDev);
|
||||||
closeDev(_videoDev);
|
closeDev(_videoDev);
|
||||||
closeDev(_ge2dDev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AmlogicGrabber::openDev(int &fd, const char* dev)
|
bool AmlogicGrabber::openDev(int &fd, const char* dev)
|
||||||
@ -107,23 +97,9 @@ int AmlogicGrabber::grabFrame(Image<ColorRgb> & image)
|
|||||||
_lastError = 0;
|
_lastError = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_device == "ge2d")
|
|
||||||
{
|
|
||||||
if (grabFrame_ge2d(image) < 0)
|
|
||||||
{
|
|
||||||
closeDev(_videoDev);
|
|
||||||
closeDev(_ge2dDev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (_device == "amvideocap0")
|
|
||||||
{
|
|
||||||
if (grabFrame_amvideocap(image) < 0)
|
if (grabFrame_amvideocap(image) < 0)
|
||||||
{
|
|
||||||
closeDev(_videoDev);
|
|
||||||
closeDev(_captureDev);
|
closeDev(_captureDev);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_grabbingModeNotification!=2)
|
if (_grabbingModeNotification!=2)
|
||||||
@ -133,6 +109,8 @@ int AmlogicGrabber::grabFrame(Image<ColorRgb> & image)
|
|||||||
_lastError = 0;
|
_lastError = 0;
|
||||||
}
|
}
|
||||||
_fbGrabber.grabFrame(image);
|
_fbGrabber.grabFrame(image);
|
||||||
|
|
||||||
|
usleep(50 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -153,11 +131,11 @@ int AmlogicGrabber::grabFrame_amvideocap(Image<ColorRgb> & image)
|
|||||||
|
|
||||||
long r1 = ioctl(_captureDev, AMVIDEOCAP_IOW_SET_WANTFRAME_WIDTH, _width);
|
long r1 = ioctl(_captureDev, AMVIDEOCAP_IOW_SET_WANTFRAME_WIDTH, _width);
|
||||||
long r2 = ioctl(_captureDev, AMVIDEOCAP_IOW_SET_WANTFRAME_HEIGHT, _height);
|
long r2 = ioctl(_captureDev, AMVIDEOCAP_IOW_SET_WANTFRAME_HEIGHT, _height);
|
||||||
|
long r3 = ioctl(_captureDev, AMVIDEOCAP_IOW_SET_WANTFRAME_AT_FLAGS, CAP_FLAG_AT_END);
|
||||||
|
|
||||||
if (r1<0 || r2<0 || _height==0 || _width==0)
|
if (r1<0 || r2<0 || r3<0 || _height==0 || _width==0)
|
||||||
{
|
{
|
||||||
ErrorIf(_lastError != 2,_log,"Failed to configure capture size (%d - %s)", errno, strerror(errno));
|
ErrorIf(_lastError != 2,_log,"Failed to configure capture device (%d - %s)", errno, strerror(errno));
|
||||||
closeDev(_captureDev);
|
|
||||||
_lastError = 2;
|
_lastError = 2;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -169,7 +147,6 @@ int AmlogicGrabber::grabFrame_amvideocap(Image<ColorRgb> & image)
|
|||||||
if (bytesRead < 0)
|
if (bytesRead < 0)
|
||||||
{
|
{
|
||||||
ErrorIf(_lastError != 3, _log,"Read of device failed: %d - %s", errno, strerror(errno));
|
ErrorIf(_lastError != 3, _log,"Read of device failed: %d - %s", errno, strerror(errno));
|
||||||
closeDev(_captureDev);
|
|
||||||
_lastError = 3;
|
_lastError = 3;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -177,7 +154,6 @@ int AmlogicGrabber::grabFrame_amvideocap(Image<ColorRgb> & image)
|
|||||||
{
|
{
|
||||||
// Read of snapshot failed
|
// Read of snapshot failed
|
||||||
ErrorIf(_lastError != 4, _log,"Capture failed to grab entire image [bytesToRead(%d) != bytesRead(%d)]", _bytesToRead, bytesRead);
|
ErrorIf(_lastError != 4, _log,"Capture failed to grab entire image [bytesToRead(%d) != bytesRead(%d)]", _bytesToRead, bytesRead);
|
||||||
closeDev(_captureDev);
|
|
||||||
_lastError = 4;
|
_lastError = 4;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -188,173 +164,3 @@ int AmlogicGrabber::grabFrame_amvideocap(Image<ColorRgb> & image)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int AmlogicGrabber::grabFrame_ge2d(Image<ColorRgb> & image)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
static int videoWidth;
|
|
||||||
static int videoHeight;
|
|
||||||
|
|
||||||
if ( ! openDev(_ge2dDev, GE2D_DEVICE) || ! openDev(_videoDev, VIDEO_DEVICE))
|
|
||||||
{
|
|
||||||
ErrorIf( _lastError != 1 && _ge2dDev < 0, _log,"Failed to open the ge2d device: (%d - %s)", errno, strerror(errno));
|
|
||||||
ErrorIf( _lastError != 1 && _videoDev < 0, _log,"Failed to open the AMLOGIC video device: (%d - %s)", errno, strerror(errno));
|
|
||||||
_lastError = 1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ion
|
|
||||||
if (_ge2dIonBuffer == nullptr)
|
|
||||||
{
|
|
||||||
_ge2dIonBuffer = new IonBuffer(_width * _height * 3); // BGR
|
|
||||||
_ge2dVideoBufferPtr = _ge2dIonBuffer->Map();
|
|
||||||
memset(_ge2dVideoBufferPtr, 0, _ge2dIonBuffer->BufferSize());
|
|
||||||
|
|
||||||
memset(&_configex, 0, sizeof(_configex));
|
|
||||||
_configex.src_para.mem_type = CANVAS_TYPE_INVALID;
|
|
||||||
_configex.dst_para.mem_type = CANVAS_ALLOC;
|
|
||||||
_configex.dst_para.format = GE2D_FORMAT_S24_RGB;
|
|
||||||
_configex.dst_planes[0].addr = (long unsigned int)_ge2dIonBuffer->PhysicalAddress();
|
|
||||||
_configex.dst_para.width = _width;
|
|
||||||
_configex.dst_para.height = _height;
|
|
||||||
_configex.dst_planes[0].w = _configex.dst_para.width;
|
|
||||||
_configex.dst_planes[0].h = _configex.dst_para.height;
|
|
||||||
|
|
||||||
memset(&_blitRect, 0, sizeof(_blitRect));
|
|
||||||
_blitRect.dst_rect.w = _configex.dst_para.width;
|
|
||||||
_blitRect.dst_rect.h = _configex.dst_para.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(_ge2d_mode)
|
|
||||||
{
|
|
||||||
case ge2d_single:
|
|
||||||
{
|
|
||||||
int canvas_index;
|
|
||||||
if ((ret = ioctl(_videoDev, AMVIDEO_EXT_GET_CURRENT_VIDEOFRAME, &canvas_index)) < 0)
|
|
||||||
{
|
|
||||||
if (ret != -EAGAIN)
|
|
||||||
{
|
|
||||||
Error(_log, "AMVIDEO_EXT_GET_CURRENT_VIDEOFRAME failed: (%d - %s)", errno, strerror(errno));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Warning(_log, "AMVIDEO_EXT_GET_CURRENT_VIDEOFRAME failed, please try again!");
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t canvas0addr;
|
|
||||||
if (ioctl(_videoDev, AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_CANVAS0ADDR, &canvas0addr) < 0)
|
|
||||||
{
|
|
||||||
Error(_log, "AMSTREAM_EXT_CURRENT_VIDEOFRAME_GET_CANVAS0ADDR failed: (%d - %s)", errno, strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_configex.src_para.canvas_index = canvas0addr;
|
|
||||||
|
|
||||||
uint32_t ge2dformat;
|
|
||||||
if (ioctl(_videoDev, AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_GE2D_FORMAT, &ge2dformat) <0)
|
|
||||||
{
|
|
||||||
Error(_log, "AMSTREAM_EXT_CURRENT_VIDEOFRAME_GET_GE2D_FORMAT failed: (%d - %s)", errno, strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_configex.src_para.format = ge2dformat;
|
|
||||||
|
|
||||||
uint64_t size;
|
|
||||||
if (ioctl(_videoDev, AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_SIZE, &size) < 0)
|
|
||||||
{
|
|
||||||
Error(_log, "AMSTREAM_EXT_CURRENT_VIDEOFRAME_GET_SIZE failed: (%d - %s)", errno, strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
videoWidth = (size >> 32) - _cropLeft - _cropRight;
|
|
||||||
videoHeight = (size & 0xffffff) - _cropTop - _cropBottom;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ge2d_combined:
|
|
||||||
{
|
|
||||||
static struct amvideo_grabber_data grabber_data;
|
|
||||||
|
|
||||||
if ((ret = ioctl(_videoDev, AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_DATA, &grabber_data)) < 0)
|
|
||||||
{
|
|
||||||
if (ret == -EAGAIN)
|
|
||||||
{
|
|
||||||
Warning(_log, "AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_DATA failed, please try again!");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Error(_log, "AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_DATA failed.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
videoWidth = (grabber_data.size >> 32) - _cropLeft - _cropRight;
|
|
||||||
videoHeight = (grabber_data.size & 0xffffff) - _cropTop - _cropBottom;
|
|
||||||
|
|
||||||
_configex.src_para.canvas_index = grabber_data.canvas0Addr;
|
|
||||||
_configex.src_para.format = grabber_data.ge2dformat;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned cropLeft = _cropLeft;
|
|
||||||
unsigned cropTop = _cropTop;
|
|
||||||
|
|
||||||
// calculate final image dimensions and adjust top/left cropping in 3D modes
|
|
||||||
switch (_videoMode)
|
|
||||||
{
|
|
||||||
case VIDEO_3DSBS:
|
|
||||||
videoWidth >>= 1;
|
|
||||||
cropLeft = _cropLeft >> 1;
|
|
||||||
break;
|
|
||||||
case VIDEO_3DTAB:
|
|
||||||
videoHeight >>= 1;
|
|
||||||
cropTop = _cropTop >> 1;
|
|
||||||
break;
|
|
||||||
case VIDEO_2D:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_configex.src_para.left = cropLeft;
|
|
||||||
_configex.src_para.top = cropTop;
|
|
||||||
_configex.src_para.width = videoWidth;
|
|
||||||
_configex.src_para.height = videoHeight >> 1;
|
|
||||||
|
|
||||||
if (ioctl(_ge2dDev, GE2D_CONFIG_EX, &_configex) < 0)
|
|
||||||
{
|
|
||||||
Error(_log, "video GE2D_CONFIG_EX failed.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_blitRect.src1_rect.w = _configex.src_para.width;
|
|
||||||
_blitRect.src1_rect.h = _configex.src_para.height;
|
|
||||||
|
|
||||||
// Blit to videoBuffer
|
|
||||||
if (ioctl(_ge2dDev, GE2D_STRETCHBLIT_NOALPHA, &_blitRect) < 0)
|
|
||||||
{
|
|
||||||
Error(_log,"GE2D_STRETCHBLIT_NOALPHA failed.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return video frame
|
|
||||||
if (ioctl(_videoDev, AMVIDEO_EXT_PUT_CURRENT_VIDEOFRAME) < 0)
|
|
||||||
{
|
|
||||||
Error(_log, "AMSTREAM_EXT_PUT_CURRENT_VIDEOFRAME failed.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_ge2dIonBuffer->Sync();
|
|
||||||
|
|
||||||
// Read the snapshot into the memory
|
|
||||||
_useImageResampler = false;
|
|
||||||
_imageResampler.processImage((const uint8_t*)_ge2dVideoBufferPtr, _width, _height, (_width << 1) + _width, PIXELFORMAT_BGR24, image);
|
|
||||||
_lastError = 0;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <grabber/AmlogicWrapper.h>
|
#include <grabber/AmlogicWrapper.h>
|
||||||
|
|
||||||
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const unsigned ge2d_mode, const QString device)
|
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight)
|
||||||
: GrabberWrapper("AmLogic", &_grabber, grabWidth, grabHeight, updateRate_Hz)
|
: GrabberWrapper("AmLogic", &_grabber, grabWidth, grabHeight)
|
||||||
, _grabber(grabWidth, grabHeight, ge2d_mode, device)
|
, _grabber(grabWidth, grabHeight)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void AmlogicWrapper::action()
|
void AmlogicWrapper::action()
|
||||||
|
@ -11,75 +11,10 @@
|
|||||||
#define CAP_FLAG_AT_TIME_WINDOW 1
|
#define CAP_FLAG_AT_TIME_WINDOW 1
|
||||||
#define CAP_FLAG_AT_END 2
|
#define CAP_FLAG_AT_END 2
|
||||||
|
|
||||||
/*
|
|
||||||
format see linux/ge2d/ge2d.h
|
|
||||||
like:
|
|
||||||
GE2D_FORMAT_S24_RGB
|
|
||||||
*/
|
|
||||||
#define GE2D_ENDIAN_SHIFT 24
|
|
||||||
#define GE2D_LITTLE_ENDIAN (1 << GE2D_ENDIAN_SHIFT)
|
|
||||||
#define GE2D_COLOR_MAP_SHIFT 20
|
|
||||||
#define GE2D_COLOR_MAP_BGR888 (5 << GE2D_COLOR_MAP_SHIFT)
|
|
||||||
#define GE2D_COLOR_MAP_RGB888 (0 << GE2D_COLOR_MAP_SHIFT)
|
|
||||||
#define GE2D_FMT_S24_RGB (GE2D_LITTLE_ENDIAN|0x00200) /* 10_00_0_00_0_00 */
|
|
||||||
#define GE2D_FORMAT_S24_BGR (GE2D_FMT_S24_RGB | GE2D_COLOR_MAP_BGR888)
|
|
||||||
#define GE2D_FORMAT_S24_RGB (GE2D_FMT_S24_RGB | GE2D_COLOR_MAP_RGB888)
|
|
||||||
|
|
||||||
// #define AMVIDEOCAP_IOW_SET_WANTFRAME_FORMAT _IOW(AMVIDEOCAP_IOC_MAGIC, 0x01, int)
|
// #define AMVIDEOCAP_IOW_SET_WANTFRAME_FORMAT _IOW(AMVIDEOCAP_IOC_MAGIC, 0x01, int)
|
||||||
#define AMVIDEOCAP_IOW_SET_WANTFRAME_WIDTH _IOW(AMVIDEOCAP_IOC_MAGIC, 0x02, int)
|
#define AMVIDEOCAP_IOW_SET_WANTFRAME_WIDTH _IOW(AMVIDEOCAP_IOC_MAGIC, 0x02, int)
|
||||||
#define AMVIDEOCAP_IOW_SET_WANTFRAME_HEIGHT _IOW(AMVIDEOCAP_IOC_MAGIC, 0x03, int)
|
#define AMVIDEOCAP_IOW_SET_WANTFRAME_HEIGHT _IOW(AMVIDEOCAP_IOC_MAGIC, 0x03, int)
|
||||||
|
#define AMVIDEOCAP_IOW_SET_WANTFRAME_AT_FLAGS _IOW(AMVIDEOCAP_IOC_MAGIC, 0x06, int)
|
||||||
|
|
||||||
#define _A_M 'S'
|
#define _A_M 'S'
|
||||||
#define AMSTREAM_IOC_GET_VIDEO_DISABLE _IOR((_A_M), 0x48, int)
|
#define AMSTREAM_IOC_GET_VIDEO_DISABLE _IOR((_A_M), 0x48, int)
|
||||||
|
|
||||||
#define AMVIDEO_MAGIC 'X'
|
|
||||||
|
|
||||||
#define AMVIDEO_EXT_GET_CURRENT_VIDEOFRAME _IOR((AMVIDEO_MAGIC), 0x01, int)
|
|
||||||
#define AMVIDEO_EXT_PUT_CURRENT_VIDEOFRAME _IO((AMVIDEO_MAGIC), 0x02)
|
|
||||||
|
|
||||||
#define AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_GE2D_FORMAT _IOR((AMVIDEO_MAGIC), 0x03, uint32_t)
|
|
||||||
#define AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_SIZE _IOR((AMVIDEO_MAGIC), 0x04, uint64_t)
|
|
||||||
#define AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_CANVAS0ADDR _IOR((AMVIDEO_MAGIC), 0x05, uint32_t)
|
|
||||||
#define AMVIDEO_EXT_CURRENT_VIDEOFRAME_GET_DATA _IOR((AMVIDEO_MAGIC), 0x06, struct amvideo_grabber_data)
|
|
||||||
|
|
||||||
// GE2D commands
|
|
||||||
#define GE2D_IOC_MAGIC 'G'
|
|
||||||
#define GE2D_STRETCHBLIT_NOALPHA 0x4702
|
|
||||||
#define GE2D_CONFIG_EX _IOW(GE2D_IOC_MAGIC, 0x01, struct config_para_ex_s)
|
|
||||||
|
|
||||||
|
|
||||||
// data structures
|
|
||||||
enum ge2d_src_dst_e {
|
|
||||||
OSD0_OSD0 = 0,
|
|
||||||
OSD0_OSD1,
|
|
||||||
OSD1_OSD1,
|
|
||||||
OSD1_OSD0,
|
|
||||||
ALLOC_OSD0,
|
|
||||||
ALLOC_OSD1,
|
|
||||||
ALLOC_ALLOC,
|
|
||||||
TYPE_INVALID,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ge2d_src_canvas_type_e {
|
|
||||||
CANVAS_OSD0 = 0,
|
|
||||||
CANVAS_OSD1,
|
|
||||||
CANVAS_ALLOC,
|
|
||||||
CANVAS_TYPE_INVALID,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct src_dst_para_s {
|
|
||||||
int xres;
|
|
||||||
int yres;
|
|
||||||
int canvas_index;
|
|
||||||
int bpp;
|
|
||||||
int ge2d_color_index;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ge2d_op_type_e {
|
|
||||||
GE2D_OP_DEFAULT = 0,
|
|
||||||
GE2D_OP_FILLRECT,
|
|
||||||
GE2D_OP_BLIT,
|
|
||||||
GE2D_OP_STRETCHBLIT,
|
|
||||||
GE2D_OP_BLEND,
|
|
||||||
GE2D_OP_MAXNUM
|
|
||||||
};
|
|
||||||
|
0
libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp
Executable file → Normal file
0
libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp
Executable file → Normal file
0
libsrc/grabber/osx/OsxFrameGrabber.cpp
Executable file → Normal file
0
libsrc/grabber/osx/OsxFrameGrabber.cpp
Executable file → Normal file
0
libsrc/grabber/x11/X11Grabber.cpp
Executable file → Normal file
0
libsrc/grabber/x11/X11Grabber.cpp
Executable file → Normal file
0
libsrc/leddevice/LedDeviceFactory.cpp
Executable file → Normal file
0
libsrc/leddevice/LedDeviceFactory.cpp
Executable file → Normal file
0
libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp
Executable file → Normal file
0
libsrc/leddevice/dev_net/LedDevicePhilipsHue.cpp
Executable file → Normal file
0
libsrc/utils/ImageResampler.cpp
Executable file → Normal file
0
libsrc/utils/ImageResampler.cpp
Executable file → Normal file
0
libsrc/utils/RgbToRgbw.cpp
Executable file → Normal file
0
libsrc/utils/RgbToRgbw.cpp
Executable file → Normal file
@ -2,15 +2,15 @@
|
|||||||
// Hyperion-AmLogic includes
|
// Hyperion-AmLogic includes
|
||||||
#include "AmlogicWrapper.h"
|
#include "AmlogicWrapper.h"
|
||||||
|
|
||||||
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const unsigned ge2d_mode, const QString device) :
|
// Linux includes
|
||||||
_timer(this),
|
#include <unistd.h>
|
||||||
_grabber(grabWidth, grabHeight, ge2d_mode, device)
|
|
||||||
{
|
|
||||||
_timer.setSingleShot(false);
|
|
||||||
_timer.setInterval(updateRate_Hz);
|
|
||||||
|
|
||||||
|
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight) :
|
||||||
|
_thread(this),
|
||||||
|
_grabber(grabWidth, grabHeight)
|
||||||
|
{
|
||||||
// Connect capturing to the timeout signal of the timer
|
// 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()
|
const Image<ColorRgb> & AmlogicWrapper::getScreenshot()
|
||||||
@ -21,16 +21,20 @@ const Image<ColorRgb> & AmlogicWrapper::getScreenshot()
|
|||||||
|
|
||||||
void AmlogicWrapper::start()
|
void AmlogicWrapper::start()
|
||||||
{
|
{
|
||||||
_timer.start();
|
_thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmlogicWrapper::stop()
|
void AmlogicWrapper::stop()
|
||||||
{
|
{
|
||||||
_timer.stop();
|
_thread.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmlogicWrapper::capture()
|
void AmlogicWrapper::capture()
|
||||||
{
|
{
|
||||||
|
while (_thread.isRunning())
|
||||||
|
{
|
||||||
_grabber.grabFrame(_screenshot);
|
_grabber.grabFrame(_screenshot);
|
||||||
emit sig_screenshot(_screenshot);
|
emit sig_screenshot(_screenshot);
|
||||||
|
usleep(1 * 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
// QT includes
|
// QT includes
|
||||||
#include <QTimer>
|
#include <QThread>
|
||||||
|
|
||||||
// Hyperion-Dispmanx includes
|
// Hyperion-Dispmanx includes
|
||||||
#include <grabber/AmlogicGrabber.h>
|
#include <grabber/AmlogicGrabber.h>
|
||||||
@ -9,12 +9,12 @@ class AmlogicWrapper : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const unsigned ge2d_mode, const QString device);
|
AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight);
|
||||||
|
|
||||||
const Image<ColorRgb> & getScreenshot();
|
const Image<ColorRgb> & getScreenshot();
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Starts the timed capturing of screenshots
|
/// Starts the threaded capturing of screenshots
|
||||||
///
|
///
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
@ -25,18 +25,17 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
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();
|
void capture();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The QT timer to generate capture-publish events
|
/// The QT thread to generate capture-publish events
|
||||||
QTimer _timer;
|
QThread _thread;
|
||||||
|
|
||||||
/// The grabber for creating screenshots
|
/// The grabber for creating screenshots
|
||||||
AmlogicGrabber _grabber;
|
AmlogicGrabber _grabber;
|
||||||
|
|
||||||
// image buffers
|
// image buffers
|
||||||
Image<ColorRgb> _screenshot;
|
Image<ColorRgb> _screenshot;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -37,12 +37,9 @@ int main(int argc, char ** argv)
|
|||||||
// create the option parser and initialize all parser
|
// 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.");
|
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 & 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);
|
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");
|
BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
|
||||||
IntOption & argge2d_mode = parser.add<IntOption> (0x0, "ge2d-mode", "ge2d ioctl mode, 0 single ioctl, 1 combined ioctl [default: %1]", "0");
|
|
||||||
Option & argDevice = parser.add<Option> (0x0, "device", "The Amlogic device to use [default: %1]", "amvideocap0");
|
|
||||||
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
|
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19400");
|
||||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||||
@ -57,7 +54,7 @@ int main(int argc, char ** argv)
|
|||||||
parser.showHelp(0);
|
parser.showHelp(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
AmlogicWrapper amlWrapper(argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser), argge2d_mode.getInt(parser), argDevice.value(parser));
|
AmlogicWrapper amlWrapper(argWidth.getInt(parser), argHeight.getInt(parser));
|
||||||
|
|
||||||
if (parser.isSet(argScreenshot))
|
if (parser.isSet(argScreenshot))
|
||||||
{
|
{
|
||||||
|
@ -457,7 +457,7 @@ void HyperionDaemon::createGrabberDispmanx()
|
|||||||
void HyperionDaemon::createGrabberAmlogic()
|
void HyperionDaemon::createGrabberAmlogic()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_AMLOGIC
|
#ifdef ENABLE_AMLOGIC
|
||||||
_amlGrabber = new AmlogicWrapper(_grabber_width, _grabber_height, _grabber_frequency, _grabber_ge2d_mode, _grabber_device);
|
_amlGrabber = new AmlogicWrapper(_grabber_width, _grabber_height);
|
||||||
_amlGrabber->setCropping(_grabber_cropLeft, _grabber_cropRight, _grabber_cropTop, _grabber_cropBottom);
|
_amlGrabber->setCropping(_grabber_cropLeft, _grabber_cropRight, _grabber_cropTop, _grabber_cropBottom);
|
||||||
|
|
||||||
// connect to HyperionDaemon signal
|
// connect to HyperionDaemon signal
|
||||||
|
Loading…
Reference in New Issue
Block a user