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

@@ -31,10 +31,8 @@
#endif
AmlogicGrabber::AmlogicGrabber(const unsigned width, const unsigned height)
: _width(qMax(160u, width)) // Minimum required width or height is 160
, _height(qMax(160u, height))
: Grabber("AMLOGICGRABBER", qMax(160u, width), qMax(160u, height)) // Minimum required width or height is 160
, _amlogicCaptureDev(-1)
, _log(Logger::getInstance("AMLOGICGRABBER"))
{
Debug(_log, "constructed(%d x %d)",_width,_height);
}
@@ -51,24 +49,13 @@ AmlogicGrabber::~AmlogicGrabber()
}
}
void AmlogicGrabber::setVideoMode(const VideoMode videoMode)
{
switch (videoMode) {
case VIDEO_3DSBS:
//vc_dispmanx_rect_set(&_rectangle, 0, 0, _width/2, _height);
break;
case VIDEO_3DTAB:
//vc_dispmanx_rect_set(&_rectangle, 0, 0, _width, _height/2);
break;
case VIDEO_2D:
default:
//vc_dispmanx_rect_set(&_rectangle, 0, 0, _width, _height);
break;
}
}
bool AmlogicGrabber::isVideoPlaying()
{
// TODO crop resulting image accroding member _videoMode
// TODO add croping
const QString videoDevice = "/dev/amvideo";
// Open the video device
@@ -97,7 +84,7 @@ bool AmlogicGrabber::isVideoPlaying()
int AmlogicGrabber::grabFrame(Image<ColorBgr> & image)
{
// resize the given image if needed
if (image.width() != _width || image.height() != _height)
if (image.width() != (unsigned)_width || image.height() != (unsigned)_height)
{
image.resize(_width, _height);
}

View File

@@ -4,26 +4,14 @@ INCLUDE (CheckIncludeFiles)
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic)
SET(AmlogicHEADERS
${CURRENT_HEADER_DIR}/AmlogicGrabber.h
${CURRENT_HEADER_DIR}/AmlogicWrapper.h
)
SET(AmlogicSOURCES
${CURRENT_SOURCE_DIR}/AmlogicWrapper.cpp
${CURRENT_SOURCE_DIR}/AmlogicGrabber.cpp
)
FILE ( GLOB AmlogicSOURCES "${CURRENT_HEADER_DIR}/Amlogic*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
CHECK_INCLUDE_FILES ("amcodec/amports/amstream.h" HAVE_AML_HEADER)
IF (${HAVE_AML_HEADER})
ADD_DEFINITIONS( -DHAVE_AML_HEADER )
ENDIF()
add_library(amlogic-grabber
${AmlogicHEADERS}
${AmlogicSOURCES}
)
add_library(amlogic-grabber ${AmlogicSOURCES} )
target_link_libraries(amlogic-grabber
hyperion