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:
redPanther
2017-08-04 23:08:15 +02:00
committed by GitHub
parent 3612ccda75
commit 569e59110e
54 changed files with 375 additions and 659 deletions

View File

@@ -1,26 +1,10 @@
# Find the BCM-package (VC control)
# find_package(BCM REQUIRED)
# include_directories(${BCM_INCLUDE_DIRS})
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer)
SET(FramebufferGrabberHEADERS
${CURRENT_HEADER_DIR}/FramebufferFrameGrabber.h
${CURRENT_HEADER_DIR}/FramebufferWrapper.h
)
FILE ( GLOB FramebufferGrabberSOURCES "${CURRENT_HEADER_DIR}/Framebuffer*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(FramebufferGrabberSOURCES
${CURRENT_SOURCE_DIR}/FramebufferWrapper.cpp
${CURRENT_SOURCE_DIR}/FramebufferFrameGrabber.cpp
)
add_library(framebuffer-grabber
${FramebufferGrabberHEADERS}
${FramebufferGrabberSOURCES}
)
add_library(framebuffer-grabber ${FramebufferGrabberSOURCES} )
target_link_libraries(framebuffer-grabber
hyperion

View File

@@ -12,14 +12,11 @@
// Local includes
#include <grabber/FramebufferFrameGrabber.h>
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height) :
_fbfd(0),
_fbp(0),
_fbDevice(device),
_width(width),
_height(height),
_imgResampler(new ImageResampler()),
_log(Logger::getInstance("FRAMEBUFFERGRABBER"))
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const unsigned width, const unsigned height)
: Grabber("FRAMEBUFFERGRABBER", width, height)
, _fbfd(0)
, _fbp(0)
, _fbDevice(device)
{
int result;
struct fb_var_screeninfo vinfo;
@@ -48,12 +45,6 @@ FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device, const u
FramebufferFrameGrabber::~FramebufferFrameGrabber()
{
delete _imgResampler;
}
void FramebufferFrameGrabber::setVideoMode(const VideoMode videoMode)
{
_imgResampler->set3D(videoMode);
}
void FramebufferFrameGrabber::grabFrame(Image<ColorRgb> & image)
@@ -93,9 +84,9 @@ void FramebufferFrameGrabber::grabFrame(Image<ColorRgb> & image)
/* map the device to memory */
_fbp = (unsigned char*)mmap(0, capSize, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, _fbfd, 0);
_imgResampler->setHorizontalPixelDecimation(vinfo.xres/_width);
_imgResampler->setVerticalPixelDecimation(vinfo.yres/_height);
_imgResampler->processImage(_fbp,
_imageResampler.setHorizontalPixelDecimation(vinfo.xres/_width);
_imageResampler.setVerticalPixelDecimation(vinfo.yres/_height);
_imageResampler.processImage(_fbp,
vinfo.xres,
vinfo.yres,
vinfo.xres * bytesPerPixel,