mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fix standalone grabbers (#1384)
* Fix too much copy/paste * Fix typo * Commandlineoptions: Additional error details for Int and Double ranges * Standalone grabbers: Show fps range on error, fix default host address
This commit is contained in:
parent
926a58de9c
commit
e3b494428a
@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Standalone grabbers: Improved fps help/error text, fixed default address and port
|
||||
|
||||
## Removed
|
||||
|
||||
## [2.0.12](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.0.12) - 2021-11-20
|
||||
|
@ -26,20 +26,28 @@ public:
|
||||
double minimum = -INFINITY, double maximum = INFINITY, int decimals = 1000)
|
||||
: ValidatorOption(names, description, valueName, defaultValue)
|
||||
{
|
||||
setValidator(new QDoubleValidator(minimum, maximum, decimals));
|
||||
_minimum = minimum;
|
||||
_maximum = maximum;
|
||||
setValidator(new QDoubleValidator(_minimum, _maximum, decimals));
|
||||
}
|
||||
|
||||
DoubleOption(const QCommandLineOption &other, double minimum = -INFINITY, double maximum = INFINITY, int decimals = 1000)
|
||||
: ValidatorOption(other)
|
||||
{
|
||||
setValidator(new QDoubleValidator(minimum, maximum, decimals));
|
||||
_minimum = minimum;
|
||||
_maximum = maximum;
|
||||
setValidator(new QDoubleValidator(_minimum, _maximum, decimals));
|
||||
}
|
||||
|
||||
double getDouble(Parser &parser, bool *ok = 0);
|
||||
double *getDoublePtr(Parser &parser, bool *ok = 0);
|
||||
|
||||
bool validate(Parser & parser, QString & value) override;
|
||||
|
||||
protected:
|
||||
double _double;
|
||||
int _minimum;
|
||||
int _maximum;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ class IntOption: public ValidatorOption
|
||||
{
|
||||
protected:
|
||||
int _int;
|
||||
int _minimum;
|
||||
int _maximum;
|
||||
|
||||
public:
|
||||
IntOption(const QString &name,
|
||||
@ -31,18 +33,24 @@ public:
|
||||
int minimum = std::numeric_limits<int>::min(), int maximum = std::numeric_limits<int>::max())
|
||||
: ValidatorOption(names, description, valueName, defaultValue)
|
||||
{
|
||||
setValidator(new QIntValidator(minimum, maximum));
|
||||
_minimum = minimum;
|
||||
_maximum = maximum;
|
||||
setValidator(new QIntValidator(_minimum, _maximum));
|
||||
}
|
||||
|
||||
IntOption(const QCommandLineOption &other,
|
||||
int minimum = std::numeric_limits<int>::min(), int maximum = std::numeric_limits<int>::max())
|
||||
: ValidatorOption(other)
|
||||
{
|
||||
setValidator(new QIntValidator(minimum, maximum));
|
||||
_minimum = minimum;
|
||||
_maximum = maximum;
|
||||
setValidator(new QIntValidator(_minimum, _maximum));
|
||||
}
|
||||
|
||||
int getInt(Parser &parser, bool *ok = 0, int base = 10);
|
||||
int *getIntPtr(Parser &parser, bool *ok = 0, int base = 10);
|
||||
|
||||
bool validate(Parser & parser, QString & value) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -61,6 +61,11 @@ namespace NetUtils {
|
||||
///
|
||||
inline bool resolveHostPort(const QString& address, QString& host, quint16& port)
|
||||
{
|
||||
if (address.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString testUrl;
|
||||
if (address.at(0) != '[' && address.count(':') > 1)
|
||||
{
|
||||
@ -87,10 +92,10 @@ namespace NetUtils {
|
||||
|
||||
///
|
||||
/// @brief Check if the port is in the valid range
|
||||
/// @param log The logger of the caller to print
|
||||
/// @param[in] address The port to be tested
|
||||
/// @param log The logger of the caller to print
|
||||
/// @param[in] address The port to be tested
|
||||
/// @param[out] hostAddress A hostname to make reference to during logging
|
||||
/// @return True on success else false
|
||||
/// @return True on success else false
|
||||
///
|
||||
|
||||
inline bool resolveHostAddress(Logger* log, const QString& address, QHostAddress& hostAddress)
|
||||
|
@ -19,3 +19,15 @@ double *DoubleOption::getDoublePtr(Parser &parser, bool *ok)
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool DoubleOption::validate(Parser & parser, QString & value)
|
||||
{
|
||||
if (ValidatorOption::validate(parser,value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
_error = QString("Value must be between %1 and %2.").arg(_minimum).arg(_maximum);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using namespace commandline;
|
||||
int IntOption::getInt(Parser &parser, bool *ok, int base)
|
||||
{
|
||||
_int = value(parser).toInt(ok, base);
|
||||
|
||||
return _int;
|
||||
}
|
||||
|
||||
@ -18,3 +19,15 @@ int *IntOption::getIntPtr(Parser &parser, bool *ok, int base)
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool IntOption::validate(Parser & parser, QString & value)
|
||||
{
|
||||
if (ValidatorOption::validate(parser,value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
_error = QString("Value must be between %1 and %2.").arg(_minimum).arg(_maximum);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ bool Parser::parse(const QStringList &arguments)
|
||||
if (!option->validate(*this, value)) {
|
||||
const QString error = option->getError();
|
||||
if (!error.isEmpty()) {
|
||||
_errorText = tr("%1 is not a valid option for %2\n%3").arg(value, option->name(), error);
|
||||
_errorText = tr("\"%1\" is not a valid option for %2, %3").arg(value, option->name(), error);
|
||||
}
|
||||
else
|
||||
{
|
||||
_errorText = tr("%1 is not a valid option for %2").arg(value, option->name());
|
||||
_errorText = tr("\"%1\" is not a valid option for %2").arg(value, option->name());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -37,7 +37,7 @@ void Parser::process(const QStringList &arguments)
|
||||
_parser.process(arguments);
|
||||
if (!parse(arguments))
|
||||
{
|
||||
fprintf(stdout, "%s", qPrintable(tr("Error: %1").arg(_errorText)));
|
||||
fprintf(stdout, "%s\n\n", qPrintable(tr("Error: %1").arg(_errorText)));
|
||||
showHelp(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ int main(int argc, char ** argv)
|
||||
// create the option parser and initialize all parser
|
||||
Parser parser("AmLogic 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.");
|
||||
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", QString::number(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate. %1", QString("Range %1-%2fps, default: [%3]").arg(GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output image size [default=%1]", QString::number(GrabberWrapper::DEFAULT_PIXELDECIMATION), 1);
|
||||
|
||||
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation");
|
||||
@ -54,7 +54,7 @@ int main(int argc, char ** argv)
|
||||
BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
|
||||
BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
|
||||
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault port: 19444.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19444\nIPv6 : [2001:1:2:3:4:5:6:7]");
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault host: %1, port: 19400.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19400\nIPv6 : [2001:1:2:3:4:5:6:7]", "127.0.0.1");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
|
||||
@ -113,7 +113,7 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
if(address == "127.0.0.1" || address == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
|
@ -45,7 +45,7 @@ int main(int argc, char ** argv)
|
||||
// create the option parser and initialize all parameters
|
||||
Parser parser("Dispmanx 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.");
|
||||
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", QString::number(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate. %1", QString("Range %1-%2fps, default: [%3]").arg(GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output image size [default=%1]", QString::number(GrabberWrapper::DEFAULT_PIXELDECIMATION), 1);
|
||||
|
||||
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation");
|
||||
@ -55,7 +55,7 @@ int main(int argc, char ** argv)
|
||||
BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
|
||||
BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
|
||||
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault port: 19444.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19444\nIPv6 : [2001:1:2:3:4:5:6:7]");
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault host: %1, port: 19400.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19400\nIPv6 : [2001:1:2:3:4:5:6:7]", "127.0.0.1");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
|
||||
@ -116,7 +116,7 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
if(address == "127.0.0.1" || address == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
|
@ -46,7 +46,7 @@ int main(int argc, char ** argv)
|
||||
|
||||
Option & argDevice = parser.add<Option> ('d', "device", "Set the framebuffer device [default: %1]", "/dev/fb0");
|
||||
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", QString::number(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate. %1", QString("Range %1-%2fps, default: [%3]").arg(GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output image size [default=%1]", QString::number(GrabberWrapper::DEFAULT_PIXELDECIMATION), 1);
|
||||
|
||||
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation");
|
||||
@ -56,7 +56,7 @@ int main(int argc, char ** argv)
|
||||
BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
|
||||
BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
|
||||
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault port: 19444.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19444\nIPv6 : [2001:1:2:3:4:5:6:7]");
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault host: %1, port: 19400.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19400\nIPv6 : [2001:1:2:3:4:5:6:7]", "127.0.0.1");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
|
||||
@ -116,7 +116,7 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
if(address == "127.0.0.1" || address == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
|
@ -40,7 +40,7 @@ int main(int argc, char ** argv)
|
||||
|
||||
IntOption & argDisplay = parser.add<IntOption> ('d', "display", "Set the display to capture [default: %1]", "0");
|
||||
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", QString::number(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate. %1", QString("Range %1-%2fps, default: [%3]").arg(GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output image size [default=%1]", QString::number(GrabberWrapper::DEFAULT_PIXELDECIMATION), 1);
|
||||
|
||||
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation");
|
||||
@ -50,7 +50,7 @@ int main(int argc, char ** argv)
|
||||
BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
|
||||
BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
|
||||
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault port: 19444.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19444\nIPv6 : [2001:1:2:3:4:5:6:7]");
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault host: %1, port: 19400.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19400\nIPv6 : [2001:1:2:3:4:5:6:7]", "127.0.0.1");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
|
||||
@ -110,7 +110,7 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
if(address == "127.0.0.1" || address == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
|
@ -47,7 +47,7 @@ int main(int argc, char ** argv)
|
||||
|
||||
IntOption & argDisplay = parser.add<IntOption> ('d', "display", "Set the display to capture [default: %1]", "0");
|
||||
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", QString::number(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate. %1", QString("Range %1-%2fps, default: [%3]").arg(GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output image size [default=%1]", QString::number(GrabberWrapper::DEFAULT_PIXELDECIMATION), 1);
|
||||
|
||||
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation");
|
||||
@ -57,7 +57,7 @@ int main(int argc, char ** argv)
|
||||
BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
|
||||
BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
|
||||
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault port: 19444.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19444\nIPv6 : [2001:1:2:3:4:5:6:7]");
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault host: %1, port: 19400.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19400\nIPv6 : [2001:1:2:3:4:5:6:7]", "127.0.0.1");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
|
||||
@ -117,7 +117,7 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
if(address == "127.0.0.1" || address == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
|
@ -57,7 +57,7 @@ int main(int argc, char** argv)
|
||||
IntOption & argInput = parser.add<IntOption> ('i', "input", "The device input [default: %1]", "0");
|
||||
SwitchOption<VideoStandard> & argVideoStandard= parser.add<SwitchOption<VideoStandard>>('v', "video-standard", "The used video standard. Valid values are PAL, NTSC, SECAM or no-change. [default: %1]", "no-change");
|
||||
SwitchOption<PixelFormat> & argPixelFormat = parser.add<SwitchOption<PixelFormat>> (0x0, "pixel-format", "The use pixel format. Valid values are YUYV, UYVY, RGB32, MJPEG or no-change. [default: %1]", "no-change");
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", QString::number(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate. %1", QString("Range %1-%2fps, default: [%3]").arg(GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
SwitchOption<FlipMode> & argFlipMode = parser.add<SwitchOption<FlipMode>>(0x0, "flip-mode", "The used image flip mode. Valid values are HORIZONTAL, VERTICAL, BOTH or no-change. [default: %1]", "no-change");
|
||||
IntOption & argWidth = parser.add<IntOption> ('w', "width", "Width of the captured image [default: %1]", "640", 640);
|
||||
IntOption & argHeight = parser.add<IntOption> ('h', "height", "Height of the captured image [default: %1]", "480", 480);
|
||||
@ -82,7 +82,7 @@ int main(int argc, char** argv)
|
||||
DoubleOption & argSignalHorizontalMax = parser.add<DoubleOption> (0x0, "signal-horizontal-max", "area for signal detection - horizontal maximum offset value. Values between 0.0 and 1.0");
|
||||
DoubleOption & argSignalVerticalMax = parser.add<DoubleOption> (0x0, "signal-vertical-max" , "area for signal detection - vertical maximum offset value. Values between 0.0 and 1.0");
|
||||
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault port: 19444.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19444\nIPv6 : [2001:1:2:3:4:5:6:7]");
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault host: %1, port: 19400.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19400\nIPv6 : [2001:1:2:3:4:5:6:7]", "127.0.0.1");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
|
||||
@ -232,7 +232,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
if(address == "127.0.0.1" || address == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
|
@ -41,7 +41,7 @@ int main(int argc, char ** argv)
|
||||
// create the option parser and initialize all parameters
|
||||
Parser parser("X11 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.");
|
||||
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", QString::number(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate. %1", QString("Range %1-%2fps, default: [%3]").arg(GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output image size [default=%1]", QString::number(GrabberWrapper::DEFAULT_PIXELDECIMATION), 1);
|
||||
|
||||
IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0");
|
||||
@ -53,7 +53,7 @@ int main(int argc, char ** argv)
|
||||
BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
|
||||
BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
|
||||
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault port: 19444.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19444\nIPv6 : [2001:1:2:3:4:5:6:7]");
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault host: %1, port: 19400.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19400\nIPv6 : [2001:1:2:3:4:5:6:7]", "127.0.0.1");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
|
||||
@ -113,7 +113,7 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
if(address == "127.0.0.1" || address == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
|
@ -41,7 +41,7 @@ int main(int argc, char ** argv)
|
||||
// create the option parser and initialize all parameters
|
||||
Parser parser("XCB 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.");
|
||||
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", QString::number(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate. %1", QString("Range %1-%2fps, default: [%3]").arg(GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ).arg(GrabberWrapper::DEFAULT_RATE_HZ), GrabberWrapper::DEFAULT_MIN_GRAB_RATE_HZ, GrabberWrapper::DEFAULT_MAX_GRAB_RATE_HZ);
|
||||
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output image size [default=%1]", QString::number(GrabberWrapper::DEFAULT_PIXELDECIMATION), 1);
|
||||
|
||||
IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0");
|
||||
@ -53,7 +53,7 @@ int main(int argc, char ** argv)
|
||||
BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
|
||||
BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
|
||||
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault port: 19444.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19444\nIPv6 : [2001:1:2:3:4:5:6:7]");
|
||||
Option & argAddress = parser.add<Option> ('a', "address", "The hostname or IP-address (IPv4 or IPv6) of the hyperion server.\nDefault host: %1, port: 19400.\nSample addresses:\nHost : hyperion.fritz.box\nIPv4 : 127.0.0.1:19400\nIPv6 : [2001:1:2:3:4:5:6:7]", "127.0.0.1");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (suggested 100-199) [default: %1]", "150");
|
||||
BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
|
||||
|
||||
@ -113,7 +113,7 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19400")
|
||||
if(address == "127.0.0.1" || address == "127.0.0.1:19400")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(searchType::STY_FLATBUFSERVER);
|
||||
|
@ -228,13 +228,13 @@ int main(int argc, char** argv)
|
||||
if (!address.isLoopback() && (address.protocol() == QAbstractSocket::IPv4Protocol))
|
||||
{
|
||||
std::cout << "Access the Hyperion User-Interface for configuration and control via:" << std::endl;
|
||||
std::cout << "http:://" << address.toString().toStdString() << ":8090" << std::endl;
|
||||
std::cout << "http://" << address.toString().toStdString() << ":8090" << std::endl;
|
||||
|
||||
QHostInfo hostInfo = QHostInfo::fromName(address.toString());
|
||||
if (hostInfo.error() == QHostInfo::NoError)
|
||||
{
|
||||
QString hostname = hostInfo.hostName();
|
||||
std::cout << "http:://" << hostname.toStdString() << ":8090" << std::endl;
|
||||
std::cout << "http://" << hostname.toStdString() << ":8090" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user