mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge remote-tracking branch 'refs/remotes/tvdzwan/master'
# Conflicts: # include/hyperion/Hyperion.h # libsrc/hyperion/CMakeLists.txt # libsrc/hyperion/Hyperion.cpp Former-commit-id: 1144520581d4531952038d2118cb11e01bebc10e
This commit is contained in:
@@ -9,28 +9,33 @@ SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx)
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
SET(DispmanxGrabberQT_HEADERS
|
||||
${CURRENT_HEADER_DIR}/DispmanxWrapper.h
|
||||
${CURRENT_HEADER_DIR}/DispmanxWrapper.h
|
||||
)
|
||||
|
||||
SET(DispmanxGrabberHEADERS
|
||||
${CURRENT_SOURCE_DIR}/DispmanxFrameGrabber.h
|
||||
${CURRENT_HEADER_DIR}/DispmanxFrameGrabber.h
|
||||
)
|
||||
|
||||
SET(DispmanxGrabberSOURCES
|
||||
${CURRENT_SOURCE_DIR}/DispmanxWrapper.cpp
|
||||
${CURRENT_SOURCE_DIR}/DispmanxFrameGrabber.cpp
|
||||
${CURRENT_SOURCE_DIR}/DispmanxWrapper.cpp
|
||||
${CURRENT_SOURCE_DIR}/DispmanxFrameGrabber.cpp
|
||||
)
|
||||
|
||||
QT4_WRAP_CPP(DispmanxGrabberHEADERS_MOC ${DispmanxGrabberQT_HEADERS})
|
||||
if(ENABLE_QT5)
|
||||
QT5_WRAP_CPP(DispmanxGrabberHEADERS_MOC ${DispmanxGrabberQT_HEADERS})
|
||||
else(ENABLE_QT5)
|
||||
QT4_WRAP_CPP(DispmanxGrabberHEADERS_MOC ${DispmanxGrabberQT_HEADERS})
|
||||
endif(ENABLE_QT5)
|
||||
|
||||
add_library(dispmanx-grabber
|
||||
${DispmanxGrabberHEADERS}
|
||||
${DispmanxGrabberQT_HEADERS}
|
||||
${DispmanxGrabberHEADERS_MOC}
|
||||
${DispmanxGrabberSOURCES}
|
||||
${DispmanxGrabberHEADERS}
|
||||
${DispmanxGrabberQT_HEADERS}
|
||||
${DispmanxGrabberHEADERS_MOC}
|
||||
${DispmanxGrabberSOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(dispmanx-grabber
|
||||
hyperion
|
||||
${QT_LIBRARIES}
|
||||
${BCM_LIBRARIES})
|
||||
hyperion
|
||||
${QT_LIBRARIES}
|
||||
${BCM_LIBRARIES}
|
||||
)
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include <iostream>
|
||||
|
||||
// Local includes
|
||||
#include "DispmanxFrameGrabber.h"
|
||||
#include "grabber/DispmanxFrameGrabber.h"
|
||||
|
||||
DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned height) :
|
||||
_vc_display(0),
|
||||
|
@@ -1,71 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// BCM includes
|
||||
#pragma GCC system_header
|
||||
#include <bcm_host.h>
|
||||
|
||||
// STL includes
|
||||
#include <cstdint>
|
||||
|
||||
// Utils includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgba.h>
|
||||
#include <utils/VideoMode.h>
|
||||
|
||||
///
|
||||
/// The DispmanxFrameGrabber is used for creating snapshots of the display (screenshots) with a
|
||||
/// downsized and scaled resolution.
|
||||
///
|
||||
class DispmanxFrameGrabber
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Construct a DispmanxFrameGrabber that will capture snapshots with specified dimensions.
|
||||
///
|
||||
/// @param[in] width The width of the captured screenshot
|
||||
/// @param[in] height The heigth of the captured screenshot
|
||||
///
|
||||
DispmanxFrameGrabber(const unsigned width, const unsigned height);
|
||||
~DispmanxFrameGrabber();
|
||||
|
||||
///
|
||||
/// Updates the frame-grab flags as used by the VC library for frame grabbing
|
||||
///
|
||||
/// @param vc_flags The snapshot grabbing mask
|
||||
///
|
||||
void setFlags(const int vc_flags);
|
||||
|
||||
///
|
||||
/// Set the video mode (2D/3D)
|
||||
/// @param[in] mode The new video mode
|
||||
///
|
||||
void setVideoMode(const VideoMode videoMode);
|
||||
|
||||
///
|
||||
/// Captures a single snapshot of the display and writes the data to the given image. The
|
||||
/// provided image should have the same dimensions as the configured values (_width and
|
||||
/// _height)
|
||||
///
|
||||
/// @param[out] image The snapped screenshot (should be initialized with correct width and
|
||||
/// height)
|
||||
///
|
||||
void grabFrame(Image<ColorRgba> & image);
|
||||
|
||||
private:
|
||||
/// Handle to the display that is being captured
|
||||
DISPMANX_DISPLAY_HANDLE_T _vc_display;
|
||||
|
||||
/// Handle to the resource for storing the captured snapshot
|
||||
DISPMANX_RESOURCE_HANDLE_T _vc_resource;
|
||||
|
||||
/// Rectangle of the captured resource that is transfered to user space
|
||||
VC_RECT_T _rectangle;
|
||||
|
||||
/// Flags (transforms) for creating snapshots
|
||||
int _vc_flags;
|
||||
|
||||
/// With of the captured snapshot [pixels]
|
||||
const unsigned _width;
|
||||
/// Height of the captured snapshot [pixels]
|
||||
const unsigned _height;
|
||||
};
|
@@ -9,7 +9,7 @@
|
||||
|
||||
// Dispmanx grabber includes
|
||||
#include <grabber/DispmanxWrapper.h>
|
||||
#include "DispmanxFrameGrabber.h"
|
||||
#include <grabber/DispmanxFrameGrabber.h>
|
||||
|
||||
|
||||
DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, Hyperion * hyperion) :
|
||||
@@ -28,6 +28,7 @@ DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHe
|
||||
_timer.setSingleShot(false);
|
||||
|
||||
_processor->setSize(grabWidth, grabHeight);
|
||||
_forward = _hyperion->getForwarder()->protoForwardingEnabled();
|
||||
|
||||
// Connect the QTimer to this
|
||||
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
||||
@@ -51,10 +52,17 @@ void DispmanxWrapper::action()
|
||||
// Grab frame into the allocated image
|
||||
_frameGrabber->grabFrame(_image);
|
||||
|
||||
_processor->process(_image, _ledColors);
|
||||
if ( _forward )
|
||||
{
|
||||
Image<ColorRgb> image_rgb;
|
||||
_image.toRgb(image_rgb);
|
||||
emit emitImage(_priority, image_rgb, _timeout_ms);
|
||||
}
|
||||
|
||||
_processor->process(_image, _ledColors);
|
||||
_hyperion->setColors(_priority, _ledColors, _timeout_ms);
|
||||
}
|
||||
|
||||
void DispmanxWrapper::stop()
|
||||
{
|
||||
// Stop the timer, effectivly stopping the process
|
||||
|
Reference in New Issue
Block a user