mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
remove protobuf (part 2)
This commit is contained in:
@@ -4,8 +4,8 @@ project(hyperion-osx)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/protoserver
|
||||
${PROTOBUF_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../libsrc/flatbufserver
|
||||
${FLATBUFFERS_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(Hyperion_OSX_HEADERS
|
||||
@@ -27,8 +27,10 @@ target_link_libraries( ${PROJECT_NAME}
|
||||
commandline
|
||||
blackborder
|
||||
hyperion-utils
|
||||
protoclient
|
||||
flatbufserver
|
||||
flatbuffers
|
||||
osx-grabber
|
||||
ssdp
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::Network
|
||||
|
@@ -4,10 +4,13 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QImage>
|
||||
|
||||
#include <protoserver/ProtoConnectionWrapper.h>
|
||||
#include <flatbufserver/FlatBufferConnection.h>
|
||||
#include "OsxWrapper.h"
|
||||
#include <commandline/Parser.h>
|
||||
|
||||
// ssdp discover
|
||||
#include <ssdp/SSDPDiscover.h>
|
||||
|
||||
using namespace commandline;
|
||||
|
||||
// save the image as screenshot
|
||||
@@ -25,7 +28,7 @@ int main(int argc, char ** argv)
|
||||
try
|
||||
{
|
||||
// create the option parser and initialize all parameters
|
||||
Parser parser("OSX capture application for Hyperion");
|
||||
Parser parser("OSX capture application for Hyperion. Will automatically search a Hyperion server if -a option isn't used. Please note that if you have more than one server running it's more or less random which one will be used.");
|
||||
|
||||
Option & argDisplay = parser.add<Option> ('d', "display", "Set the display to capture [default: %1]");
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10", 1, 600);
|
||||
@@ -46,37 +49,50 @@ int main(int argc, char ** argv)
|
||||
parser.showHelp(0);
|
||||
}
|
||||
|
||||
OsxWrapper osxWrapper
|
||||
(parser.isSet(argDisplay), argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser));
|
||||
OsxWrapper osxWrapper
|
||||
(parser.isSet(argDisplay), argWidth.getInt(parser), argHeight.getInt(parser), 1000 / argFps.getInt(parser));
|
||||
|
||||
if (parser.isSet(argScreenshot)) {
|
||||
// Capture a single screenshot and finish
|
||||
const Image<ColorRgb> &screenshot = osxWrapper.getScreenshot();
|
||||
saveScreenshot("screenshot.png", screenshot);
|
||||
}
|
||||
else {
|
||||
// Create the Proto-connection with hyperiond
|
||||
ProtoConnectionWrapper protoWrapper
|
||||
(argAddress.value(parser), argPriority.getInt(parser), 1000, parser.isSet(argSkipReply));
|
||||
if (parser.isSet(argScreenshot))
|
||||
{
|
||||
// Capture a single screenshot and finish
|
||||
const Image<ColorRgb> &screenshot = osxWrapper.getScreenshot();
|
||||
saveScreenshot("screenshot.png", screenshot);
|
||||
}
|
||||
else
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address;
|
||||
if(parser.isSet(argAddress))
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
}
|
||||
else
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_FLATBUFSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
}
|
||||
}
|
||||
|
||||
// Connect the screen capturing to the proto processing
|
||||
QObject::connect(&osxWrapper,
|
||||
SIGNAL(sig_screenshot(
|
||||
const Image<ColorRgb> &)),
|
||||
&protoWrapper,
|
||||
SLOT(receiveImage(Image<ColorRgb>)));
|
||||
// Create the Flabuf-connection
|
||||
FlatBufferConnection flatbuf("OSX Standalone", address, argPriority.getInt(parser), parser.isSet(argSkipReply));
|
||||
|
||||
// Start the capturing
|
||||
osxWrapper.start();
|
||||
// Connect the screen capturing to flatbuf connection processing
|
||||
QObject::connect(&osxWrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &flatbuf, SLOT(setImage(Image<ColorRgb>)));
|
||||
|
||||
// Start the application
|
||||
app.exec();
|
||||
// Start the capturing
|
||||
osxWrapper.start();
|
||||
|
||||
// Start the application
|
||||
app.exec();
|
||||
}
|
||||
}
|
||||
catch (const std::runtime_error & e)
|
||||
{
|
||||
// An error occured. Display error and quit
|
||||
Error(Logger::getInstance("OSXGRABBER"), "%s", e.what());
|
||||
Error(Logger::getInstance("OSXGRABBER"), "%s", e.what());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user