Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.5.0)

message( STATUS "CMake Version: ${CMAKE_VERSION}" )

Expand Down Expand Up @@ -38,26 +38,24 @@ if ( CCACHE_FOUND )
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)

# enable C++14; MSVC doesn't have c++14 feature switch
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(APPLE)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("Werror=unguarded-availability" REQUIRED_UNGUARDED_AVAILABILITY)
if(REQUIRED_UNGUARDED_AVAILABILITY)
list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "Werror=unguarded-availability")
endif()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi")
# enable C++17
if(APPLE)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("Werror=unguarded-availability" REQUIRED_UNGUARDED_AVAILABILITY)
if(REQUIRED_UNGUARDED_AVAILABILITY)
list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "Werror=unguarded-availability")
endif()
endif()

set(CMAKE_CXX_STANDARD 14)
set(CXX_STANDARD_REQUIRED ON)
set(CXX_EXTENSIONS OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi")
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Set build variables
# Grabber
SET ( DEFAULT_AMLOGIC OFF )
Expand Down
6 changes: 3 additions & 3 deletions assets/webconfig/js/content_grabber.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ $(document).ready(function () {
var saveOptions = conf_editor_screen.getValue();

var instCaptOptions = window.serverConfig.instCapture;
instCaptOptions.systemEnable = true;
instCaptOptions.systemEnable = saveOptions.framegrabber.enable;
saveOptions.instCapture = instCaptOptions;

requestWriteConfig(saveOptions);
Expand Down Expand Up @@ -679,7 +679,7 @@ $(document).ready(function () {
var saveOptions = conf_editor_video.getValue();

var instCaptOptions = window.serverConfig.instCapture;
instCaptOptions.v4lEnable = true;
instCaptOptions.v4lEnable = saveOptions.grabberV4L2.enable;
saveOptions.instCapture = instCaptOptions;

requestWriteConfig(saveOptions);
Expand Down Expand Up @@ -805,7 +805,7 @@ $(document).ready(function () {
const saveOptions = conf_editor_audio.getValue();

const instCaptOptions = window.serverConfig.instCapture;
instCaptOptions.audioEnable = true;
instCaptOptions.audioEnable = saveOptions.grabberAudio.enable;
saveOptions.instCapture = instCaptOptions;

requestWriteConfig(saveOptions);
Expand Down
1 change: 1 addition & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ macro(DeployMacOS TARGET)
foreach(PLUGIN "platforms" "sqldrivers" "imageformats")
if(EXISTS ${PLUGIN_DIR}/${PLUGIN})
file(GLOB files "${PLUGIN_DIR}/${PLUGIN}/*")
list(FILTER files EXCLUDE REGEX ".*libqwebp\\.dylib$")
foreach(file ${files})
file(GET_RUNTIME_DEPENDENCIES
EXECUTABLES ${file}
Expand Down
2 changes: 1 addition & 1 deletion dependencies/CMakeLists-qmdnsengine.txt.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.5)

project(qmdnsengine)

Expand Down
8 changes: 4 additions & 4 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ endif()

if(ENABLE_PROTOBUF_SERVER)
set(USE_SYSTEM_PROTO_LIBS ${DEFAULT_USE_SYSTEM_PROTO_LIBS} CACHE BOOL "use protobuf library from system")

# defines for 3rd party sub-modules
set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Build abseil-cpp with C++ version requirements propagated")

if (USE_SYSTEM_PROTO_LIBS)
find_package(Protobuf REQUIRED)
Expand Down Expand Up @@ -161,9 +164,6 @@ if(ENABLE_PROTOBUF_SERVER)
# define the protobuf library
set(PROTOBUF_LIBRARIES protobuf::libprotobuf)

# defines for 3rd party sub-modules
set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Build abseil-cpp with C++ version requirements propagated")

endif()

# redefine at parent scope
Expand Down Expand Up @@ -270,7 +270,7 @@ if(ENABLE_DEV_NETWORK)
set(USE_SYSTEM_MBEDTLS_LIBS OFF)
endif (NOT MBEDTLS_FOUND)
else()
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.5.1)

set(CMAKE_POLICY_DEFAULT_CMP0071 NEW)

Expand Down
5 changes: 5 additions & 0 deletions include/api/JsonAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ private slots:
///
void handleInstanceStateChange(InstanceState state, quint8 instance, const QString &name = QString());

///
/// @brief Stream a new LED Colors update
///
void streamLedColorsUpdate();

signals:
///
/// Signal emits with the reply message provided with handleMessage()
Expand Down
14 changes: 7 additions & 7 deletions include/grabber/AudioGrabberWindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class AudioGrabberWindows : public AudioGrabber
HANDLE notificationEvent;
std::atomic<bool> isRunning{ false };

static BOOL CALLBACK DirectSoundEnumProcessor(LPGUID deviceIdGuid, LPCTSTR deviceDescStr,
LPCTSTR deviceModelStr, LPVOID context)
static BOOL CALLBACK DirectSoundEnumProcessor(LPGUID deviceIdGuid, LPCWSTR deviceDescStr,
LPCWSTR deviceModelStr, LPVOID context)
{
// Skip undefined audio devices
if (deviceIdGuid == NULL)
Expand All @@ -50,23 +50,23 @@ static BOOL CALLBACK DirectSoundEnumProcessor(LPGUID deviceIdGuid, LPCTSTR devic

AudioGrabber::DeviceProperties device;

// Process Device Information
QString deviceName = QString::fromWCharArray(deviceDescStr);

// Process Device ID
LPOLESTR deviceIdStr;
HRESULT res = StringFromCLSID(*deviceIdGuid, &deviceIdStr);
if (FAILED(res))
{
Error(Logger::getInstance("AUDIOGRABBER"), "Failed to get CLSID-string for %s with error: 0x%08x: %s", deviceDescStr, res, std::system_category().message(res).c_str());
Error(Logger::getInstance("AUDIOGRABBER"), "Failed to get CLSID-string for %s with error: 0x%08x: %s", QSTRING_CSTR(deviceName), res, std::system_category().message(res).c_str());
return FALSE;
}

QString deviceId = QString::fromWCharArray(deviceIdStr);

CoTaskMemFree(deviceIdStr);

// Process Device Information
QString deviceName = QString::fromLocal8Bit(deviceDescStr);

Debug(Logger::getInstance("AUDIOGRABBER"), "Found Audio Device: %s", deviceDescStr);
Debug(Logger::getInstance("AUDIOGRABBER"), "Found Audio Device: %s", QSTRING_CSTR(deviceName));

device.id = deviceId;
device.name = deviceName;
Expand Down
10 changes: 7 additions & 3 deletions include/hyperion/ImageToLedsMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,13 @@ namespace hyperion
}

// Compute the average of each color channel
const uint8_t avgRed = uint8_t(std::min(std::lround(sqrt(static_cast<double>(cummRed/pixelNum))), 255L));
const uint8_t avgGreen = uint8_t(std::min(std::lround(sqrt(static_cast<double>(cummGreen/pixelNum))), 255L));
const uint8_t avgBlue = uint8_t(std::min(std::lround(sqrt(static_cast<double>(cummBlue/pixelNum))), 255L));

#ifdef WIN32
#undef min
#endif
const uint8_t avgRed = static_cast<uint8_t>(std::min(std::lround(std::sqrt(static_cast<double>(cummRed / pixelNum))), 255L));
const uint8_t avgGreen = static_cast<uint8_t>(std::min(std::lround(sqrt(static_cast<double>(cummGreen / pixelNum))), 255L));
const uint8_t avgBlue = static_cast<uint8_t>(std::min(std::lround(sqrt(static_cast<double>(cummBlue / pixelNum))), 255L));

// Return the computed color
return {avgRed, avgGreen, avgBlue};
Expand Down
2 changes: 1 addition & 1 deletion include/utils/global_defines.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#define QSTRING_CSTR(str) str.toLocal8Bit().constData()
#define QSTRING_CSTR(str) str.toUtf8().constData()
typedef QList< int > QIntList;


41 changes: 24 additions & 17 deletions libsrc/api/JsonAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ void JsonAPI::initialize()
connect(this, &JsonAPI::toggleSuspendAll, _instanceManager, &HyperionIManager::triggerToggleSuspend);
connect(this, &JsonAPI::idleAll, _instanceManager, &HyperionIManager::triggerIdle);
connect(this, &JsonAPI::toggleIdleAll, _instanceManager, &HyperionIManager::triggerToggleIdle);

connect(_ledStreamTimer, &QTimer::timeout, this, &JsonAPI::streamLedColorsUpdate, Qt::UniqueConnection);
}

bool JsonAPI::handleInstanceSwitch(quint8 inst, bool forced)
Expand Down Expand Up @@ -404,7 +406,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
activePriorities.removeAll(PriorityMuxer::LOWEST_PRIORITY);
int currentPriority = _hyperion->getCurrentPriority();

for(int priority : qAsConst(activePriorities))
for(int priority : std::as_const(activePriorities))
{
const Hyperion::InputInfo &priorityInfo = _hyperion->getPriorityInfo(priority);

Expand Down Expand Up @@ -1139,6 +1141,11 @@ void JsonAPI::handleComponentStateCommand(const QJsonObject &message, const QStr
sendSuccessReply(command, tan);
}

void JsonAPI::streamLedColorsUpdate()
{
emit streamLedcolorsUpdate(_currentLedValues);
}

void JsonAPI::handleLedColorsCommand(const QJsonObject &message, const QString &command, int tan)
{
// create result
Expand All @@ -1154,21 +1161,21 @@ void JsonAPI::handleLedColorsCommand(const QJsonObject &message, const QString &
_streaming_leds_reply["tan"] = tan;

connect(_hyperion, &Hyperion::rawLedColors, this, [=](const std::vector<ColorRgb> &ledValues) {
_currentLedValues = ledValues;

// necessary because Qt::UniqueConnection for lambdas does not work until 5.9
// see: https://bugreports.qt.io/browse/QTBUG-52438
if (!_ledStreamConnection)
_ledStreamConnection = connect(_ledStreamTimer, &QTimer::timeout, this, [=]() {
emit streamLedcolorsUpdate(_currentLedValues);
},
Qt::UniqueConnection);

// start the timer
if (!_ledStreamTimer->isActive() || _ledStreamTimer->interval() != streaming_interval)
_ledStreamTimer->start(streaming_interval);
},
Qt::UniqueConnection);

if (ledValues != _currentLedValues)
{
_currentLedValues = ledValues;
if (!_ledStreamTimer->isActive() || _ledStreamTimer->interval() != streaming_interval)
{
_ledStreamTimer->start(streaming_interval);
}
}
else
{
_ledStreamTimer->stop();
}
});

// push once
_hyperion->update();
}
Expand Down Expand Up @@ -1387,7 +1394,7 @@ void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString &
if (API::getPendingTokenRequests(vec))
{
QJsonArray arr;
for (const auto &entry : qAsConst(vec))
for (const auto &entry : std::as_const(vec))
{
QJsonObject obj;
obj["comment"] = entry.comment;
Expand Down
2 changes: 1 addition & 1 deletion libsrc/api/JsonCB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void JsonCB::handlePriorityUpdate(int currentPriority, const PriorityMuxer::Inpu

activePriorities.removeAll(PriorityMuxer::LOWEST_PRIORITY);

for (int priority : qAsConst(activePriorities)) {
for (int priority : std::as_const(activePriorities)) {

const Hyperion::InputInfo& priorityInfo = activeInputs[priority];

Expand Down
11 changes: 6 additions & 5 deletions libsrc/db/DBManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <QThreadStorage>
#include <QUuid>
#include <QDir>
#include <QMetaType>

#ifdef _WIN32
#include <stdexcept>
Expand Down Expand Up @@ -425,15 +426,15 @@ void DBManager::doAddBindValue(QSqlQuery& query, const QVariantList& variants) c
auto t = variant.userType();
switch(t)
{
case QVariant::UInt:
case QVariant::Int:
case QVariant::Bool:
case QMetaType::UInt:
case QMetaType::Int:
case QMetaType::Bool:
query.addBindValue(variant.toInt());
break;
case QVariant::Double:
case QMetaType::Double:
query.addBindValue(variant.toFloat());
break;
case QVariant::ByteArray:
case QMetaType::QByteArray:
query.addBindValue(variant.toByteArray());
break;
default:
Expand Down
12 changes: 6 additions & 6 deletions libsrc/effectengine/EffectFileHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void EffectFileHandler::updateEffects()
}

QMap<QString, EffectDefinition> availableEffects;
for (const QString& path : qAsConst(efxPathList))
for (const QString& path : std::as_const(efxPathList))
{
QDir directory(path);
if (!directory.exists())
Expand All @@ -241,8 +241,8 @@ void EffectFileHandler::updateEffects()
else
{
int efxCount = 0;
QStringList filenames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
for (const QString& filename : qAsConst(filenames))
const QStringList filenames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
for (const QString& filename : filenames)
{
EffectDefinition def;
if (loadEffectDefinition(path, filename, def))
Expand All @@ -268,8 +268,8 @@ void EffectFileHandler::updateEffects()

QString schemaPath = path + "schema" + '/';
directory.setPath(schemaPath);
QStringList schemaFileNames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
for (const QString& schemaFileName : qAsConst(schemaFileNames))
const QStringList schemaFileNames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
for (const QString& schemaFileName : schemaFileNames)
{
EffectSchema pyEffect;
if (loadEffectSchema(path, directory.filePath(schemaFileName), pyEffect))
Expand All @@ -282,7 +282,7 @@ void EffectFileHandler::updateEffects()
}
}

for (const auto& item : qAsConst(availableEffects))
for (const auto& item : std::as_const(availableEffects))
{
_availableEffects.push_back(item);
}
Expand Down
10 changes: 5 additions & 5 deletions libsrc/forwarder/MessageForwarder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ int MessageForwarder::startJsonTargets(const QJsonObject& config)

if (!_jsonTargets.isEmpty())
{
for (const auto& targetHost : qAsConst(_jsonTargets))
for (const auto& targetHost : std::as_const(_jsonTargets))
{
Info(_log, "Forwarding now to JSON-target host: %s port: %u", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
}
Expand All @@ -286,7 +286,7 @@ void MessageForwarder::stopJsonTargets()
if (!_jsonTargets.isEmpty())
{
disconnect(_hyperion, &Hyperion::forwardJsonMessage, nullptr, nullptr);
for (const auto& targetHost : qAsConst(_jsonTargets))
for (const auto& targetHost : std::as_const(_jsonTargets))
{
Info(_log, "Stopped forwarding to JSON-target host: %s port: %u", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
}
Expand Down Expand Up @@ -373,7 +373,7 @@ int MessageForwarder::startFlatbufferTargets(const QJsonObject& config)

if (!_flatbufferTargets.isEmpty())
{
for (const auto& targetHost : qAsConst(_flatbufferTargets))
for (const auto& targetHost : std::as_const(_flatbufferTargets))
{
Info(_log, "Forwarding now to Flatbuffer-target host: %s port: %u", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
}
Expand All @@ -399,7 +399,7 @@ void MessageForwarder::stopFlatbufferTargets()
_messageForwarderFlatBufHelper = nullptr;
}

for (const auto& targetHost : qAsConst(_flatbufferTargets))
for (const auto& targetHost : std::as_const(_flatbufferTargets))
{
Info(_log, "Stopped forwarding to Flatbuffer-target host: %s port: %u", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
}
Expand All @@ -412,7 +412,7 @@ void MessageForwarder::forwardJsonMessage(const QJsonObject& message)
if (_forwarder_enabled)
{
QTcpSocket client;
for (const auto& targetHost : qAsConst(_jsonTargets))
for (const auto& targetHost : std::as_const(_jsonTargets))
{
client.connectToHost(targetHost.host, targetHost.port);
if (client.waitForConnected(CONNECT_TIMEOUT.count()))
Expand Down
Loading