mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
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:
@@ -3,67 +3,19 @@
|
||||
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/utils)
|
||||
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/utils)
|
||||
|
||||
SET(Utils_HEADERS
|
||||
${CURRENT_HEADER_DIR}/ColorBgr.h
|
||||
${CURRENT_HEADER_DIR}/ColorRgb.h
|
||||
${CURRENT_HEADER_DIR}/ColorRgba.h
|
||||
${CURRENT_HEADER_DIR}/ColorRgbw.h
|
||||
${CURRENT_HEADER_DIR}/Image.h
|
||||
${CURRENT_HEADER_DIR}/Sleep.h
|
||||
${CURRENT_HEADER_DIR}/FileUtils.h
|
||||
${CURRENT_HEADER_DIR}/Process.h
|
||||
${CURRENT_HEADER_DIR}/PixelFormat.h
|
||||
${CURRENT_HEADER_DIR}/VideoMode.h
|
||||
${CURRENT_HEADER_DIR}/ImageResampler.h
|
||||
${CURRENT_HEADER_DIR}/RgbTransform.h
|
||||
${CURRENT_HEADER_DIR}/ColorSys.h
|
||||
${CURRENT_HEADER_DIR}/RgbChannelAdjustment.h
|
||||
${CURRENT_HEADER_DIR}/RgbToRgbw.h
|
||||
${CURRENT_HEADER_DIR}/jsonschema/QJsonFactory.h
|
||||
${CURRENT_HEADER_DIR}/jsonschema/QJsonSchemaChecker.h
|
||||
${CURRENT_HEADER_DIR}/jsonschema/QJsonUtils.h
|
||||
${CURRENT_HEADER_DIR}/global_defines.h
|
||||
${CURRENT_HEADER_DIR}/SysInfo.h
|
||||
${CURRENT_HEADER_DIR}/Logger.h
|
||||
${CURRENT_HEADER_DIR}/Stats.h
|
||||
${CURRENT_HEADER_DIR}/JsonProcessor.h
|
||||
)
|
||||
FILE ( GLOB_RECURSE Utils_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
|
||||
|
||||
SET(Utils_SOURCES
|
||||
${CURRENT_SOURCE_DIR}/ColorArgb.cpp
|
||||
${CURRENT_SOURCE_DIR}/ColorBgr.cpp
|
||||
${CURRENT_SOURCE_DIR}/ColorRgb.cpp
|
||||
${CURRENT_SOURCE_DIR}/ColorRgba.cpp
|
||||
${CURRENT_SOURCE_DIR}/ColorRgbw.cpp
|
||||
${CURRENT_SOURCE_DIR}/FileUtils.cpp
|
||||
${CURRENT_SOURCE_DIR}/Process.cpp
|
||||
${CURRENT_SOURCE_DIR}/Logger.cpp
|
||||
${CURRENT_SOURCE_DIR}/ImageResampler.cpp
|
||||
${CURRENT_SOURCE_DIR}/ColorSys.cpp
|
||||
${CURRENT_SOURCE_DIR}/RgbChannelAdjustment.cpp
|
||||
${CURRENT_SOURCE_DIR}/RgbTransform.cpp
|
||||
${CURRENT_SOURCE_DIR}/RgbToRgbw.cpp
|
||||
${CURRENT_SOURCE_DIR}/SysInfo.cpp
|
||||
${CURRENT_SOURCE_DIR}/Stats.cpp
|
||||
${CURRENT_SOURCE_DIR}/JsonProcessor.cpp
|
||||
${CURRENT_SOURCE_DIR}/jsonschema/QJsonSchemaChecker.cpp
|
||||
)
|
||||
|
||||
if ( ENABLE_PROFILER )
|
||||
SET ( PROFILER_SOURCE ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp )
|
||||
if ( NOT ENABLE_PROFILER )
|
||||
LIST ( REMOVE_ITEM Utils_SOURCES ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp )
|
||||
endif()
|
||||
|
||||
set(Utils_RESOURCES
|
||||
${CURRENT_SOURCE_DIR}/JSONRPC_schemas.qrc
|
||||
)
|
||||
set(Utils_RESOURCES ${CURRENT_SOURCE_DIR}/JSONRPC_schemas.qrc )
|
||||
|
||||
qt5_add_resources(Utils_RESOURCES_RCC ${Utils_RESOURCES} OPTIONS "-no-compress")
|
||||
|
||||
|
||||
add_library(hyperion-utils
|
||||
${Utils_HEADERS}
|
||||
${Utils_SOURCES}
|
||||
${PROFILER_SOURCE}
|
||||
${Utils_RESOURCES}
|
||||
${Utils_RESOURCES_RCC}
|
||||
)
|
||||
|
19
libsrc/utils/JSONRPC_schema/schema-videomode.json
Normal file
19
libsrc/utils/JSONRPC_schema/schema-videomode.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"type":"object",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"command": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["videomode"]
|
||||
},
|
||||
"tan" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"mappingType": {
|
||||
"type" : "string",
|
||||
"enum" : ["2D", "3DSBS", "3DTAB"]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
"command": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo"]
|
||||
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,5 +17,6 @@
|
||||
<file alias="schema-ledcolors">JSONRPC_schema/schema-ledcolors.json</file>
|
||||
<file alias="schema-logging">JSONRPC_schema/schema-logging.json</file>
|
||||
<file alias="schema-processing">JSONRPC_schema/schema-processing.json</file>
|
||||
<file alias="schema-videomode">JSONRPC_schema/schema-videomode.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -136,6 +136,7 @@ void JsonProcessor::handleMessage(const QString& messageString, const QString pe
|
||||
else if (command == "ledcolors") handleLedColorsCommand (message, command, tan);
|
||||
else if (command == "logging") handleLoggingCommand (message, command, tan);
|
||||
else if (command == "processing") handleProcessingCommand (message, command, tan);
|
||||
else if (command == "videomode") handleVideoModeCommand (message, command, tan);
|
||||
else handleNotImplemented ();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
@@ -583,7 +584,7 @@ void JsonProcessor::handleServerInfoCommand(const QJsonObject&, const QString& c
|
||||
|
||||
// get available led devices
|
||||
QJsonObject ledDevices;
|
||||
ledDevices["active"] =LedDevice::activeDevice();
|
||||
ledDevices["active"] = LedDevice::activeDevice();
|
||||
QJsonArray availableLedDevices;
|
||||
for (auto dev: LedDevice::getDeviceMap())
|
||||
{
|
||||
@@ -593,21 +594,19 @@ void JsonProcessor::handleServerInfoCommand(const QJsonObject&, const QString& c
|
||||
ledDevices["available"] = availableLedDevices;
|
||||
info["ledDevices"] = ledDevices;
|
||||
|
||||
QJsonObject grabbers;
|
||||
QJsonArray availableGrabbers;
|
||||
#if defined(ENABLE_DISPMANX) || defined(ENABLE_V4L2) || defined(ENABLE_FB) || defined(ENABLE_AMLOGIC) || defined(ENABLE_OSX) || defined(ENABLE_X11)
|
||||
// get available grabbers
|
||||
QJsonObject grabbers;
|
||||
//grabbers["active"] = ????;
|
||||
QJsonArray availableGrabbers;
|
||||
for (auto grabber: GrabberWrapper::availableGrabbers())
|
||||
{
|
||||
availableGrabbers.append(grabber);
|
||||
}
|
||||
|
||||
grabbers["available"] = availableGrabbers;
|
||||
info["grabbers"] = grabbers;
|
||||
#else
|
||||
info["grabbers"] = QString("none");
|
||||
#endif
|
||||
grabbers["available"] = availableGrabbers;
|
||||
grabbers["videomode"] = QString(videoMode2String(_hyperion->getCurrentVideoMode()));
|
||||
info["grabbers"] = grabbers;
|
||||
|
||||
// get available components
|
||||
QJsonArray component;
|
||||
@@ -1036,6 +1035,13 @@ void JsonProcessor::handleProcessingCommand(const QJsonObject& message, const QS
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonProcessor::handleVideoModeCommand(const QJsonObject& message, const QString &command, const int tan)
|
||||
{
|
||||
_hyperion->setVideoMode(parse3DMode(message["videoMode"].toString("2D")));
|
||||
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonProcessor::handleNotImplemented()
|
||||
{
|
||||
sendErrorReply("Command not implemented");
|
||||
|
Reference in New Issue
Block a user