Minor fixes / improvements.
This commit is contained in:
parent
5f4e7ec6c2
commit
7714250646
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,7 +0,0 @@
|
||||
CMakeFiles/
|
||||
Hyperion_Grabber_X11_QT_autogen/
|
||||
cmake_install.cmake
|
||||
CMakeCache.txt
|
||||
Makefile
|
||||
Hyperion_Grabber_X11_QT
|
||||
CMakeLists.txt.user
|
||||
@ -171,9 +171,9 @@ void hgx11::_setImgSize()
|
||||
{
|
||||
_hclient_p->imgCmdBuf.clear();
|
||||
_hclient_p->imgCmdBuf.append("{\"command\":\"image\",\"priority\":100,\"imageheight\":");
|
||||
_hclient_p->imgCmdBuf.append(QString::number(_grabber_p->getDest_height()));
|
||||
_hclient_p->imgCmdBuf.append(QString::number(_grabber_p->getDest_height()).toUtf8());
|
||||
_hclient_p->imgCmdBuf.append(",\"imagewidth\":");
|
||||
_hclient_p->imgCmdBuf.append(QString::number(_grabber_p->getDest_width()));
|
||||
_hclient_p->imgCmdBuf.append(QString::number(_grabber_p->getDest_width()).toUtf8());
|
||||
_hclient_p->imgCmdBuf.append(",\"imagedata\":\"");
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ void hgx11grab::grabFrame()
|
||||
|
||||
QImage qimg(reinterpret_cast<const uchar *>(_xImage_p->data), _destWidth_m, _destHeight_m, _xImage_p->bytes_per_line, QImage::Format_ARGB32);
|
||||
qimg = qimg.convertToFormat(QImage::Format_RGB888);
|
||||
imgdata_m = QByteArray::fromRawData(reinterpret_cast<const char *>(qimg.bits()), qimg.byteCount()).toBase64().data();
|
||||
imgdata_m = QByteArray::fromRawData(reinterpret_cast<const char *>(qimg.bits()), qimg.sizeInBytes()).toBase64().data();
|
||||
|
||||
_freeResources();
|
||||
|
||||
|
||||
24
hgx11net.cpp
24
hgx11net.cpp
@ -32,11 +32,11 @@ void hgx11net::setLedColor(quint8 R, quint8 G, quint8 B)
|
||||
{
|
||||
_cmd_m.clear();
|
||||
_cmd_m.append("{\"color\":[");
|
||||
_cmd_m.append(QString::number(R));
|
||||
_cmd_m.append(QString::number(R).toUtf8());
|
||||
_cmd_m.append(",");
|
||||
_cmd_m.append(QString::number(G));
|
||||
_cmd_m.append(QString::number(G).toUtf8());
|
||||
_cmd_m.append(",");
|
||||
_cmd_m.append(QString::number(B));
|
||||
_cmd_m.append(QString::number(B).toUtf8());
|
||||
_cmd_m.append("],\"command\":\"color\",\"priority\":100}\n");
|
||||
_sendCommand();
|
||||
}
|
||||
@ -112,17 +112,17 @@ void hgx11net::_colorAdjustment()
|
||||
_cmd_m.append("{\"adjustment\":{");
|
||||
if (_colorAdjustmentType_m & REDADJUST) {
|
||||
_cmd_m.append("\"redAdjust\":");
|
||||
_cmd_m.append(_redAdjust_m);
|
||||
_cmd_m.append(_redAdjust_m.toUtf8());
|
||||
_cmd_m.append(",");
|
||||
}
|
||||
if (_colorAdjustmentType_m & GREENADJUST) {
|
||||
_cmd_m.append("\"greenAdjust\":");
|
||||
_cmd_m.append(_greenAdjust_m);
|
||||
_cmd_m.append(_greenAdjust_m.toUtf8());
|
||||
_cmd_m.append(",");
|
||||
}
|
||||
if (_colorAdjustmentType_m & BLUEADJUST) {
|
||||
_cmd_m.append("\"blueAdjust\":");
|
||||
_cmd_m.append(_blueAdjust_m);
|
||||
_cmd_m.append(_blueAdjust_m.toUtf8());
|
||||
_cmd_m.append(",");
|
||||
}
|
||||
_cmd_m.chop(1); // remove trailing ,
|
||||
@ -137,7 +137,7 @@ void hgx11net::_thresholdAdjustment()
|
||||
}
|
||||
_cmd_m.clear();
|
||||
_cmd_m.append("{\"command\":\"transform\",\"transform\":{\"threshold\":");
|
||||
_cmd_m.append(_threshold_m);
|
||||
_cmd_m.append(_threshold_m.toUtf8());
|
||||
_cmd_m.append("}}\n");
|
||||
_sendCommand();
|
||||
}
|
||||
@ -150,11 +150,11 @@ void hgx11net::_transformdAdjustment()
|
||||
QStringList values = _transform_m.split(',');
|
||||
_cmd_m.clear();
|
||||
_cmd_m.append("{\"command\":\"transform\",\"transform\":{\"luminanceGain\":");
|
||||
_cmd_m.append(values.at(0));
|
||||
_cmd_m.append(values.at(0).toUtf8());
|
||||
_cmd_m.append(",\"luminanceMinimum\":");
|
||||
_cmd_m.append(values.at(1));
|
||||
_cmd_m.append(values.at(1).toUtf8());
|
||||
_cmd_m.append(",\"saturationGain\":");
|
||||
_cmd_m.append(values.at(2));
|
||||
_cmd_m.append(values.at(2).toUtf8());
|
||||
_cmd_m.append("}}\n");
|
||||
_sendCommand();
|
||||
}
|
||||
@ -166,7 +166,7 @@ void hgx11net::_temperatureAdjustment()
|
||||
}
|
||||
_cmd_m.clear();
|
||||
_cmd_m.append("{\"command\":\"temperature\",\"temperature\":{\"correctionValues\":");
|
||||
_cmd_m.append(_temperature_m);
|
||||
_cmd_m.append(_temperature_m.toUtf8());
|
||||
_cmd_m.append("}}\n");
|
||||
_sendCommand();
|
||||
}
|
||||
@ -176,7 +176,7 @@ void hgx11net::_temperatureAdjustment()
|
||||
void hgx11net::sendImage(QString imgdata)
|
||||
{
|
||||
_cmd_m = imgCmdBuf;
|
||||
_cmd_m.append(imgdata);
|
||||
_cmd_m.append(imgdata.toUtf8());
|
||||
_cmd_m.append("\"}\n");
|
||||
_sendCommand();
|
||||
}
|
||||
|
||||
65
main.cpp
65
main.cpp
@ -26,58 +26,19 @@ int main(int argc, char *argv[])
|
||||
parser.setApplicationDescription("X11 grabber for Hyperion using QT");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
QCommandLineOption address(QStringList() << "a" << "address",
|
||||
QCoreApplication::translate("main", "Address to the hyperion json server. (ex. 127.0.0.1)")
|
||||
);
|
||||
parser.addOption(address);
|
||||
QCommandLineOption port(QStringList() << "p" << "port",
|
||||
QCoreApplication::translate("main", "Port for the hyperion json server. (ex. 19444)")
|
||||
);
|
||||
parser.addOption(port);
|
||||
QCommandLineOption scale(QStringList() << "s" << "scale",
|
||||
QCoreApplication::translate("main", "Divisor used to scale your screen resolution (ex. 8 ; if your screen is 1920x1080, the result image sent to hyperion is 240x135")
|
||||
);
|
||||
parser.addOption(scale);
|
||||
QCommandLineOption frameskip(QStringList() << "f" << "frameskip",
|
||||
QCoreApplication::translate("main", "How many X11 frames to skip over. (ex. 4 ; 1 frame will be scaled and sent to hyperion and 4 will be ignored)")
|
||||
);
|
||||
parser.addOption(frameskip);
|
||||
QCommandLineOption inactiveTime(QStringList() << "i" << "inactive",
|
||||
QCoreApplication::translate("main", "How many seconds after the screen is inactive to turn off the LED's. Set to 0 to disable.")
|
||||
);
|
||||
parser.addOption(inactiveTime);
|
||||
QCommandLineOption inactiveType(QStringList() << "j" << "inactivetype",
|
||||
QCoreApplication::translate("main", "If `i` or `inactive` is set, how to determine activity, using (1) Xscreensaver (based on amount of time since user input activity) or (0) Xdamage (based on amount of time since screen activity change)")
|
||||
);
|
||||
parser.addOption(inactiveType);
|
||||
QCommandLineOption redAdjust(QStringList() << "r" << "redadjust",
|
||||
QCoreApplication::translate("main", "Adjustment of the LED's red color (requires 3 space seperated values between 0 and 255) (ex. \"255,10,0\")")
|
||||
);
|
||||
parser.addOption(redAdjust);
|
||||
QCommandLineOption greenAdjust(QStringList() << "g" << "greenadjust",
|
||||
QCoreApplication::translate("main", "Adjustment of the LED's green color (requires 3 space seperated values between 0 and 255) (ex. \"75,210,0\")")
|
||||
);
|
||||
parser.addOption(greenAdjust);
|
||||
QCommandLineOption blueAdjust(QStringList() << "b" << "blueadjust",
|
||||
QCoreApplication::translate("main", "Adjustment of the LED's blue color (requires 3 space seperated values between 0 and 255) (ex. \"0,10,160\")")
|
||||
);
|
||||
parser.addOption(blueAdjust);
|
||||
QCommandLineOption temperature(QStringList() << "t" << "temperature",
|
||||
QCoreApplication::translate("main", "Adjustment of the LED's color temperature (requires 3 space seperated values between 0 and 255) (ex. \"255,255,250\")")
|
||||
);
|
||||
parser.addOption(temperature);
|
||||
QCommandLineOption threshold(QStringList() << "d" << "threshold",
|
||||
QCoreApplication::translate("main", "Set the threshold of the LED's (requires 3 space seperated values between 0.0 and 1.0) (ex. \"0.0025,0.005,0.01\")")
|
||||
);
|
||||
parser.addOption(threshold);
|
||||
QCommandLineOption transform(QStringList() << "l" << "transform",
|
||||
QCoreApplication::translate("main", "Adjusts the luminance / saturation of the LED's values are in this order: luminanceGain, luminanceMin, saturationL (requires 3 space seperated values between 0.0 and 1.0) (ex. \"1.0,0.01,1.0\")")
|
||||
);
|
||||
parser.addOption(transform);
|
||||
QCommandLineOption filter(QStringList() << "x" << "scalefilter",
|
||||
QCoreApplication::translate("main", "X11 scaling filter to use (see X11's render.h). 0 nearest (default), 1 bilinear, 2 fast, 3 good, 4 best")
|
||||
);
|
||||
parser.addOption(filter);
|
||||
parser.addOption({{"a", "address"}, "Address to the hyperion json server. (ex. 127.0.0.1)", "address"});
|
||||
parser.addOption({{"p", "port"}, "Port for the hyperion json server. (ex. 19444)", "port"});
|
||||
parser.addOption({{"s", "scale"}, "Divisor used to scale your screen resolution (ex. 8 ; if your screen is 1920x1080, the result image sent to hyperion is 240x135", "scale"});
|
||||
parser.addOption({{"f", "frameskip"}, "How many X11 frames to skip over. (ex. 4 ; 1 frame will be scaled and sent to hyperion and 4 will be ignored)", "frames"});
|
||||
parser.addOption({{"i", "inactive"}, "How many seconds after the screen is inactive to turn off the LED's. Set to 0 to disable.", "seonds"});
|
||||
parser.addOption({{"j", "inactivetype"}, "If `i` or `inactive` is set, how to determine activity, using (1) Xscreensaver (based on amount of time since user input activity) or (0) Xdamage (based on amount of time since screen activity change)", "type"});
|
||||
parser.addOption({{"r", "redadjust"}, "Adjustment of the LED's red color (requires 3 space seperated values between 0 and 255) (ex. \"255,10,0\")", "value"});
|
||||
parser.addOption({{"g", "greenadjust"}, "Adjustment of the LED's green color (requires 3 space seperated values between 0 and 255) (ex. \"75,210,0\")", "value"});
|
||||
parser.addOption({{"b", "blueadjust"}, "Adjustment of the LED's blue color (requires 3 space seperated values between 0 and 255) (ex. \"0,10,160\")", "value"});
|
||||
parser.addOption({{"t", "temperature"}, "Adjustment of the LED's color temperature (requires 3 space seperated values between 0 and 255) (ex. \"255,255,250\")", "value"});
|
||||
parser.addOption({{"d", "threshold"}, "Set the threshold of the LED's (requires 3 space seperated values between 0.0 and 1.0) (ex. \"0.0025,0.005,0.01\")", "value"});
|
||||
parser.addOption({{"l", "transform"}, "Adjusts the luminance / saturation of the LED's values are in this order: luminanceGain, luminanceMin, saturationL (requires 3 space seperated values between 0.0 and 1.0) (ex. \"1.0,0.01,1.0\")", "value"});
|
||||
parser.addOption({{"x", "scalefilter"}, "X11 scaling filter to use (see X11's render.h). 0 nearest (default), 1 bilinear, 2 fast, 3 good, 4 best", "value"});
|
||||
parser.process(*qapp);
|
||||
|
||||
if (!parser.isSet("address")) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user