mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
grabber api and feature unification (#462)
* move setvideomode to common place * implement more croping and 3d support * more api unification * more refactoring * osx fix * next step * add a mock for osx grabber. Now it is possible to test compile on none osx platforms. * more unifications ... * remove obsolete includes and grabbers are not dyn allocated. dispmanx needs rework an probaly not work atm * first version of dispmanx mock. it compiles, but outputs a black image * now dispmanx mock works! * activate mocks in travis linux build prepare dispmanx to rgb image out * dispmanx now with image rgb output fix deadlock with w/h -1 in grabber v4l cleanups * fix json * fix some runtime stuff * Update FramebufferWrapper.cpp fix missing code * unify grabframe * 3d and croping for amlogic * fix setimage not working * make use of templates save some codelines * save more code lines
This commit is contained in:
@@ -3,16 +3,19 @@
|
||||
|
||||
Grabber::Grabber(QString grabberName, int width, int height, int cropLeft, int cropRight, int cropTop, int cropBottom)
|
||||
: _imageResampler()
|
||||
, _useImageResampler(true)
|
||||
, _videoMode(VIDEO_2D)
|
||||
, _width(width)
|
||||
, _height(height)
|
||||
, _cropLeft(cropLeft)
|
||||
, _cropRight(cropRight)
|
||||
, _cropTop(cropTop)
|
||||
, _cropBottom(cropBottom)
|
||||
, _cropLeft(0)
|
||||
, _cropRight(0)
|
||||
, _cropTop(0)
|
||||
, _cropBottom(0)
|
||||
, _log(Logger::getInstance(grabberName))
|
||||
|
||||
{
|
||||
setVideoMode(VIDEO_2D);
|
||||
setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
||||
}
|
||||
|
||||
Grabber::~Grabber()
|
||||
@@ -22,6 +25,41 @@ Grabber::~Grabber()
|
||||
|
||||
void Grabber::setVideoMode(VideoMode mode)
|
||||
{
|
||||
Debug(_log,"setvideomode %d", mode);
|
||||
_videoMode = mode;
|
||||
_imageResampler.set3D(_videoMode);
|
||||
if ( _useImageResampler )
|
||||
{
|
||||
_imageResampler.setVideoMode(_videoMode);
|
||||
}
|
||||
}
|
||||
|
||||
void Grabber::setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom)
|
||||
{
|
||||
if (_width>0 && _height>0)
|
||||
{
|
||||
if (cropLeft + cropRight >= (unsigned)_width || cropTop + cropBottom >= (unsigned)_height)
|
||||
{
|
||||
Error(_log, "Rejecting invalid crop values: left: %d, right: %d, top: %d, bottom: %d", cropLeft, cropRight, cropTop, cropBottom);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_cropLeft = cropLeft;
|
||||
_cropRight = cropRight;
|
||||
_cropTop = cropTop;
|
||||
_cropBottom = cropBottom;
|
||||
|
||||
if ( _useImageResampler )
|
||||
{
|
||||
_imageResampler.setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
_imageResampler.setCropping(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (cropLeft > 0 || cropRight > 0 || cropTop > 0 || cropBottom > 0)
|
||||
{
|
||||
Info(_log, "Cropping image: width=%d height=%d; crop: left=%d right=%d top=%d bottom=%d ", _width, _height, cropLeft, cropRight, cropTop, cropBottom);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user