mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge pull request #535 from redPanther/prio_cleanup
Prio cleanup Former-commit-id: 9b801630fe3c32232666cc2c5f3f3cfd43da381b
This commit is contained in:
@@ -21,14 +21,14 @@
|
||||
// project includes
|
||||
#include "BoblightClientConnection.h"
|
||||
|
||||
BoblightClientConnection::BoblightClientConnection(QTcpSocket *socket, Hyperion * hyperion) :
|
||||
BoblightClientConnection::BoblightClientConnection(QTcpSocket *socket, const int priority, Hyperion * hyperion) :
|
||||
QObject(),
|
||||
_locale(QLocale::C),
|
||||
_socket(socket),
|
||||
_imageProcessor(ImageProcessorFactory::getInstance().newImageProcessor()),
|
||||
_hyperion(hyperion),
|
||||
_receiveBuffer(),
|
||||
_priority(255),
|
||||
_priority(priority),
|
||||
_ledColors(hyperion->getLedCount(), ColorRgb::BLACK)
|
||||
{
|
||||
// initalize the locale. Start with the default C-locale
|
||||
|
@@ -26,7 +26,7 @@ public:
|
||||
/// @param socket The Socket object for this connection
|
||||
/// @param hyperion The Hyperion server
|
||||
///
|
||||
BoblightClientConnection(QTcpSocket * socket, Hyperion * hyperion);
|
||||
BoblightClientConnection(QTcpSocket * socket, const int priority, Hyperion * hyperion);
|
||||
|
||||
///
|
||||
/// Destructor
|
||||
|
@@ -5,11 +5,12 @@
|
||||
#include <boblightserver/BoblightServer.h>
|
||||
#include "BoblightClientConnection.h"
|
||||
|
||||
BoblightServer::BoblightServer(Hyperion *hyperion, uint16_t port) :
|
||||
BoblightServer::BoblightServer(Hyperion *hyperion, const int priority,uint16_t port) :
|
||||
QObject(),
|
||||
_hyperion(hyperion),
|
||||
_server(),
|
||||
_openConnections()
|
||||
_openConnections(),
|
||||
_priority(priority)
|
||||
{
|
||||
if (!_server.listen(QHostAddress::Any, port))
|
||||
{
|
||||
@@ -39,7 +40,7 @@ void BoblightServer::newConnection()
|
||||
if (socket != nullptr)
|
||||
{
|
||||
std::cout << "New boblight connection" << std::endl;
|
||||
BoblightClientConnection * connection = new BoblightClientConnection(socket, _hyperion);
|
||||
BoblightClientConnection * connection = new BoblightClientConnection(socket, _priority, _hyperion);
|
||||
_openConnections.insert(connection);
|
||||
|
||||
// register slot for cleaning up after the connection closed
|
||||
|
@@ -12,10 +12,10 @@
|
||||
#include <grabber/AmlogicGrabber.h>
|
||||
|
||||
|
||||
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, Hyperion * hyperion) :
|
||||
AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
|
||||
_updateInterval_ms(1000/updateRate_Hz),
|
||||
_timeout_ms(2 * _updateInterval_ms),
|
||||
_priority(999),
|
||||
_priority(priority),
|
||||
_timer(),
|
||||
_image(grabWidth, grabHeight),
|
||||
_frameGrabber(new AmlogicGrabber(grabWidth, grabHeight)),
|
||||
|
@@ -12,10 +12,10 @@
|
||||
#include <grabber/DispmanxFrameGrabber.h>
|
||||
|
||||
|
||||
DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, Hyperion * hyperion) :
|
||||
DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
|
||||
_updateInterval_ms(1000/updateRate_Hz),
|
||||
_timeout_ms(2 * _updateInterval_ms),
|
||||
_priority(1000),
|
||||
_priority(priority),
|
||||
_timer(),
|
||||
_image(grabWidth, grabHeight),
|
||||
_frameGrabber(new DispmanxFrameGrabber(grabWidth, grabHeight)),
|
||||
|
@@ -1,39 +1,39 @@
|
||||
|
||||
# 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)
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
SET(FramebufferGrabberQT_HEADERS
|
||||
${CURRENT_HEADER_DIR}/FramebufferWrapper.h
|
||||
)
|
||||
|
||||
SET(FramebufferGrabberHEADERS
|
||||
${CURRENT_SOURCE_DIR}/FramebufferFrameGrabber.h
|
||||
)
|
||||
|
||||
SET(FramebufferGrabberSOURCES
|
||||
${CURRENT_SOURCE_DIR}/FramebufferWrapper.cpp
|
||||
${CURRENT_SOURCE_DIR}/FramebufferFrameGrabber.cpp
|
||||
)
|
||||
|
||||
if(ENABLE_QT5)
|
||||
QT5_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS})
|
||||
else(ENABLE_QT5)
|
||||
QT4_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS})
|
||||
endif(ENABLE_QT5)
|
||||
|
||||
add_library(framebuffer-grabber
|
||||
${FramebufferGrabberHEADERS}
|
||||
${FramebufferGrabberQT_HEADERS}
|
||||
${FramebufferGrabberHEADERS_MOC}
|
||||
${FramebufferGrabberSOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(framebuffer-grabber
|
||||
hyperion
|
||||
${QT_LIBRARIES})
|
||||
|
||||
# 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)
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
SET(FramebufferGrabberQT_HEADERS
|
||||
${CURRENT_HEADER_DIR}/FramebufferWrapper.h
|
||||
)
|
||||
|
||||
SET(FramebufferGrabberHEADERS
|
||||
${CURRENT_HEADER_DIR}/FramebufferFrameGrabber.h
|
||||
)
|
||||
|
||||
SET(FramebufferGrabberSOURCES
|
||||
${CURRENT_SOURCE_DIR}/FramebufferWrapper.cpp
|
||||
${CURRENT_SOURCE_DIR}/FramebufferFrameGrabber.cpp
|
||||
)
|
||||
|
||||
if(ENABLE_QT5)
|
||||
QT5_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS})
|
||||
else(ENABLE_QT5)
|
||||
QT4_WRAP_CPP(FramebufferGrabberHEADERS_MOC ${FramebufferGrabberQT_HEADERS})
|
||||
endif(ENABLE_QT5)
|
||||
|
||||
add_library(framebuffer-grabber
|
||||
${FramebufferGrabberHEADERS}
|
||||
${FramebufferGrabberQT_HEADERS}
|
||||
${FramebufferGrabberHEADERS_MOC}
|
||||
${FramebufferGrabberSOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(framebuffer-grabber
|
||||
hyperion
|
||||
${QT_LIBRARIES})
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include <iostream>
|
||||
|
||||
// Local includes
|
||||
#include "FramebufferFrameGrabber.h"
|
||||
#include <grabber/FramebufferFrameGrabber.h>
|
||||
|
||||
FramebufferFrameGrabber::FramebufferFrameGrabber(const std::string & device, const unsigned width, const unsigned height) :
|
||||
_fbfd(0),
|
||||
|
@@ -1,59 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Utils includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/ImageResampler.h>
|
||||
|
||||
///
|
||||
/// The FramebufferFrameGrabber is used for creating snapshots of the display (screenshots)
|
||||
///
|
||||
class FramebufferFrameGrabber
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Construct a FramebufferFrameGrabber that will capture snapshots with specified dimensions.
|
||||
///
|
||||
/// @param[in] device The framebuffer device name/path
|
||||
/// @param[in] width The width of the captured screenshot
|
||||
/// @param[in] height The heigth of the captured screenshot
|
||||
///
|
||||
FramebufferFrameGrabber(const std::string & device, const unsigned width, const unsigned height);
|
||||
~FramebufferFrameGrabber();
|
||||
|
||||
///
|
||||
/// 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<ColorRgb> & image);
|
||||
|
||||
private:
|
||||
/// Framebuffer file descriptor
|
||||
int _fbfd;
|
||||
|
||||
/// Pointer to framebuffer
|
||||
unsigned char * _fbp;
|
||||
|
||||
/// Framebuffer device e.g. /dev/fb0
|
||||
const std::string _fbDevice;
|
||||
|
||||
/// With of the captured snapshot [pixels]
|
||||
const unsigned _width;
|
||||
|
||||
/// Height of the captured snapshot [pixels]
|
||||
const unsigned _height;
|
||||
|
||||
/// Image resampler for downscaling the image
|
||||
ImageResampler * _imgResampler;
|
||||
};
|
@@ -5,12 +5,12 @@
|
||||
|
||||
// Framebuffer grabber includes
|
||||
#include <grabber/FramebufferWrapper.h>
|
||||
#include "FramebufferFrameGrabber.h"
|
||||
#include <grabber/FramebufferFrameGrabber.h>
|
||||
|
||||
FramebufferWrapper::FramebufferWrapper(const std::string & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, Hyperion * hyperion) :
|
||||
FramebufferWrapper::FramebufferWrapper(const std::string & device, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
|
||||
_updateInterval_ms(1000/updateRate_Hz),
|
||||
_timeout_ms(2 * _updateInterval_ms),
|
||||
_priority(1000),
|
||||
_priority(priority),
|
||||
_timer(),
|
||||
_image(grabWidth, grabHeight),
|
||||
_frameGrabber(new FramebufferFrameGrabber(device, grabWidth, grabHeight)),
|
||||
|
@@ -1,34 +1,34 @@
|
||||
# Define the current source locations
|
||||
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
|
||||
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/osx)
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
SET(OsxGrabberQT_HEADERS
|
||||
${CURRENT_HEADER_DIR}/OsxWrapper.h
|
||||
)
|
||||
|
||||
SET(OsxGrabberHEADERS
|
||||
${CURRENT_SOURCE_DIR}/OsxFrameGrabber.h
|
||||
)
|
||||
|
||||
SET(OsxGrabberSOURCES
|
||||
${CURRENT_SOURCE_DIR}/OsxWrapper.cpp
|
||||
${CURRENT_SOURCE_DIR}/OsxFrameGrabber.cpp
|
||||
)
|
||||
|
||||
if(ENABLE_QT5)
|
||||
QT5_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
|
||||
else(ENABLE_QT5)
|
||||
QT4_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
|
||||
endif(ENABLE_QT5)
|
||||
|
||||
add_library(osx-grabber
|
||||
${OsxGrabberHEADERS}
|
||||
${OsxGrabberQT_HEADERS}
|
||||
${OsxGrabberHEADERS_MOC}
|
||||
${OsxGrabberSOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(osx-grabber
|
||||
hyperion
|
||||
${QT_LIBRARIES})
|
||||
# Define the current source locations
|
||||
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
|
||||
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/osx)
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
SET(OsxGrabberQT_HEADERS
|
||||
${CURRENT_HEADER_DIR}/OsxWrapper.h
|
||||
)
|
||||
|
||||
SET(OsxGrabberHEADERS
|
||||
${CURRENT_HEADER_DIR}/OsxFrameGrabber.h
|
||||
)
|
||||
|
||||
SET(OsxGrabberSOURCES
|
||||
${CURRENT_SOURCE_DIR}/OsxWrapper.cpp
|
||||
${CURRENT_SOURCE_DIR}/OsxFrameGrabber.cpp
|
||||
)
|
||||
|
||||
if(ENABLE_QT5)
|
||||
QT5_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
|
||||
else(ENABLE_QT5)
|
||||
QT4_WRAP_CPP(OsxGrabberHEADERS_MOC ${OsxGrabberQT_HEADERS})
|
||||
endif(ENABLE_QT5)
|
||||
|
||||
add_library(osx-grabber
|
||||
${OsxGrabberHEADERS}
|
||||
${OsxGrabberQT_HEADERS}
|
||||
${OsxGrabberHEADERS_MOC}
|
||||
${OsxGrabberSOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(osx-grabber
|
||||
hyperion
|
||||
${QT_LIBRARIES})
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <iostream>
|
||||
|
||||
// Local includes
|
||||
#include "OsxFrameGrabber.h"
|
||||
#include <grabber/OsxFrameGrabber.h>
|
||||
|
||||
OsxFrameGrabber::OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height) :
|
||||
_screenIndex(display),
|
||||
|
@@ -1,59 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// OSX includes
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
// Utils includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
#include <utils/VideoMode.h>
|
||||
#include <utils/ImageResampler.h>
|
||||
|
||||
///
|
||||
/// The OsxFrameGrabber is used for creating snapshots of the display (screenshots)
|
||||
///
|
||||
class OsxFrameGrabber
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Construct a OsxFrameGrabber that will capture snapshots with specified dimensions.
|
||||
///
|
||||
/// @param[in] display The index of the display to capture
|
||||
/// @param[in] width The width of the captured screenshot
|
||||
/// @param[in] height The heigth of the captured screenshot
|
||||
///
|
||||
OsxFrameGrabber(const unsigned display, const unsigned width, const unsigned height);
|
||||
~OsxFrameGrabber();
|
||||
|
||||
///
|
||||
/// 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<ColorRgb> & image);
|
||||
|
||||
private:
|
||||
/// display
|
||||
const unsigned _screenIndex;
|
||||
|
||||
/// With of the captured snapshot [pixels]
|
||||
const unsigned _width;
|
||||
|
||||
/// Height of the captured snapshot [pixels]
|
||||
const unsigned _height;
|
||||
|
||||
/// Reference to the captured diaplay
|
||||
CGDirectDisplayID _display;
|
||||
|
||||
/// Image resampler for downscaling the image
|
||||
ImageResampler * _imgResampler;
|
||||
};
|
@@ -5,12 +5,12 @@
|
||||
|
||||
// Osx grabber includes
|
||||
#include <grabber/OsxWrapper.h>
|
||||
#include "OsxFrameGrabber.h"
|
||||
#include <grabber/OsxFrameGrabber.h>
|
||||
|
||||
OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, Hyperion * hyperion) :
|
||||
OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const unsigned grabHeight, const unsigned updateRate_Hz, const int priority, Hyperion * hyperion) :
|
||||
_updateInterval_ms(1000/updateRate_Hz),
|
||||
_timeout_ms(2 * _updateInterval_ms),
|
||||
_priority(1000),
|
||||
_priority(priority),
|
||||
_timer(),
|
||||
_image(grabWidth, grabHeight),
|
||||
_frameGrabber(new OsxFrameGrabber(display, grabWidth, grabHeight)),
|
||||
|
Reference in New Issue
Block a user