Dynamic loading of the Dispmanx Grabber (#1440)

* BCM dynamic loading

* cleanup

* better handle start of dispmanx

* set GrabberWrapper pointer to null on exit

* Update DispmanxFrameGrabber.cpp
This commit is contained in:
Markus
2022-03-20 14:42:21 +01:00
committed by GitHub
parent f32db90c12
commit addff6f7ef
16 changed files with 278 additions and 287 deletions

View File

@@ -3,16 +3,8 @@ project(hyperion-dispmanx)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Widgets REQUIRED)
IF ( "${PLATFORM}" MATCHES rpi)
find_package(BCM REQUIRED)
ELSE()
SET(BCM_INCLUDE_DIRS "")
SET(BCM_LIBRARIES "")
ENDIF()
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
${BCM_INCLUDE_DIRS}
${FLATBUFFERS_INCLUDE_DIRS}
)
@@ -30,13 +22,15 @@ add_executable( ${PROJECT_NAME}
${Hyperion_Dispmanx_SOURCES}
)
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-rdynamic")
SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} "-rdynamic")
target_link_libraries( ${PROJECT_NAME}
commandline
hyperion-utils
flatbufconnect
flatbuffers
dispmanx-grabber
${Dispmanx_LIBRARIES}
ssdp
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Network

View File

@@ -27,6 +27,11 @@ const Image<ColorRgb> & DispmanxWrapper::getScreenshot()
return _screenshot;
}
bool DispmanxWrapper::open()
{
return _grabber.open();
}
void DispmanxWrapper::start()
{
_timer.start();
@@ -39,13 +44,16 @@ void DispmanxWrapper::stop()
bool DispmanxWrapper::screenInit()
{
return _grabber.setupScreen();
return (open() && _grabber.setupScreen());
}
void DispmanxWrapper::capture()
{
_grabber.grabFrame(_screenshot);
emit sig_screenshot(_screenshot);
if ( open() )
{
_grabber.grabFrame(_screenshot);
emit sig_screenshot(_screenshot);
}
}
void DispmanxWrapper::setVideoMode(VideoMode mode)

View File

@@ -16,6 +16,8 @@ public:
);
const Image<ColorRgb> & getScreenshot();
bool open();
///
/// Starts the timed capturing of screenshots