|
1 | 1 |
|
2 | 2 | // QT includes
|
3 | 3 | #include <QCoreApplication>
|
| 4 | +#include <QTimer> |
4 | 5 | #include <QImage>
|
5 | 6 |
|
6 | 7 | #include <utils/DefaultSignalHandler.h>
|
@@ -130,36 +131,26 @@ int main(int argc, char ** argv)
|
130 | 131 | }
|
131 | 132 | else
|
132 | 133 | {
|
133 |
| - QString host; |
134 |
| - QString const serviceName {QHostInfo::localHostName()}; |
| 134 | + QString hostname; |
135 | 135 | int port{ FLATBUFFER_DEFAULT_PORT };
|
136 | 136 |
|
137 | 137 | // Split hostname and port (or use default port)
|
138 | 138 | QString const givenAddress = argAddress.value(parser);
|
139 |
| - if (!NetUtils::resolveHostPort(givenAddress, host, port)) |
| 139 | + if (!NetUtils::resolveHostPort(givenAddress, hostname, port)) |
140 | 140 | {
|
141 | 141 | emit errorManager.errorOccurred(QString("Wrong address: unable to parse address (%1)").arg(givenAddress));
|
142 | 142 | }
|
143 | 143 |
|
144 | 144 | // Search available Hyperion services via mDNS, if default/localhost IP is given
|
145 |
| - if (host == "127.0.0.1" || host == "::1") |
| 145 | + QHostAddress hostAddress; |
| 146 | + if (!NetUtils::resolveHostToAddress(log, hostname, hostAddress, port)) |
146 | 147 | {
|
147 |
| -#ifndef ENABLE_MDNS |
148 |
| - SSDPDiscover discover; |
149 |
| - host = discover.getFirstService(searchType::STY_FLATBUFSERVER); |
150 |
| -#endif |
151 |
| - QHostAddress address; |
152 |
| - if (!NetUtils::resolveHostToAddress(log, host, address, port)) |
153 |
| - { |
154 |
| - emit errorManager.errorOccurred(QString("Address could not be resolved for hostname: %2").arg(QSTRING_CSTR(host))); |
| 148 | + emit errorManager.errorOccurred(QString("Address could not be resolved for hostname: %2").arg(QSTRING_CSTR(hostAddress.toString()))); |
155 | 149 | }
|
156 |
| - host = address.toString(); |
157 |
| - } |
158 |
| - |
159 |
| - Info(log, "Connecting to Hyperion host: %s, port: %u using service: %s", QSTRING_CSTR(host), port, QSTRING_CSTR(serviceName)); |
| 150 | + Info(log, "Connecting to Hyperion host: %s, port: %u", QSTRING_CSTR(hostAddress.toString()), port); |
160 | 151 |
|
161 | 152 | // Create the Flabuf-connection
|
162 |
| - FlatBufferConnection const flatbuf(CAPTURE_TYPE + " Standalone", host, argPriority.getInt(parser), parser.isSet(argSkipReply), port); |
| 153 | + FlatBufferConnection const flatbuf(CAPTURE_TYPE + " Standalone", hostAddress, argPriority.getInt(parser), parser.isSet(argSkipReply), port); |
163 | 154 |
|
164 | 155 | // Connect the screen capturing to flatbuf connection processing
|
165 | 156 | QObject::connect(&grabber, &AmlogicWrapper::sig_screenshot,
|
|
0 commit comments