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:
@@ -52,10 +52,6 @@ AmlogicGrabber::~AmlogicGrabber()
|
||||
|
||||
bool AmlogicGrabber::isVideoPlaying()
|
||||
{
|
||||
|
||||
// TODO crop resulting image accroding member _videoMode
|
||||
// TODO add croping
|
||||
|
||||
const QString videoDevice = "/dev/amvideo";
|
||||
|
||||
// Open the video device
|
||||
@@ -81,13 +77,10 @@ bool AmlogicGrabber::isVideoPlaying()
|
||||
return videoDisabled == 0;
|
||||
}
|
||||
|
||||
int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
|
||||
int AmlogicGrabber::grabFrame(Image<ColorRgb> & image)
|
||||
{
|
||||
// resize the given image if needed
|
||||
if (image.width() != (unsigned)_width || image.height() != (unsigned)_height)
|
||||
{
|
||||
image.resize(_width, _height);
|
||||
}
|
||||
// TODO crop resulting image accroding member _videoMode
|
||||
// TODO add croping
|
||||
|
||||
// Make sure video is playing, else there is nothing to grab
|
||||
if (!isVideoPlaying())
|
||||
@@ -95,7 +88,6 @@ int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// If the device is not open, attempt to open it
|
||||
if (_amlogicCaptureDev == -1)
|
||||
{
|
||||
@@ -121,7 +113,7 @@ int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
|
||||
}
|
||||
|
||||
// Read the snapshot into the memory
|
||||
void * image_ptr = image.memptr();
|
||||
void * image_ptr = _image.memptr();
|
||||
const ssize_t bytesToRead = _width * _height * sizeof(ColorBgr);
|
||||
|
||||
const ssize_t bytesRead = pread(_amlogicCaptureDev, image_ptr, bytesToRead, 0);
|
||||
@@ -150,5 +142,10 @@ int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
|
||||
_amlogicCaptureDev = -1;
|
||||
readCnt = 0;
|
||||
}
|
||||
|
||||
_imageResampler.setHorizontalPixelDecimation(_width);
|
||||
_imageResampler.setVerticalPixelDecimation(_height);
|
||||
_imageResampler.processImage((const uint8_t*)image_ptr, _width, _height, 3, PIXELFORMAT_BGR24, image);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user