Refactor/Create APT/DNF Repository (#1648)

This commit is contained in:
Paulchen-Panther
2023-11-16 21:05:56 +01:00
committed by GitHub
parent c9518db597
commit 91270966f9
165 changed files with 1918 additions and 2924 deletions

View File

@@ -1,7 +1,7 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc)
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc)
add_subdirectory(hyperion)
add_subdirectory(commandline)
@@ -34,7 +34,7 @@ add_subdirectory(ssdp)
if(ENABLE_MDNS)
add_subdirectory(mdns)
endif()
endif()
if(ENABLE_EFFECTENGINE)
add_subdirectory(effectengine)

View File

@@ -1,26 +1,20 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/api)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/api)
FILE ( GLOB_RECURSE Api_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
set(Api_RESOURCES ${CURRENT_SOURCE_DIR}/JSONRPC_schemas.qrc )
add_library(hyperion-api
${Api_SOURCES}
${Api_RESOURCES}
${CMAKE_SOURCE_DIR}/include/api/apiStructs.h
${CMAKE_SOURCE_DIR}/include/api/API.h
${CMAKE_SOURCE_DIR}/include/api/JsonAPI.h
${CMAKE_SOURCE_DIR}/include/api/JsonCB.h
${CMAKE_SOURCE_DIR}/libsrc/api/JsonAPI.cpp
${CMAKE_SOURCE_DIR}/libsrc/api/API.cpp
${CMAKE_SOURCE_DIR}/libsrc/api/JsonCB.cpp
${CMAKE_SOURCE_DIR}/libsrc/api/JSONRPC_schemas.qrc
)
if(ENABLE_DX)
include_directories(${DIRECTX9_INCLUDE_DIRS})
target_link_libraries(hyperion-api ${DIRECTX9_LIBRARIES})
endif(ENABLE_DX)
target_link_libraries(hyperion-api
hyperion
hyperion-utils
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Network
${DIRECTX9_LIBRARIES}
)
target_include_directories(hyperion-api PRIVATE
${DIRECTX9_INCLUDE_DIRS}
)

View File

@@ -19,54 +19,54 @@
#include <HyperionConfig.h> // Required to determine the cmake options
#include <hyperion/GrabberWrapper.h>
#include <grabber/QtGrabber.h>
#include <grabber/qt/QtGrabber.h>
#include <utils/WeakConnect.h>
#if defined(ENABLE_MF)
#include <grabber/MFGrabber.h>
#include <grabber/video/mediafoundation/MFGrabber.h>
#elif defined(ENABLE_V4L2)
#include <grabber/V4L2Grabber.h>
#include <grabber/video/v4l2/V4L2Grabber.h>
#endif
#if defined(ENABLE_AUDIO)
#include <grabber/AudioGrabber.h>
#include <grabber/audio/AudioGrabber.h>
#ifdef WIN32
#include <grabber/AudioGrabberWindows.h>
#include <grabber/audio/AudioGrabberWindows.h>
#endif
#ifdef __linux__
#include <grabber/AudioGrabberLinux.h>
#include <grabber/audio/AudioGrabberLinux.h>
#endif
#endif
#if defined(ENABLE_X11)
#include <grabber/X11Grabber.h>
#include <grabber/x11/X11Grabber.h>
#endif
#if defined(ENABLE_XCB)
#include <grabber/XcbGrabber.h>
#include <grabber/xcb/XcbGrabber.h>
#endif
#if defined(ENABLE_DX)
#include <grabber/DirectXGrabber.h>
#include <grabber/directx/DirectXGrabber.h>
#endif
#if defined(ENABLE_FB)
#include <grabber/FramebufferFrameGrabber.h>
#include <grabber/framebuffer/FramebufferFrameGrabber.h>
#endif
#if defined(ENABLE_DISPMANX)
#include <grabber/DispmanxFrameGrabber.h>
#include <grabber/dispmanx/DispmanxFrameGrabber.h>
#endif
#if defined(ENABLE_AMLOGIC)
#include <grabber/AmlogicGrabber.h>
#include <grabber/amlogic/AmlogicGrabber.h>
#endif
#if defined(ENABLE_OSX)
#include <grabber/OsxFrameGrabber.h>
#include <grabber/osx/OsxFrameGrabber.h>
#endif
#include <utils/jsonschema/QJsonFactory.h>

View File

@@ -1,11 +1,9 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/blackborder)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/blackborder)
FILE ( GLOB Blackborder_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(blackborder ${Blackborder_SOURCES} )
add_library(blackborder
${CMAKE_SOURCE_DIR}/include/blackborder/BlackBorderDetector.h
${CMAKE_SOURCE_DIR}/include/blackborder/BlackBorderProcessor.h
${CMAKE_SOURCE_DIR}/libsrc/blackborder/BlackBorderDetector.cpp
${CMAKE_SOURCE_DIR}/libsrc/blackborder/BlackBorderProcessor.cpp
)
target_link_libraries(blackborder
hyperion-utils

View File

@@ -1,14 +1,11 @@
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/boblightserver)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/boblightserver)
FILE ( GLOB BoblightServer_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(boblightserver ${BoblightServer_SOURCES} )
add_library(boblightserver
${CMAKE_SOURCE_DIR}/include/boblightserver/BoblightServer.h
${CMAKE_SOURCE_DIR}/libsrc/boblightserver/BoblightServer.cpp
${CMAKE_SOURCE_DIR}/libsrc/boblightserver/BoblightClientConnection.h
${CMAKE_SOURCE_DIR}/libsrc/boblightserver/BoblightClientConnection.cpp
)
target_link_libraries(boblightserver
hyperion
hyperion-utils
${QT_LIBRARIES}
)

View File

@@ -1,19 +1,18 @@
# Define the current source locations
find_package(CEC REQUIRED)
if(CEC_FOUND)
list(GET CEC_LIBRARIES 0 CEC_LIBRARIES)
add_definitions(-DCEC_LIBRARY="${CEC_LIBRARIES}")
else()
message(FATAL_ERROR "libCEC not found")
endif()
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/cec)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/cec)
FILE (GLOB CEC_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp")
add_library(cechandler ${CEC_SOURCES})
list(GET CEC_LIBRARIES 0 CEC_LIBRARIES)
add_definitions(-DCEC_LIBRARY="${CEC_LIBRARIES}")
include_directories(${CEC_INCLUDE_DIRS})
add_library(cechandler
${CMAKE_SOURCE_DIR}/include/cec/CECEvent.h
${CMAKE_SOURCE_DIR}/include/cec/CECHandler.h
${CMAKE_SOURCE_DIR}/libsrc/cec/CECHandler.cpp
)
target_link_libraries(cechandler
Qt${QT_VERSION_MAJOR}::Core
${CMAKE_DL_LIBS}
)

View File

@@ -1,10 +1,27 @@
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/commandline)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/commandline)
FILE ( GLOB Parser_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(commandline ${Parser_SOURCES} )
add_library(commandline
${CMAKE_SOURCE_DIR}/include/commandline/BooleanOption.h
${CMAKE_SOURCE_DIR}/include/commandline/ColorOption.h
${CMAKE_SOURCE_DIR}/include/commandline/ColorsOption.h
${CMAKE_SOURCE_DIR}/include/commandline/DoubleOption.h
${CMAKE_SOURCE_DIR}/include/commandline/ImageOption.h
${CMAKE_SOURCE_DIR}/include/commandline/IntOption.h
${CMAKE_SOURCE_DIR}/include/commandline/Option.h
${CMAKE_SOURCE_DIR}/include/commandline/Parser.h
${CMAKE_SOURCE_DIR}/include/commandline/RegularExpressionOption.h
${CMAKE_SOURCE_DIR}/include/commandline/SwitchOption.h
${CMAKE_SOURCE_DIR}/include/commandline/ValidatorOption.h
${CMAKE_SOURCE_DIR}/libsrc/commandline/BooleanOption.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/ColorOption.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/ColorsOption.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/DoubleOption.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/ImageOption.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/IntOption.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/Option.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/Parser.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/RegularExpressionOption.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/SwitchOption.cpp
${CMAKE_SOURCE_DIR}/libsrc/commandline/ValidatorOption.cpp
)
target_link_libraries(commandline
hyperion

View File

@@ -1,16 +1,14 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/db)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/db)
FILE ( GLOB DB_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(database
${DB_SOURCES}
${CMAKE_SOURCE_DIR}/include/db/AuthTable.h
${CMAKE_SOURCE_DIR}/include/db/DBManager.h
${CMAKE_SOURCE_DIR}/include/db/InstanceTable.h
${CMAKE_SOURCE_DIR}/include/db/MetaTable.h
${CMAKE_SOURCE_DIR}/include/db/SettingsTable.h
${CMAKE_SOURCE_DIR}/libsrc/db/DBManager.cpp
)
target_link_libraries(database
hyperion
hyperion-utils
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Sql
)

View File

@@ -1,47 +1,30 @@
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
else()
find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake
endif()
file(GLOB effectFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/effects/*)
set(HYPERION_EFFECTS_RES "")
foreach(f ${effectFiles})
get_filename_component(fname ${f} NAME)
set(HYPERION_EFFECTS_RES "${HYPERION_EFFECTS_RES}\n\t\t<file alias=\"/effects/${fname}\">${f}</file>")
endforeach()
# Include the python directory. Also include the parent (which is for example /usr/include)
# which may be required when it is not includes by the (cross-) compiler by default.
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..)
else()
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
endif()
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/effectengine)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/effectengine)
FILE ( GLOB EffectEngineSOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
FILE ( GLOB effectFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/effects/* )
SET ( HYPERION_EFFECTS_RES "")
FOREACH( f ${effectFiles} )
GET_FILENAME_COMPONENT(fname ${f} NAME)
SET(HYPERION_EFFECTS_RES "${HYPERION_EFFECTS_RES}\n\t\t<file alias=\"/effects/${fname}\">${f}</file>")
ENDFOREACH()
CONFIGURE_FILE(${CURRENT_SOURCE_DIR}/EffectEngine.qrc.in ${CMAKE_BINARY_DIR}/EffectEngine.qrc )
SET(EffectEngine_RESOURCES ${CMAKE_BINARY_DIR}/EffectEngine.qrc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/EffectEngine.qrc.in ${CMAKE_BINARY_DIR}/EffectEngine.qrc)
add_library(effectengine
${EffectEngine_RESOURCES}
${EffectEngineSOURCES}
${CMAKE_BINARY_DIR}/EffectEngine.qrc
${CMAKE_SOURCE_DIR}/include/effectengine/ActiveEffectDefinition.h
${CMAKE_SOURCE_DIR}/include/effectengine/Effect.h
${CMAKE_SOURCE_DIR}/include/effectengine/EffectDefinition.h
${CMAKE_SOURCE_DIR}/include/effectengine/EffectEngine.h
${CMAKE_SOURCE_DIR}/include/effectengine/EffectFileHandler.h
${CMAKE_SOURCE_DIR}/include/effectengine/EffectModule.h
${CMAKE_SOURCE_DIR}/include/effectengine/EffectSchema.h
${CMAKE_SOURCE_DIR}/libsrc/effectengine/Effect.cpp
${CMAKE_SOURCE_DIR}/libsrc/effectengine/EffectEngine.cpp
${CMAKE_SOURCE_DIR}/libsrc/effectengine/EffectFileHandler.cpp
${CMAKE_SOURCE_DIR}/libsrc/effectengine/EffectModule.cpp
)
target_link_libraries(effectengine
hyperion
python
hyperion
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
)
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
target_link_libraries( effectengine ${Python3_LIBRARIES} )
else()
target_link_libraries( effectengine ${PYTHON_LIBRARIES} )
endif()

View File

@@ -1,6 +1,6 @@
<RCC>
<qresource prefix="/">
<file alias="effect-schema">${CURRENT_SOURCE_DIR}/EffectDefinition.schema.json</file>
<file alias="effect-schema">${CMAKE_CURRENT_SOURCE_DIR}/EffectDefinition.schema.json</file>
${HYPERION_EFFECTS_RES}
</qresource>
</RCC>

View File

@@ -1,69 +1,54 @@
# set (compiled) Flatbuffer schema names
set(FBS_Request "hyperion_request")
set(FBS_Reply "hyperion_reply")
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/flatbufserver)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/flatbufserver)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${FLATBUFFERS_INCLUDE_DIRS}
)
set(Flatbuffer_GENERATED_FBS
hyperion_reply_generated.h
hyperion_request_generated.h
)
set(Flatbuffer_FBS
${CURRENT_SOURCE_DIR}/hyperion_reply.fbs
${CURRENT_SOURCE_DIR}/hyperion_request.fbs
)
FOREACH(FBS_FILE ${Flatbuffer_FBS})
compile_flattbuffer_schema(${FBS_FILE} ${CMAKE_CURRENT_SOURCE_DIR})
ENDFOREACH(FBS_FILE)
# define and compile flatbuffer schemas
list(APPEND Compiled_FBS ${FBS_Request}_generated.h)
list(APPEND Compiled_FBS ${FBS_Reply}_generated.h)
compile_flattbuffer_schema(${CMAKE_CURRENT_SOURCE_DIR}/${FBS_Request}.fbs ${CMAKE_CURRENT_SOURCE_DIR})
compile_flattbuffer_schema(${CMAKE_CURRENT_SOURCE_DIR}/${FBS_Reply}.fbs ${CMAKE_CURRENT_SOURCE_DIR})
# let cmake know about new generated source files
set_source_files_properties(
${Flatbuffer_GENERATED_FBS} PROPERTIES GENERATED TRUE
)
### Split flatbufconnect from flatbufserver as flatbufserver relates to HyperionDaemon
set_source_files_properties(${Compiled_FBS} PROPERTIES GENERATED TRUE)
# split flatbufconnect from flatbufserver as flatbufserver relates to HyperionDaemon
if(ENABLE_FLATBUF_CONNECT)
add_library(flatbufconnect
${CURRENT_HEADER_DIR}/FlatBufferConnection.h
${CURRENT_SOURCE_DIR}/FlatBufferConnection.cpp
${FLATBUFSERVER_SOURCES}
${Flatbuffer_GENERATED_FBS}
add_library(flatbufconnect
${CMAKE_SOURCE_DIR}/include/flatbufserver/FlatBufferConnection.h
${CMAKE_SOURCE_DIR}/libsrc/flatbufserver/FlatBufferConnection.cpp
${Compiled_FBS}
)
)
target_link_libraries(flatbufconnect
hyperion-utils
flatbuffers
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Core
)
target_link_libraries(flatbufconnect
hyperion-utils
flatbuffers
)
target_include_directories(flatbufconnect PUBLIC
${FLATBUFFERS_INCLUDE_DIRS}
)
endif()
if(ENABLE_FLATBUF_SERVER)
add_library(flatbufserver
${CURRENT_HEADER_DIR}/FlatBufferServer.h
${CURRENT_SOURCE_DIR}/FlatBufferServer.cpp
${CURRENT_SOURCE_DIR}/FlatBufferClient.h
${CURRENT_SOURCE_DIR}/FlatBufferClient.cpp
${FLATBUFSERVER_SOURCES}
${Flatbuffer_GENERATED_FBS}
)
add_library(flatbufserver
${CMAKE_SOURCE_DIR}/include/flatbufserver/FlatBufferServer.h
${CMAKE_SOURCE_DIR}/libsrc/flatbufserver/FlatBufferServer.cpp
${CMAKE_SOURCE_DIR}/libsrc/flatbufserver/FlatBufferClient.h
${CMAKE_SOURCE_DIR}/libsrc/flatbufserver/FlatBufferClient.cpp
${Compiled_FBS}
)
target_link_libraries(flatbufserver
hyperion-utils
flatbuffers
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Core
)
if(ENABLE_MDNS)
target_link_libraries(flatbufserver mdns)
endif()
target_link_libraries(flatbufserver
hyperion-utils
flatbuffers
)
target_include_directories(flatbufserver PUBLIC
${FLATBUFFERS_INCLUDE_DIRS}
)
if(ENABLE_MDNS)
target_link_libraries(flatbufserver mdns)
endif()
endif()

View File

@@ -1,22 +1,11 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/forwarder)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/forwarder)
if(ENABLE_FLATBUF_CONNECT)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
add_library(forwarder
${CMAKE_SOURCE_DIR}/include/forwarder/MessageForwarder.h
${CMAKE_SOURCE_DIR}/libsrc/forwarder/MessageForwarder.cpp
)
endif()
FILE ( GLOB Forwarder_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(forwarder ${Forwarder_SOURCES} )
target_link_libraries(forwarder
hyperion
hyperion-utils
${QT_LIBRARIES}
)
if(ENABLE_FLATBUF_CONNECT)

View File

@@ -1,39 +1,39 @@
if (ENABLE_AMLOGIC)
if(ENABLE_AMLOGIC)
add_subdirectory(amlogic)
endif (ENABLE_AMLOGIC)
if (ENABLE_DISPMANX)
if(ENABLE_DISPMANX)
add_subdirectory(dispmanx)
endif (ENABLE_DISPMANX)
if (ENABLE_FB)
if(ENABLE_FB)
add_subdirectory(framebuffer)
endif (ENABLE_FB)
if (ENABLE_OSX)
if(ENABLE_OSX)
add_subdirectory(osx)
endif(ENABLE_OSX)
if (ENABLE_V4L2 OR ENABLE_MF)
if(ENABLE_V4L2 OR ENABLE_MF)
add_subdirectory(video)
endif ()
endif()
if (ENABLE_X11)
if(ENABLE_X11)
add_subdirectory(x11)
endif(ENABLE_X11)
if (ENABLE_XCB)
if(ENABLE_XCB)
add_subdirectory(xcb)
endif(ENABLE_XCB)
if (ENABLE_QT)
if(ENABLE_QT)
add_subdirectory(qt)
endif(ENABLE_QT)
if (ENABLE_DX)
if(ENABLE_DX)
add_subdirectory(directx)
endif(ENABLE_DX)
if (ENABLE_AUDIO)
if(ENABLE_AUDIO)
add_subdirectory(audio)
endif()

View File

@@ -20,7 +20,7 @@
// Local includes
#include <utils/Logger.h>
#include <grabber/AmlogicGrabber.h>
#include <grabber/amlogic/AmlogicGrabber.h>
#include "Amvideocap.h"
// Constants

View File

@@ -1,4 +1,4 @@
#include <grabber/AmlogicWrapper.h>
#include <grabber/amlogic/AmlogicWrapper.h>
AmlogicWrapper::AmlogicWrapper(int pixelDecimation, int updateRate_Hz)
: GrabberWrapper("Amlogic", &_grabber, updateRate_Hz)

View File

@@ -1,13 +1,15 @@
INCLUDE (CheckIncludeFiles)
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic)
FILE ( GLOB AmlogicSOURCES "${CURRENT_HEADER_DIR}/Amlogic*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(amlogic-grabber ${AmlogicSOURCES} )
add_library(amlogic-grabber
${CMAKE_SOURCE_DIR}/include/grabber/amlogic/AmlogicGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/amlogic/AmlogicWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/AmlogicGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/AmlogicWrapper.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/Amvideocap.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/ion.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/meson_ion.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/IonBuffer.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/amlogic/IonBuffer.cpp
)
target_link_libraries(amlogic-grabber
hyperion
${QT_LIBRARIES})
)

View File

@@ -1,4 +1,4 @@
#include <grabber/AudioGrabber.h>
#include <grabber/audio/AudioGrabber.h>
#include <math.h>
#include <QImage>
#include <QObject>

View File

@@ -1,11 +1,31 @@
#include <grabber/AudioGrabberLinux.h>
#include <grabber/audio/AudioGrabberLinux.h>
#include <alsa/asoundlib.h>
#include <QJsonObject>
#include <QJsonArray>
typedef void* (*THREADFUNCPTR)(void*);
static void * AudioThreadRunner(void* params)
{
AudioGrabberLinux* This = static_cast<AudioGrabberLinux*>(params);
Debug(This->getLog(), "Audio Thread Started");
snd_pcm_sframes_t framesAvailable = 0;
while (This->_isRunning.load(std::memory_order_acquire))
{
snd_pcm_wait(This->_captureDevice, 1000);
if ((framesAvailable = snd_pcm_avail(This->_captureDevice)) > 0)
This->processAudioBuffer(framesAvailable);
sched_yield();
}
Debug(This->getLog(), "Audio Thread Shutting Down");
return nullptr;
}
AudioGrabberLinux::AudioGrabberLinux()
: AudioGrabber()
@@ -121,7 +141,7 @@ bool AudioGrabberLinux::configureCaptureInterface()
snd_pcm_close(_captureDevice);
return false;
}
if ((error = snd_pcm_hw_params_set_access(_captureDevice, _captureDeviceConfig, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
{
Error(_log, "Failed to configure interleaved mode: %s", snd_strerror(error));
@@ -129,7 +149,7 @@ bool AudioGrabberLinux::configureCaptureInterface()
snd_pcm_close(_captureDevice);
return false;
}
if ((error = snd_pcm_hw_params_set_format(_captureDevice, _captureDeviceConfig, SND_PCM_FORMAT_S16_LE)) < 0)
{
Error(_log, "Failed to configure capture format: %s", snd_strerror(error));
@@ -169,7 +189,7 @@ bool AudioGrabberLinux::configureCaptureInterface()
snd_pcm_close(_captureDevice);
return false;
}
return true;
}
@@ -189,11 +209,6 @@ bool AudioGrabberLinux::start()
_isRunning.store(true, std::memory_order_release);
pthread_attr_t threadAttributes;
int threadPriority = 1;
sched_param schedulerParameter;
schedulerParameter.sched_priority = threadPriority;
if (pthread_attr_init(&threadAttributes) != 0)
{
Debug(_log, "Failed to create thread attributes");
@@ -201,7 +216,7 @@ bool AudioGrabberLinux::start()
return false;
}
if (pthread_create(&_audioThread, &threadAttributes, static_cast<THREADFUNCPTR>(&AudioThreadRunner), static_cast<void*>(this)) != 0)
if (pthread_create(&_audioThread, &threadAttributes, &AudioThreadRunner, static_cast<void*>(this)) != 0)
{
Debug(_log, "Failed to create audio capture thread");
stop();
@@ -239,7 +254,7 @@ void AudioGrabberLinux::processAudioBuffer(snd_pcm_sframes_t frames)
ssize_t bytes = snd_pcm_frames_to_bytes(_captureDevice, frames);
int16_t * buffer = static_cast<int16_t*>(calloc(static_cast<size_t>(bytes / 2), sizeof(int16_t)));
if (frames == 0)
{
buffer[0] = 0;
@@ -293,25 +308,3 @@ QString AudioGrabberLinux::getDeviceName(const QString& devicePath) const
return _deviceProperties.value(devicePath).name;
}
static void * AudioThreadRunner(void* params)
{
AudioGrabberLinux* This = static_cast<AudioGrabberLinux*>(params);
Debug(This->getLog(), "Audio Thread Started");
snd_pcm_sframes_t framesAvailable = 0;
while (This->_isRunning.load(std::memory_order_acquire))
{
snd_pcm_wait(This->_captureDevice, 1000);
if ((framesAvailable = snd_pcm_avail(This->_captureDevice)) > 0)
This->processAudioBuffer(framesAvailable);
sched_yield();
}
Debug(This->getLog(), "Audio Thread Shutting Down");
return nullptr;
}

View File

@@ -1,4 +1,4 @@
#include <grabber/AudioGrabberWindows.h>
#include <grabber/audio/AudioGrabberWindows.h>
#include <climits>
@@ -71,7 +71,7 @@ bool AudioGrabberWindows::configureCaptureInterface()
notificationSize -= notificationSize % audioFormat.nBlockAlign;
bufferCaptureSize = notificationSize * AUDIO_NOTIFICATION_COUNT;
DSCBUFFERDESC bufferDesc;
bufferDesc.dwSize = sizeof(DSCBUFFERDESC);
bufferDesc.dwFlags = 0;
@@ -80,7 +80,7 @@ bool AudioGrabberWindows::configureCaptureInterface()
bufferDesc.lpwfxFormat = &audioFormat;
bufferDesc.dwFXCount = 0;
bufferDesc.lpDSCFXDesc = NULL;
// Create Capture Device's Buffer
LPDIRECTSOUNDCAPTUREBUFFER preBuffer;
if (FAILED(recordingDevice->CreateCaptureBuffer(&bufferDesc, &preBuffer, NULL)))
@@ -101,7 +101,7 @@ bool AudioGrabberWindows::configureCaptureInterface()
}
preBuffer->Release();
// Create Notifications
LPDIRECTSOUNDNOTIFY8 notify;
@@ -112,7 +112,7 @@ bool AudioGrabberWindows::configureCaptureInterface()
recordingBuffer->Release();
return false;
}
// Create Events
notificationEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -133,11 +133,11 @@ bool AudioGrabberWindows::configureCaptureInterface()
positionNotify[i].dwOffset = (notificationSize * i) + notificationSize - 1;
positionNotify[i].hEventNotify = notificationEvent;
}
// Set Notifications
notify->SetNotificationPositions(AUDIO_NOTIFICATION_COUNT, positionNotify);
notify->Release();
return true;
}
@@ -162,12 +162,12 @@ bool AudioGrabberWindows::start()
}
Info(_log, "Capture audio from %s", QSTRING_CSTR(getDeviceName(_device)));
if (!this->configureCaptureInterface())
{
return false;
}
if (FAILED(recordingBuffer->Start(DSCBSTART_LOOPING)))
{
Error(_log, "Failed starting audio capture from '%s'", QSTRING_CSTR(getDeviceName(_device)));
@@ -214,7 +214,7 @@ void AudioGrabberWindows::stop()
{
Error(_log, "Audio capture failed to stop: '%s'", QSTRING_CSTR(getDeviceName(_device)));
}
if (FAILED(recordingBuffer->Release()))
{
Error(_log, "Failed to release recording buffer: '%s'", QSTRING_CSTR(getDeviceName(_device)));
@@ -306,7 +306,7 @@ void AudioGrabberWindows::processAudioBuffer()
// Buffer wrapped around, read second position
if (capturedAudio2 != NULL)
{
{
bufferCapturePosition += capturedAudio2Length;
bufferCapturePosition %= bufferCaptureSize; // Circular Buffer
}
@@ -318,13 +318,13 @@ void AudioGrabberWindows::processAudioBuffer()
{
CopyMemory(readBuffer + capturedAudioLength, capturedAudio2, capturedAudio2Length);
}
// Release Buffer Lock
recordingBuffer->Unlock(capturedAudio, capturedAudioLength, capturedAudio2, capturedAudio2Length);
// Process Audio Frame
this->processAudioFrame(readBuffer, frameSize);
delete[] readBuffer;
}

View File

@@ -1,4 +1,4 @@
#include <grabber/AudioWrapper.h>
#include <grabber/audio/AudioWrapper.h>
#include <hyperion/GrabberWrapper.h>
#include <QObject>
#include <QMetaType>

View File

@@ -1,35 +1,38 @@
# Define the current source locations
SET( CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber )
SET( CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/audio )
if (WIN32)
add_definitions(-DUNICODE -D_UNICODE)
FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Windows.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Windows.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp")
elseif(${CMAKE_SYSTEM} MATCHES "Linux")
FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Linux.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Linux.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp")
elseif (APPLE)
#TODO
#FILE ( GLOB AUDIO_GRABBER_SOURCES "${CURRENT_HEADER_DIR}/Audio*Apple.h" "${CURRENT_HEADER_DIR}/AudioGrabber.h" "${CURRENT_HEADER_DIR}/AudioWrapper.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*Apple.cpp" "${CURRENT_SOURCE_DIR}/AudioGrabber.cpp" "${CURRENT_SOURCE_DIR}/AudioWrapper.cpp")
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE)
set(AUDIO_GRABBER_SOURCES
${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabberWindows.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabberWindows.cpp
)
elseif(CMAKE_HOST_UNIX AND NOT APPLE)
set(AUDIO_GRABBER_SOURCES
${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabberLinux.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabberLinux.cpp
)
endif()
add_library( audio-grabber ${AUDIO_GRABBER_SOURCES} )
add_library(audio-grabber
${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/audio/AudioWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/audio/AudioWrapper.cpp
${AUDIO_GRABBER_SOURCES}
)
set(AUDIO_LIBS hyperion)
if (WIN32)
set(AUDIO_LIBS ${AUDIO_LIBS} DSound)
elseif(${CMAKE_SYSTEM} MATCHES "Linux")
find_package(ALSA REQUIRED)
if (ALSA_FOUND)
include_directories(${ALSA_INCLUDE_DIRS})
set(AUDIO_LIBS ${AUDIO_LIBS} ${ALSA_LIBRARIES})
endif(ALSA_FOUND)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(AUDIO_LIBS ${AUDIO_LIBS} Threads::Threads) # PRIVATE
if(WIN32)
set(AUDIO_LIBS DSound)
elseif(CMAKE_HOST_UNIX AND NOT APPLE)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(ALSA REQUIRED)
find_package(Threads REQUIRED)
set(AUDIO_LIBS ${ALSA_LIBRARIES} Threads::Threads)
endif()
target_link_libraries(audio-grabber
hyperion
${AUDIO_LIBS}
)
target_link_libraries(audio-grabber ${AUDIO_LIBS} ${QT_LIBRARIES})
if(CMAKE_HOST_UNIX AND NOT APPLE)
target_include_directories(audio-grabber PUBLIC ${ALSA_INCLUDE_DIRS})
endif()

View File

@@ -1,14 +1,17 @@
# Define the current source locations
SET( CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber )
SET( CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/directx )
find_package(DirectX9 REQUIRED)
include_directories(${DIRECTX9_INCLUDE_DIRS})
FILE ( GLOB DIRECTX_GRAB_SOURCES "${CURRENT_HEADER_DIR}/DirectX*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library( directx-grabber ${DIRECTX_GRAB_SOURCES} )
add_library(directx-grabber
${CMAKE_SOURCE_DIR}/include/grabber/directx/DirectXGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/directx/DirectXWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/directx/DirectXGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/directx/DirectXWrapper.cpp
)
target_link_libraries(directx-grabber
hyperion
${DIRECTX9_LIBRARIES}
hyperion
${DIRECTX9_LIBRARIES}
)
target_include_directories(directx-grabber PUBLIC
${DIRECTX9_INCLUDE_DIRS}
)

View File

@@ -1,5 +1,5 @@
#include <windows.h>
#include <grabber/DirectXGrabber.h>
#include <grabber/directx/DirectXGrabber.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib,"d3dx9.lib")

View File

@@ -1,4 +1,4 @@
#include <grabber/DirectXWrapper.h>
#include <grabber/directx/DirectXWrapper.h>
DirectXWrapper::DirectXWrapper( int updateRate_Hz,
int display,

View File

@@ -1,5 +1,5 @@
# Find the BCM-package (VC control)
if( "${PLATFORM}" MATCHES rpi)
if("${PLATFORM}" MATCHES rpi)
find_package(BCM)
if(BCM_FOUND)
add_definitions(-DBCM_FOUND)
@@ -9,21 +9,20 @@ else()
set(BCM_LIBRARY "")
endif()
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx)
add_library(dispmanx-grabber
${CMAKE_SOURCE_DIR}/include/grabber/dispmanx/DispmanxFrameGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/dispmanx/DispmanxWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx/DispmanxFrameGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/dispmanx/DispmanxWrapper.cpp
)
FILE ( GLOB DispmanxGrabberSOURCES "${CURRENT_HEADER_DIR}/Dispmanx*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(dispmanx-grabber ${DispmanxGrabberSOURCES})
add_definitions(-DBCM_LIBRARY="${BCM_LIBRARY}")
target_link_libraries(dispmanx-grabber
hyperion
${CMAKE_DL_LIBS}
)
target_include_directories(dispmanx-grabber PUBLIC
${BCM_INCLUDE_DIR}
)
target_link_libraries(dispmanx-grabber
hyperion
${QT_LIBRARIES}
${CMAKE_DL_LIBS}
)

View File

@@ -16,7 +16,7 @@ namespace {
} //End of constants
// Local includes
#include "grabber/DispmanxFrameGrabber.h"
#include "grabber/dispmanx/DispmanxFrameGrabber.h"
DispmanxFrameGrabber::DispmanxFrameGrabber()
: Grabber("DISPMANXGRABBER")

View File

@@ -1,4 +1,4 @@
#include <grabber/DispmanxWrapper.h>
#include <grabber/dispmanx/DispmanxWrapper.h>
DispmanxWrapper::DispmanxWrapper( int updateRate_Hz,
int pixelDecimation

View File

@@ -1,11 +1,10 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer)
FILE ( GLOB FramebufferGrabberSOURCES "${CURRENT_HEADER_DIR}/Framebuffer*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(framebuffer-grabber ${FramebufferGrabberSOURCES} )
add_library(framebuffer-grabber
${CMAKE_SOURCE_DIR}/include/grabber/framebuffer/FramebufferFrameGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/framebuffer/FramebufferWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer/FramebufferFrameGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/framebuffer/FramebufferWrapper.cpp
)
target_link_libraries(framebuffer-grabber
hyperion
${QT_LIBRARIES})
)

View File

@@ -28,7 +28,7 @@ const char DISCOVERY_FILEPATTERN[] = "fb?";
} //End of constants
// Local includes
#include <grabber/FramebufferFrameGrabber.h>
#include <grabber/framebuffer/FramebufferFrameGrabber.h>
FramebufferFrameGrabber::FramebufferFrameGrabber(const QString & device)
: Grabber("FRAMEBUFFERGRABBER")

View File

@@ -1,4 +1,4 @@
#include <grabber/FramebufferWrapper.h>
#include <grabber/framebuffer/FramebufferWrapper.h>
FramebufferWrapper::FramebufferWrapper( int updateRate_Hz,
const QString & device,

View File

@@ -1,11 +1,10 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/osx)
FILE ( GLOB OsxGrabberSOURCES "${CURRENT_HEADER_DIR}/Osx*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(osx-grabber ${OsxGrabberSOURCES} )
add_library(osx-grabber
${CMAKE_SOURCE_DIR}/include/grabber/osx/OsxFrameGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/osx/OsxWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/osx/OsxFrameGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/osx/OsxWrapper.cpp
)
target_link_libraries(osx-grabber
hyperion
${QT_LIBRARIES})
)

View File

@@ -3,7 +3,7 @@
#include <iostream>
// Local includes
#include <grabber/OsxFrameGrabber.h>
#include <grabber/osx/OsxFrameGrabber.h>
//Qt
#include <QJsonObject>

View File

@@ -1,159 +0,0 @@
#ifndef __APPLE__
#include <grabber/OsxFrameGrabberMock.h>
unsigned __osx_frame_counter = 0;
const int __screenWidth = 800;
const int __screenHeight = 600;
CGError CGGetActiveDisplayList(uint32_t maxDisplays, CGDirectDisplayID *activeDisplays, uint32_t *displayCount)
{
if (maxDisplays == 0 || activeDisplays == nullptr)
{
*displayCount = 2;
}
else
{
displayCount = &maxDisplays;
if (activeDisplays != nullptr)
{
for (CGDirectDisplayID i = 0; i < maxDisplays; ++i)
{
activeDisplays[i] = i;
}
}
else
{
return kCGErrorFailure;
}
}
return kCGErrorSuccess;
}
CGImageRef CGDisplayCreateImage(CGDirectDisplayID display)
{
CGImageRef image = new CGImage(__screenWidth / (display+1), __screenHeight / (display+1));
return image;
}
void CGImageRelease(CGImageRef image)
{
delete image;
}
CGImageRef CGImageGetDataProvider(CGImageRef image)
{
__osx_frame_counter++;
if (__osx_frame_counter > 100)
{
__osx_frame_counter = 0;
}
ColorRgb color[4] = {ColorRgb::RED, ColorRgb::BLUE, ColorRgb::GREEN, ColorRgb::WHITE};
if (__osx_frame_counter < 25)
{
color[0] = ColorRgb::WHITE;
color[1] = ColorRgb::RED;
color[2] = ColorRgb::BLUE;
color[3] = ColorRgb::GREEN;
}
else if(__osx_frame_counter < 50)
{
color[1] = ColorRgb::WHITE;
color[2] = ColorRgb::RED;
color[3] = ColorRgb::BLUE;
color[0] = ColorRgb::GREEN;
}
else if(__osx_frame_counter < 75)
{
color[2] = ColorRgb::WHITE;
color[3] = ColorRgb::RED;
color[0] = ColorRgb::BLUE;
color[1] = ColorRgb::GREEN;
}
unsigned w = image->width();
unsigned h = image->height();
for (unsigned y=0; y<h; y++)
{
for (unsigned x=0; x<w; x++)
{
unsigned id = 0;
if (x < w/2 && y < h/2) id = 1;
if (x < w/2 && y >= h/2) id = 2;
if (x >= w/2 && y < h/2) id = 3;
image->memptr()[y*w + x] = color[id];
}
}
return image;
}
CFDataRef CGDataProviderCopyData(CGImageRef image)
{
const unsigned indexMax = image->width() * image->height() * CGImageGetBitsPerPixel(image);
CFDataRef data = new CFData[indexMax];
int lineLength = CGImageGetBytesPerRow(image);
for (unsigned y=0; y<image->height(); y++)
{
for (unsigned x=0; x<image->width(); x++)
{
int index = lineLength * y + x * CGImageGetBitsPerPixel(image);
data[index ] = (*image)(x,y).blue;
data[index+1] = (*image)(x,y).green;
data[index+2] = (*image)(x,y).red;
data[index+3] = 0;
}
}
return data;
}
unsigned char* CFDataGetBytePtr(CFDataRef imgData)
{
return imgData;
}
unsigned CGImageGetWidth(CGImageRef image)
{
return image->width();
}
unsigned CGImageGetHeight(CGImageRef image)
{
return image->height();
}
unsigned CGImageGetBytesPerRow(CGImageRef image)
{
return image->width()*CGImageGetBitsPerPixel(image);
}
unsigned CGImageGetBitsPerPixel(CGImageRef)
{
return 4;
}
void CFRelease(CFDataRef imgData)
{
delete imgData;
}
CGDisplayModeRef CGDisplayCopyDisplayMode(CGDirectDisplayID display)
{
return nullptr;
}
CGRect CGDisplayBounds(CGDirectDisplayID display)
{
CGRect rect;
rect.size.width = __screenWidth / (display+1);
rect.size.height = __screenHeight / (display+1);
return rect;
}
void CGDisplayModeRelease(CGDisplayModeRef mode)
{
}
#endif

View File

@@ -1,4 +1,4 @@
#include <grabber/OsxWrapper.h>
#include <grabber/osx/OsxWrapper.h>
OsxWrapper::OsxWrapper( int updateRate_Hz,
int display,

View File

@@ -1,13 +1,10 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/qt)
FILE ( GLOB QT_GRAB_SOURCES "${CURRENT_HEADER_DIR}/Qt*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(qt-grabber ${QT_GRAB_SOURCES} )
add_library(qt-grabber
${CMAKE_SOURCE_DIR}/include/grabber/qt/QtGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/qt/QtWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/qt/QtGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/qt/QtWrapper.cpp
)
target_link_libraries(qt-grabber
hyperion
${QT_LIBRARIES}
)

View File

@@ -1,5 +1,5 @@
// proj
#include <grabber/QtGrabber.h>
#include <grabber/qt/QtGrabber.h>
// qt
#include <QPixmap>
@@ -226,7 +226,7 @@ int QtGrabber::grabFrame(Image<ColorRgb>& image)
QPixmap originalPixmap = grabWindow(0, _src_x, _src_y, _src_x_max, _src_y_max);
#else
QPixmap originalPixmap = _screen->grabWindow(0, _src_x, _src_y, _src_x_max, _src_y_max);
#endif
#endif
if (originalPixmap.isNull())
{
rc = -1;

View File

@@ -1,4 +1,4 @@
#include <grabber/QtWrapper.h>
#include <grabber/qt/QtWrapper.h>
QtWrapper::QtWrapper( int updateRate_Hz,
int display,

View File

@@ -1,33 +1,38 @@
# Common cmake definition for external video grabber
# Add Turbo JPEG library
if (ENABLE_V4L2 OR ENABLE_MF)
find_package(TurboJPEG)
if (TURBOJPEG_FOUND)
add_definitions(-DHAVE_TURBO_JPEG)
message( STATUS "Using Turbo JPEG library: ${TurboJPEG_LIBRARY}")
include_directories(${TurboJPEG_INCLUDE_DIRS})
else ()
message( STATUS "Turbo JPEG library not found, MJPEG camera format won't work.")
endif ()
endif()
set(MF-grabber mediafoundation)
set(V4L2-grabber v4l2)
# Define the wrapper/header/source locations and collect them
SET(WRAPPER_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/video)
SET(HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
if (ENABLE_MF)
if(ENABLE_MF)
project(mf-grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/mediafoundation)
FILE (GLOB SOURCES "${WRAPPER_DIR}/*.cpp" "${HEADER_DIR}/Video*.h" "${HEADER_DIR}/MF*.h" "${HEADER_DIR}/Encoder*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp")
set(grabber_project MF)
set(MediaFoundationSourceReaderCallBack ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/mediafoundation/MFSourceReaderCB.h)
elseif(ENABLE_V4L2)
project(v4l2-grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/video/v4l2)
FILE (GLOB SOURCES "${WRAPPER_DIR}/*.cpp" "${HEADER_DIR}/Video*.h" "${HEADER_DIR}/V4L2*.h" "${HEADER_DIR}/Encoder*.h" "${CURRENT_SOURCE_DIR}/*.cpp")
set(grabber_project V4L2)
endif()
add_library(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} hyperion ${QT_LIBRARIES})
add_library(${PROJECT_NAME}
${CMAKE_SOURCE_DIR}/include/grabber/video/EncoderThread.h
${CMAKE_SOURCE_DIR}/include/grabber/video/VideoWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/video/EncoderThread.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/video/VideoWrapper.cpp
${CMAKE_SOURCE_DIR}/include/grabber/video/${${grabber_project}-grabber}/${grabber_project}Grabber.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/video/${${grabber_project}-grabber}/${grabber_project}Grabber.cpp
${MediaFoundationSourceReaderCallBack}
)
if(TURBOJPEG_FOUND)
target_link_libraries(${PROJECT_NAME} ${TurboJPEG_LIBRARY})
target_link_libraries(${PROJECT_NAME} hyperion)
# Add Turbo JPEG library
if(ENABLE_V4L2 OR ENABLE_MF)
find_package(TurboJPEG)
if(TURBOJPEG_FOUND)
add_definitions(-DHAVE_TURBO_JPEG)
message(STATUS "Using Turbo JPEG library: ${TurboJPEG_LIBRARY}")
target_link_libraries(${PROJECT_NAME} ${TurboJPEG_LIBRARY})
target_include_directories(${PROJECT_NAME} PUBLIC ${TurboJPEG_INCLUDE_DIRS})
else ()
message(STATUS "Turbo JPEG library not found, MJPEG camera format won't work.")
endif()
endif()

View File

@@ -1,4 +1,4 @@
#include "grabber/EncoderThread.h"
#include "grabber/video/EncoderThread.h"
#include <QDebug>

View File

@@ -1,6 +1,6 @@
#include <QMetaType>
#include <grabber/VideoWrapper.h>
#include <grabber/video/VideoWrapper.h>
// qt includes
#include <QTimer>

View File

@@ -1,5 +1,5 @@
#include "MFSourceReaderCB.h"
#include "grabber/MFGrabber.h"
#include "grabber/video/mediafoundation/MFGrabber.h"
// Constants
namespace { const bool verbose = false; }
@@ -537,7 +537,7 @@ void MFGrabber::process_image(const void *frameImageBuffer, int size)
Error(_log, "Frame too small: %d != %d", size, _frameByteSize);
else if (_threadManager != nullptr)
{
for (unsigned long i = 0; i < _threadManager->_threadCount; i++)
for (int i = 0; i < _threadManager->_threadCount; i++)
{
if (!_threadManager->_threads[i]->isBusy())
{

View File

@@ -19,7 +19,7 @@
#pragma comment (lib, "strmiids.lib")
#pragma comment (lib, "wmcodecdspuuid.lib")
#include <grabber/MFGrabber.h>
#include <grabber/video/mediafoundation/MFGrabber.h>
#define SAFE_RELEASE(x) if(x) { x->Release(); x = nullptr; }

View File

@@ -23,7 +23,7 @@
#include <QFileInfo>
#include <QSet>
#include "grabber/V4L2Grabber.h"
#include "grabber/video/v4l2/V4L2Grabber.h"
#define CLEAR(x) memset(&(x), 0, sizeof(x))

View File

@@ -1,24 +1,23 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/x11)
# Find X11
find_package(X11 REQUIRED)
include_directories( ${X11_INCLUDES} )
if(APPLE)
include_directories("/opt/X11/include")
endif(APPLE)
FILE ( GLOB X11_SOURCES "${CURRENT_HEADER_DIR}/X11*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(x11-grabber ${X11_SOURCES} )
add_library(x11-grabber
${CMAKE_SOURCE_DIR}/include/grabber/x11/X11Grabber.h
${CMAKE_SOURCE_DIR}/include/grabber/x11/X11Wrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/x11/X11Grabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/x11/X11Wrapper.cpp
)
target_link_libraries(x11-grabber
hyperion
${X11_LIBRARIES}
${X11_Xrandr_LIB}
${X11_Xrender_LIB}
${QT_LIBRARIES}
)
if(APPLE)
list(APPEND X11_INCLUDES "/opt/X11/include")
endif()
target_include_directories(x11-grabber PUBLIC
${X11_INCLUDES}
)

View File

@@ -1,5 +1,5 @@
#include <utils/Logger.h>
#include <grabber/X11Grabber.h>
#include <grabber/x11/X11Grabber.h>
#include <xcb/randr.h>
#include <xcb/xcb_event.h>

View File

@@ -1,4 +1,4 @@
#include <grabber/X11Wrapper.h>
#include <grabber/x11/X11Wrapper.h>
X11Wrapper::X11Wrapper( int updateRate_Hz,
int pixelDecimation,

View File

@@ -1,23 +1,19 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/grabber)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb)
find_package(XCB COMPONENTS SHM IMAGE RENDER RANDR REQUIRED)
include_directories(${XCB_INCLUDE_DIRS})
FILE (GLOB XCB_SOURCES "${CURRENT_HEADER_DIR}/Xcb*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(xcb-grabber ${XCB_SOURCES})
add_library(xcb-grabber
${CMAKE_SOURCE_DIR}/include/grabber/xcb/XcbGrabber.h
${CMAKE_SOURCE_DIR}/include/grabber/xcb/XcbWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb/XcbCommandExecutor.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb/XcbCommands.h
${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb/XcbGrabber.cpp
${CMAKE_SOURCE_DIR}/libsrc/grabber/xcb/XcbWrapper.cpp
)
target_link_libraries(xcb-grabber
hyperion
${XCB_LIBRARIES}
${QT_LIBRARIES}
)
if (NOT APPLE)
target_link_libraries(
xcb-grabber
)
endif()
target_include_directories(xcb-grabber PUBLIC
${XCB_INCLUDE_DIRS}
)

View File

@@ -1,5 +1,5 @@
#include <utils/Logger.h>
#include <grabber/XcbGrabber.h>
#include <grabber/xcb/XcbGrabber.h>
#include "XcbCommands.h"
#include "XcbCommandExecutor.h"

View File

@@ -1,4 +1,4 @@
#include <grabber/XcbWrapper.h>
#include <grabber/xcb/XcbWrapper.h>
XcbWrapper::XcbWrapper( int updateRate_Hz,
int pixelDecimation,

View File

@@ -1,21 +1,50 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/hyperion)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/hyperion)
if(ENABLE_FLATBUF_SERVER)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
)
endif()
FILE ( GLOB Hyperion_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
SET(Hyperion_RESOURCES ${CURRENT_SOURCE_DIR}/resource.qrc)
add_library(hyperion
${Hyperion_SOURCES}
${Hyperion_RESOURCES}
# Authorization Manager
${CMAKE_SOURCE_DIR}/include/hyperion/AuthManager.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/AuthManager.cpp
# Background Effect Handler
${CMAKE_SOURCE_DIR}/include/hyperion/BGEffectHandler.h
# Capture Control class
${CMAKE_SOURCE_DIR}/include/hyperion/CaptureCont.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/CaptureCont.cpp
# Color Adjustment
${CMAKE_SOURCE_DIR}/include/hyperion/ColorAdjustment.h
# Component Register
${CMAKE_SOURCE_DIR}/include/hyperion/ComponentRegister.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/ComponentRegister.cpp
# Grabber/Wrapper classes
${CMAKE_SOURCE_DIR}/include/hyperion/Grabber.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/Grabber.cpp
${CMAKE_SOURCE_DIR}/include/hyperion/GrabberWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/GrabberWrapper.cpp
# Hyperion + Resources
${CMAKE_SOURCE_DIR}/include/hyperion/Hyperion.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/Hyperion.cpp
${CMAKE_SOURCE_DIR}/libsrc/hyperion/resource.qrc
# Instance Manager
${CMAKE_SOURCE_DIR}/include/hyperion/HyperionIManager.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/HyperionIManager.cpp
# Image Processor
${CMAKE_SOURCE_DIR}/include/hyperion/ImageProcessor.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/ImageProcessor.cpp
# ImageToLedsMap class
${CMAKE_SOURCE_DIR}/include/hyperion/ImageToLedsMap.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/ImageToLedsMap.cpp
# Led String
${CMAKE_SOURCE_DIR}/include/hyperion/LedString.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/LedString.cpp
# Linear Color Smoothing
${CMAKE_SOURCE_DIR}/include/hyperion/LinearColorSmoothing.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/LinearColorSmoothing.cpp
# Led Color Transform
${CMAKE_SOURCE_DIR}/include/hyperion/MultiColorAdjustment.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/MultiColorAdjustment.cpp
# Priority Muxer
${CMAKE_SOURCE_DIR}/include/hyperion/PriorityMuxer.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/PriorityMuxer.cpp
# Settings Manager
${CMAKE_SOURCE_DIR}/include/hyperion/SettingsManager.h
${CMAKE_SOURCE_DIR}/libsrc/hyperion/SettingsManager.cpp
)
target_link_libraries(hyperion
@@ -23,7 +52,6 @@ target_link_libraries(hyperion
hyperion-utils
leddevice
database
${QT_LIBRARIES}
)
if(ENABLE_BOBLIGHT_SERVER)

View File

@@ -1,20 +1,15 @@
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/jsonserver)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/jsonserver)
FILE ( GLOB JsonServer_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(jsonserver ${JsonServer_SOURCES} )
add_library(jsonserver
${CMAKE_SOURCE_DIR}/include/jsonserver/JsonServer.h
${CMAKE_SOURCE_DIR}/libsrc/jsonserver/JsonServer.cpp
${CMAKE_SOURCE_DIR}/libsrc/jsonserver/JsonClientConnection.h
${CMAKE_SOURCE_DIR}/libsrc/jsonserver/JsonClientConnection.cpp
)
target_link_libraries(jsonserver
hyperion-api
hyperion
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Gui
)
if(ENABLE_MDNS)
target_link_libraries(jsonserver mdns)
endif()

View File

@@ -1,13 +1,13 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/leddevice)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/leddevice)
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/leddevice)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/leddevice)
if ( ENABLE_DEV_NETWORK )
if(ENABLE_DEV_NETWORK)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED)
endif()
if ( ENABLE_DEV_SERIAL )
if(ENABLE_DEV_SERIAL)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS SerialPort REQUIRED)
endif()
@@ -21,7 +21,7 @@ include_directories(
dev_tinker
)
FILE ( GLOB Leddevice_SOURCES
file (GLOB Leddevice_SOURCES
"${CURRENT_HEADER_DIR}/*.h"
"${CURRENT_SOURCE_DIR}/*.h"
"${CURRENT_SOURCE_DIR}/*.cpp"
@@ -29,49 +29,48 @@ FILE ( GLOB Leddevice_SOURCES
"${CURRENT_SOURCE_DIR}/dev_other/*.cpp"
)
if ( ENABLE_OSX OR WIN32 )
if(ENABLE_OSX OR WIN32)
list(REMOVE_ITEM Leddevice_SOURCES "${CURRENT_SOURCE_DIR}/dev_other/LedDevicePiBlaster.h")
list(REMOVE_ITEM Leddevice_SOURCES "${CURRENT_SOURCE_DIR}/dev_other/LedDevicePiBlaster.cpp")
endif()
if ( ENABLE_DEV_NETWORK )
FILE ( GLOB Leddevice_NETWORK_SOURCES "${CURRENT_SOURCE_DIR}/dev_net/*.h" "${CURRENT_SOURCE_DIR}/dev_net/*.cpp")
if(ENABLE_DEV_NETWORK)
file (GLOB Leddevice_NETWORK_SOURCES "${CURRENT_SOURCE_DIR}/dev_net/*.h" "${CURRENT_SOURCE_DIR}/dev_net/*.cpp")
endif()
if ( ENABLE_DEV_SERIAL )
FILE ( GLOB Leddevice_SERIAL_SOURCES "${CURRENT_SOURCE_DIR}/dev_serial/*.h" "${CURRENT_SOURCE_DIR}/dev_serial/*.cpp")
if(ENABLE_DEV_SERIAL)
file (GLOB Leddevice_SERIAL_SOURCES "${CURRENT_SOURCE_DIR}/dev_serial/*.h" "${CURRENT_SOURCE_DIR}/dev_serial/*.cpp")
endif()
if ( ENABLE_DEV_SPI )
FILE ( GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp")
if(ENABLE_DEV_SPI)
file (GLOB Leddevice_SPI_SOURCES "${CURRENT_SOURCE_DIR}/dev_spi/*.h" "${CURRENT_SOURCE_DIR}/dev_spi/*.cpp")
endif()
if ( ENABLE_DEV_TINKERFORGE )
FILE ( GLOB Leddevice_TINKER_SOURCES "${CURRENT_SOURCE_DIR}/dev_tinker/*.h" "${CURRENT_SOURCE_DIR}/dev_tinker/*.cpp")
if(ENABLE_DEV_TINKERFORGE)
file (GLOB Leddevice_TINKER_SOURCES "${CURRENT_SOURCE_DIR}/dev_tinker/*.h" "${CURRENT_SOURCE_DIR}/dev_tinker/*.cpp")
endif()
if ( ENABLE_DEV_USB_HID )
if(ENABLE_DEV_USB_HID)
find_package(libusb-1.0 REQUIRED)
include_directories(
${CMAKE_SOURCE_DIR}/include/hidapi
${LIBUSB_1_INCLUDE_DIRS}
)
FILE ( GLOB Leddevice_USB_HID_SOURCES "${CURRENT_SOURCE_DIR}/dev_hid/*.h" "${CURRENT_SOURCE_DIR}/dev_hid/*.cpp")
file (GLOB Leddevice_USB_HID_SOURCES "${CURRENT_SOURCE_DIR}/dev_hid/*.h" "${CURRENT_SOURCE_DIR}/dev_hid/*.cpp")
endif()
if ( ENABLE_DEV_WS281XPWM )
include_directories(../../dependencies/external/rpi_ws281x)
FILE ( GLOB Leddevice_PWM_SOURCES "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.h" "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.cpp")
if(ENABLE_DEV_WS281XPWM)
file (GLOB Leddevice_PWM_SOURCES "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.h" "${CURRENT_SOURCE_DIR}/dev_rpi_pwm/*.cpp")
endif()
set(LedDevice_RESOURCES ${CURRENT_SOURCE_DIR}/LedDeviceSchemas.qrc )
set(LedDevice_RESOURCES ${CURRENT_SOURCE_DIR}/LedDeviceSchemas.qrc)
SET( Leddevice_SOURCES
set(Leddevice_SOURCES
${Leddevice_SOURCES}
${LedDevice_RESOURCES}
${Leddevice_NETWORK_SOURCES}
${Leddevice_PWM_SOURCES}
${Leddevice_SERIAL_SOURCES}
${Leddevice_SERIAL_SOURCES}
${Leddevice_SPI_SOURCES}
${Leddevice_TINKER_SOURCES}
${Leddevice_USB_HID_SOURCES}
@@ -79,20 +78,20 @@ SET( Leddevice_SOURCES
# auto generate header file that include all available leddevice headers
# auto generate cpp file for register() calls
FILE ( WRITE "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#pragma once\n\n//this file is autogenerated, don't touch it\n\n" )
FILE ( WRITE "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "//this file is autogenerated, don't touch it\n\n" )
FOREACH( f ${Leddevice_SOURCES} )
# MESSAGE (STATUS "Add led device: ${f}")
if ( "${f}" MATCHES "dev_.*/Led.evice.+h$" )
file (WRITE "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#pragma once\n\n//this file is autogenerated, don't touch it\n\n")
file (WRITE "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "//this file is autogenerated, don't touch it\n\n")
foreach(f ${Leddevice_SOURCES})
# message (STATUS "Add led device: ${f}")
if("${f}" MATCHES "dev_.*/Led.evice.+h$")
GET_FILENAME_COMPONENT(fname ${f} NAME)
FILE ( APPEND "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#include \"${fname}\"\n" )
STRING( SUBSTRING ${fname} 9 -1 dname)
STRING( REPLACE ".h" "" dname "${dname}" )
FILE ( APPEND "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "REGISTER(${dname});\n" )
file (APPEND "${CMAKE_BINARY_DIR}/LedDevice_headers.h" "#include \"${fname}\"\n")
string(SUBSTRING ${fname} 9 -1 dname)
string(REPLACE ".h" "" dname "${dname}")
file (APPEND "${CMAKE_BINARY_DIR}/LedDevice_register.cpp" "REGISTER(${dname});\n")
endif()
ENDFOREACH()
endforeach()
add_library(leddevice ${CMAKE_BINARY_DIR}/LedDevice_headers.h ${Leddevice_SOURCES} )
add_library(leddevice ${CMAKE_BINARY_DIR}/LedDevice_headers.h ${Leddevice_SOURCES})
target_link_libraries(leddevice
hyperion
@@ -106,19 +105,19 @@ endif()
if(ENABLE_DEV_NETWORK)
target_link_libraries(leddevice Qt${QT_VERSION_MAJOR}::Network ssdp)
if (NOT DEFAULT_USE_SYSTEM_MBEDTLS_LIBS)
if (MBEDTLS_LIBRARIES)
if(NOT DEFAULT_USE_SYSTEM_MBEDTLS_LIBS)
if(MBEDTLS_LIBRARIES)
include_directories(${MBEDTLS_INCLUDE_DIR})
target_link_libraries(leddevice ${MBEDTLS_LIBRARIES})
target_include_directories(leddevice PRIVATE ${MBEDTLS_INCLUDE_DIR})
endif (MBEDTLS_LIBRARIES)
endif ()
endif()
string(REGEX MATCH "[0-9]+|-([A-Za-z0-9_.]+)" MBEDTLS_MAJOR ${MBEDTLS_VERSION})
if (MBEDTLS_MAJOR EQUAL "3")
if(MBEDTLS_MAJOR EQUAL "3")
target_compile_definitions(leddevice PRIVATE USE_MBEDTLS3)
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_features(leddevice PRIVATE cxx_std_20)
endif()
endif()
@@ -133,10 +132,11 @@ if(ENABLE_DEV_TINKERFORGE)
endif()
if(ENABLE_DEV_WS281XPWM)
target_include_directories(leddevice PUBLIC "${CMAKE_SOURCE_DIR}/dependencies/external/rpi_ws281x")
target_link_libraries(leddevice ws281x)
endif()
if (ENABLE_DEV_USB_HID)
if(ENABLE_DEV_USB_HID)
if(APPLE)
target_link_libraries(leddevice ${LIBUSB_1_LIBRARIES} hidapi-mac)
else()
@@ -150,17 +150,18 @@ if (ENABLE_DEV_USB_HID)
#include <sys/time.h>
int main() {
struct timespec t;
return clock_gettime(CLOCK_REALTIME, &t);
struct timespec t;
return clock_gettime(CLOCK_REALTIME, &t);
}
" GLIBC_HAS_CLOCK_GETTIME)
IF(NOT GLIBC_HAS_CLOCK_GETTIME)
if(NOT GLIBC_HAS_CLOCK_GETTIME)
target_link_libraries(leddevice rt)
endif()
endif()
endif()
if(ENABLE_MDNS)
target_link_libraries(leddevice mdns)
target_link_libraries(leddevice mdns)
endif()

View File

@@ -1,16 +1,13 @@
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/mdns)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/mdns)
FILE ( GLOB MDNS_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(mdns ${MDNS_SOURCES})
include_directories(${QMDNS_INCLUDE_DIR})
target_link_libraries(mdns
hyperion-utils
${QMDNS_LIBRARIES}
add_library(mdns
${CMAKE_SOURCE_DIR}/include/mdns/MdnsServiceRegister.h
${CMAKE_SOURCE_DIR}/include/mdns/MdnsBrowser.h
${CMAKE_SOURCE_DIR}/include/mdns/MdnsProvider.h
${CMAKE_SOURCE_DIR}/libsrc/mdns/MdnsBrowser.cpp
${CMAKE_SOURCE_DIR}/libsrc/mdns/MdnsProvider.cpp
)
target_include_directories(mdns PUBLIC ${QMDNS_INCLUDE_DIR})
target_link_libraries(mdns
hyperion
qmdnsengine
$<$<BOOL:${WIN32}>:bcrypt.lib>
)

View File

@@ -1,37 +1,22 @@
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/protoserver)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/protoserver)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${PROTOBUF_INCLUDE_DIRS}
)
set(ProtoServer_PROTOS ${CURRENT_SOURCE_DIR}/message.proto )
protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS ${ProtoServer_PROTOS} )
### Split protoclient from protoserver as protoserver relates to HyperionDaemon and standalone capture binarys can't link to it
add_library(protoclient
${CURRENT_SOURCE_DIR}/ProtoClientConnection.h
${CURRENT_SOURCE_DIR}/ProtoClientConnection.cpp
${ProtoServer_PROTO_SRCS}
${ProtoServer_PROTO_HDRS}
)
add_library(protoserver
${CURRENT_HEADER_DIR}/ProtoServer.h
${CURRENT_SOURCE_DIR}/ProtoServer.cpp
)
# set and compile proto schema
set(ProtoServer_PROTOS ${CMAKE_SOURCE_DIR}/libsrc/protoserver/message.proto)
protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS ${ProtoServer_PROTOS})
# disable warnings for auto generated proto files, we can't change the files ....
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(${ProtoServer_PROTO_SRCS} ${ProtoServer_PROTO_HDRS} ${ProtoServer_PROTOS} PROPERTIES COMPILE_FLAGS "-w -Wno-return-local-addr")
elseif(MSVC)
set_source_files_properties(${ProtoServer_PROTO_SRCS} ${ProtoServer_PROTO_HDRS} ${ProtoServer_PROTOS} PROPERTIES COMPILE_FLAGS "/W0")
endif()
### Split protoclient from protoserver as protoserver relates to HyperionDaemon and standalone capture binarys can't link to it
add_library(protoclient
${CMAKE_SOURCE_DIR}/libsrc/protoserver/ProtoClientConnection.h
${CMAKE_SOURCE_DIR}/libsrc/protoserver/ProtoClientConnection.cpp
${ProtoServer_PROTO_SRCS}
${ProtoServer_PROTO_HDRS}
)
target_link_libraries(protoclient
hyperion
hyperion-utils
@@ -39,6 +24,16 @@ target_link_libraries(protoclient
Qt${QT_VERSION_MAJOR}::Gui
)
target_include_directories(protoclient PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${PROTOBUF_INCLUDE_DIRS}
)
add_library(protoserver
${CMAKE_SOURCE_DIR}/include/protoserver/ProtoServer.h
${CMAKE_SOURCE_DIR}/libsrc/protoserver/ProtoServer.cpp
)
target_link_libraries(protoserver
hyperion
hyperion-utils

View File

@@ -1,34 +1,30 @@
# Include the python directory. Also include the parent (which is for example /usr/include)
# which may be required when it is not includes by the (cross-) compiler by default.
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..)
add_compile_definitions(PYTHON_VERSION_MAJOR=${Python3_VERSION_MAJOR})
add_compile_definitions(PYTHON_VERSION_MINOR=${Python3_VERSION_MINOR})
else()
find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
add_definitions(-DPYTHON_VERSION_MAJOR=${PYTHON_VERSION_MAJOR})
add_definitions(-DPYTHON_VERSION_MINOR=${PYTHON_VERSION_MINOR})
endif()
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/python)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/python)
FILE ( GLOB PYTHON_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(python
${PYTHON_SOURCES}
${CMAKE_SOURCE_DIR}/include/python/PythonInit.h
${CMAKE_SOURCE_DIR}/include/python/PythonProgram.h
${CMAKE_SOURCE_DIR}/include/python/PythonUtils.h
${CMAKE_SOURCE_DIR}/libsrc/python/PythonInit.cpp
${CMAKE_SOURCE_DIR}/libsrc/python/PythonProgram.cpp
)
if(NOT CMAKE_VERSION VERSION_LESS "3.12")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
else()
find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT)
endif()
target_link_libraries(python
effectengine
hyperion-utils
${Python3_LIBRARIES}
${PYTHON_LIBRARIES}
)
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
target_link_libraries( python ${Python3_LIBRARIES} )
else()
target_link_libraries( python ${PYTHON_LIBRARIES} )
endif()
target_include_directories(python PUBLIC
${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..
${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..
)
target_compile_definitions(python PRIVATE
PYTHON_VERSION_MAJOR=$<$<BOOL:${Python3_FOUND}>:${Python3_VERSION_MAJOR}>$<$<BOOL:${PYTHONLIBS_FOUND}>:${PYTHON_VERSION_MAJOR}>
PYTHON_VERSION_MINOR=$<$<BOOL:${Python3_FOUND}>:${Python3_VERSION_MINOR}>$<$<BOOL:${PYTHONLIBS_FOUND}>:${PYTHON_VERSION_MINOR}>
)

View File

@@ -1,14 +1,13 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/ssdp)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/ssdp)
FILE ( GLOB SSDP_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(ssdp
${SSDP_SOURCES}
${CMAKE_SOURCE_DIR}/include/ssdp/SSDPDiscover.h
${CMAKE_SOURCE_DIR}/include/ssdp/SSDPHandler.h
${CMAKE_SOURCE_DIR}/include/ssdp/SSDPServer.h
${CMAKE_SOURCE_DIR}/libsrc/ssdp/SSDPDescription.h
${CMAKE_SOURCE_DIR}/libsrc/ssdp/SSDPDiscover.cpp
${CMAKE_SOURCE_DIR}/libsrc/ssdp/SSDPHandler.cpp
${CMAKE_SOURCE_DIR}/libsrc/ssdp/SSDPServer.cpp
)
target_link_libraries(ssdp
Qt${QT_VERSION_MAJOR}::Network
webserver
)

View File

@@ -1,32 +1,94 @@
# Define the current source locations
if(ENABLE_EFFECTENGINE)
# Include the python directory. Also include the parent (which is for example /usr/include)
# which may be required when it is not includes by the (cross-) compiler by default.
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..)
add_compile_definitions(PYTHON_VERSION_MAJOR_MINOR=${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
else()
find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
add_definitions(-DPYTHON_VERSION_MAJOR_MINOR=${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
endif()
endif()
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/utils)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/utils)
FILE ( GLOB_RECURSE Utils_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
list(APPEND Utils_SOURCES "${CMAKE_SOURCE_DIR}/dependencies/include/oklab/ok_color.h")
if ( NOT ENABLE_PROFILER )
LIST ( REMOVE_ITEM Utils_SOURCES ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp )
if(ENABLE_PROFILER)
set(PROFILER ${CURRENT_HEADER_DIR}/Profiler.h ${CURRENT_SOURCE_DIR}/Profiler.cpp)
endif()
add_library(hyperion-utils
${Utils_SOURCES}
# Global defines/signal sharing
${CMAKE_SOURCE_DIR}/include/utils/global_defines.h
${CMAKE_SOURCE_DIR}/include/utils/GlobalSignals.h
# JSON Schema Checker
${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonFactory.h
${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonUtils.h
${CMAKE_SOURCE_DIR}/include/utils/jsonschema/QJsonSchemaChecker.h
${CMAKE_SOURCE_DIR}/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp
# Color ARGB/BGR/RGB/RGBA/RGBW etc. structures
${CMAKE_SOURCE_DIR}/include/utils/ColorArgb.h
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorArgb.cpp
${CMAKE_SOURCE_DIR}/include/utils/ColorBgr.h
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorBgr.cpp
${CMAKE_SOURCE_DIR}/include/utils/ColorRgb.h
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgb.cpp
${CMAKE_SOURCE_DIR}/include/utils/ColorRgba.h
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgba.cpp
${CMAKE_SOURCE_DIR}/include/utils/ColorRgbScalar.h
${CMAKE_SOURCE_DIR}/include/utils/ColorRgbw.h
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorRgbw.cpp
# Image declaration
${CMAKE_SOURCE_DIR}/include/utils/Image.h
${CMAKE_SOURCE_DIR}/include/utils/ImageData.h
# Image resampler
${CMAKE_SOURCE_DIR}/include/utils/ImageResampler.h
${CMAKE_SOURCE_DIR}/libsrc/utils/ImageResampler.cpp
# Color transformation (saturation/luminance) of RGB colors
${CMAKE_SOURCE_DIR}/include/utils/ColorSys.h
${CMAKE_SOURCE_DIR}/libsrc/utils/ColorSys.cpp
# Color transformation (saturation/value) of Okhsv colors
${CMAKE_SOURCE_DIR}/include/utils/OkhsvTransform.h
${CMAKE_SOURCE_DIR}/libsrc/utils/OkhsvTransform.cpp
# Signal handler
${CMAKE_SOURCE_DIR}/include/utils/DefaultSignalHandler.h
${CMAKE_SOURCE_DIR}/libsrc/utils/DefaultSignalHandler.cpp
# File utilities
${CMAKE_SOURCE_DIR}/include/utils/FileUtils.h
${CMAKE_SOURCE_DIR}/libsrc/utils/FileUtils.cpp
# JSON utilities
${CMAKE_SOURCE_DIR}/include/utils/JsonUtils.h
${CMAKE_SOURCE_DIR}/libsrc/utils/JsonUtils.cpp
# Logger
${CMAKE_SOURCE_DIR}/include/utils/Logger.h
${CMAKE_SOURCE_DIR}/libsrc/utils/Logger.cpp
# IP adress/Port checker
${CMAKE_SOURCE_DIR}/include/utils/NetOrigin.h
${CMAKE_SOURCE_DIR}/libsrc/utils/NetOrigin.cpp
${CMAKE_SOURCE_DIR}/include/utils/NetUtils.h
# Process namespace (Hyperion restart)
${CMAKE_SOURCE_DIR}/include/utils/Process.h
${CMAKE_SOURCE_DIR}/libsrc/utils/Process.cpp
# Rgb single color adjustment/correction
${CMAKE_SOURCE_DIR}/include/utils/RgbChannelAdjustment.h
${CMAKE_SOURCE_DIR}/libsrc/utils/RgbChannelAdjustment.cpp
# Color conversion/transformation
${CMAKE_SOURCE_DIR}/include/utils/RgbToRgbw.h
${CMAKE_SOURCE_DIR}/libsrc/utils/RgbToRgbw.cpp
${CMAKE_SOURCE_DIR}/include/utils/RgbTransform.h
${CMAKE_SOURCE_DIR}/libsrc/utils/RgbTransform.cpp
# System info class
${CMAKE_SOURCE_DIR}/include/utils/SysInfo.h
${CMAKE_SOURCE_DIR}/libsrc/utils/SysInfo.cpp
# Grabber pixel formats enumeration
${CMAKE_SOURCE_DIR}/include/utils/PixelFormat.h
# Grabber playing modes enumeration
${CMAKE_SOURCE_DIR}/include/utils/VideoMode.h
# Grabber video standards enumeration
${CMAKE_SOURCE_DIR}/include/utils/VideoStandard.h
# SettingsManager utilities
${CMAKE_SOURCE_DIR}/include/utils/settings.h
# Qt string utilities
${CMAKE_SOURCE_DIR}/include/utils/QStringUtils.h
# QThread sleep class
${CMAKE_SOURCE_DIR}/include/utils/Sleep.h
# Wait event loop function
${CMAKE_SOURCE_DIR}/include/utils/WaitTime.h
# Weak connection
${CMAKE_SOURCE_DIR}/include/utils/WeakConnect.h
# Semver namespace
${CMAKE_SOURCE_DIR}/include/utils/version.hpp
# Utility methods for Hyperion class
${CMAKE_SOURCE_DIR}/include/utils/hyperion.h
# Oklab color space
${CMAKE_SOURCE_DIR}/dependencies/include/oklab/ok_color.h
# Performance tester
${PROFILER}
)
target_link_libraries(hyperion-utils

View File

@@ -1,93 +1,92 @@
#ifdef _WIN32
#include <QCoreApplication>
#include <QProcess>
#include <utils/Logger.h>
#include <QString>
#include <QByteArray>
namespace Process {
#include <QCoreApplication>
#include <QProcess>
#include <utils/Logger.h>
#include <QString>
#include <QByteArray>
void restartHyperion(int exitCode)
{
Logger* log = Logger::getInstance("Process");
Info(log, "Restarting hyperion ...");
namespace Process
{
void restartHyperion(int exitCode)
{
Logger* log = Logger::getInstance("Process");
Info(log, "Restarting hyperion ...");
auto arguments = QCoreApplication::arguments();
if (!arguments.contains("--wait-hyperion"))
arguments << "--wait-hyperion";
auto arguments = QCoreApplication::arguments();
if (!arguments.contains("--wait-hyperion"))
arguments << "--wait-hyperion";
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
//Exit with non-zero code to ensure service deamon restarts hyperion
QCoreApplication::exit(exitCode);
}
//Exit with non-zero code to ensure service deamon restarts hyperion
QCoreApplication::exit(exitCode);
}
QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/)
{
return QSTRING_CSTR(QString());
}
};
QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/)
{
return QSTRING_CSTR(QString());
}
};
#else
#include <utils/Process.h>
#include <utils/Logger.h>
#include <utils/Process.h>
#include <utils/Logger.h>
#include <QCoreApplication>
#include <QProcess>
#include <QStringList>
#include <QCoreApplication>
#include <QProcess>
#include <QStringList>
#include <unistd.h>
#include <cstdio>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <unistd.h>
#include <cstdio>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <csignal>
#include <csignal>
#include <QDebug>
#include <QMetaObject>
#include <QDebug>
#include <QMetaObject>
namespace Process {
void restartHyperion(int exitCode)
{
Logger* log = Logger::getInstance("Process");
Info(log, "Restarting hyperion ...");
std::cout << std::endl
<< " *******************************************" << std::endl
<< " * hyperion will restart now *" << std::endl
<< " *******************************************" << std::endl << std::endl;
auto arguments = QCoreApplication::arguments();
if (!arguments.contains("--wait-hyperion"))
arguments << "--wait-hyperion";
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
//Exit with non-zero code to ensure service deamon restarts hyperion
QCoreApplication::exit(exitCode);
}
QByteArray command_exec(const QString& cmd, const QByteArray& /*data*/)
{
char buffer[128];
QString result;
std::shared_ptr<FILE> pipe(popen(cmd.toLocal8Bit().constData(), "r"), pclose);
if (pipe)
namespace Process
{
while (!feof(pipe.get()))
void restartHyperion(int exitCode)
{
if (fgets(buffer, 128, pipe.get()) != nullptr)
result += buffer;
}
}
return QSTRING_CSTR(result);
}
Logger* log = Logger::getInstance("Process");
Info(log, "Restarting hyperion ...");
};
std::cout << std::endl
<< " *******************************************" << std::endl
<< " * hyperion will restart now *" << std::endl
<< " *******************************************" << std::endl << std::endl;
auto arguments = QCoreApplication::arguments();
if (!arguments.contains("--wait-hyperion"))
arguments << "--wait-hyperion";
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
//Exit with non-zero code to ensure service deamon restarts hyperion
QCoreApplication::exit(exitCode);
}
QByteArray command_exec(const QString& cmd, const QByteArray& /*data*/)
{
char buffer[128];
QString result;
std::shared_ptr<FILE> pipe(popen(cmd.toLocal8Bit().constData(), "r"), pclose);
if (pipe)
{
while (!feof(pipe.get()))
{
if (fgets(buffer, 128, pipe.get()) != nullptr)
result += buffer;
}
}
return QSTRING_CSTR(result);
}
};
#endif

View File

@@ -1,29 +1,43 @@
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/webserver)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/webserver)
file(GLOB_RECURSE webFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig/*)
file(RELATIVE_PATH webConfigPath ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig)
FILE ( GLOB WebConfig_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
FILE ( GLOB_RECURSE webFiles RELATIVE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig/* )
FILE ( RELATIVE_PATH webConfigPath ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/assets/webconfig)
foreach(f ${webFiles})
string(REPLACE "${webConfigPath}/" "" fname ${f})
set(HYPERION_WEBCONFIG_RES "${HYPERION_WEBCONFIG_RES}\n\t\t<file alias=\"/webconfig/${fname}\">${f}</file>")
endforeach()
FOREACH( f ${webFiles} )
STRING ( REPLACE "${webConfigPath}/" "" fname ${f})
SET(HYPERION_WEBCONFIG_RES "${HYPERION_WEBCONFIG_RES}\n\t\t<file alias=\"/webconfig/${fname}\">${f}</file>")
ENDFOREACH()
CONFIGURE_FILE(${CURRENT_SOURCE_DIR}/WebConfig.qrc.in ${CMAKE_BINARY_DIR}/WebConfig.qrc )
SET(WebConfig_RESOURCES ${CMAKE_BINARY_DIR}/WebConfig.qrc)
configure_file(${CMAKE_SOURCE_DIR}/libsrc/webserver/WebConfig.qrc.in ${CMAKE_BINARY_DIR}/WebConfig.qrc)
add_library(webserver
${WebConfig_SOURCES}
${WebConfig_RESOURCES}
${CMAKE_SOURCE_DIR}/include/webserver/WebServer.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/WebServer.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/CgiHandler.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/CgiHandler.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpClientWrapper.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpClientWrapper.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpHeader.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpHeader.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpReply.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpReply.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpRequest.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpRequest.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpServer.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/QtHttpServer.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/StaticFileServing.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/StaticFileServing.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/WebJsonRpc.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/WebJsonRpc.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/WebSocketClient.h
${CMAKE_SOURCE_DIR}/libsrc/webserver/WebSocketClient.cpp
${CMAKE_SOURCE_DIR}/libsrc/webserver/WebSocketUtils.h
${CMAKE_BINARY_DIR}/WebConfig.qrc
)
target_link_libraries(webserver
hyperion
hyperion-utils
hyperion-api
Qt${QT_VERSION_MAJOR}::Network
)
if(ENABLE_MDNS)