mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Cleanup of XBMC 3D checker code
Former-commit-id: 26acf7dceb3e26a2e59af82736dec9fdf09c26d5
This commit is contained in:
parent
9da97c0698
commit
8d75a57f18
@ -131,4 +131,7 @@ private:
|
|||||||
|
|
||||||
/// Previous emitted video mode
|
/// Previous emitted video mode
|
||||||
VideoMode _previousVideoMode;
|
VideoMode _previousVideoMode;
|
||||||
|
|
||||||
|
/// XBMC version number
|
||||||
|
int _xbmcVersion;
|
||||||
};
|
};
|
||||||
|
@ -18,10 +18,8 @@
|
|||||||
// {"id":668,"jsonrpc":"2.0","result":{"System.ScreenSaverActive":false}}
|
// {"id":668,"jsonrpc":"2.0","result":{"System.ScreenSaverActive":false}}
|
||||||
|
|
||||||
// Request stereoscopicmode example:
|
// Request stereoscopicmode example:
|
||||||
// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":1}
|
// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669}
|
||||||
// {"id":1,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
|
// {"id":669,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
|
||||||
|
|
||||||
int xbmcVersion = 0;
|
|
||||||
|
|
||||||
XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection) :
|
XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection) :
|
||||||
QObject(),
|
QObject(),
|
||||||
@ -30,8 +28,8 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
|
|||||||
_activePlayerRequest(R"({"id":666,"jsonrpc":"2.0","method":"Player.GetActivePlayers"})"),
|
_activePlayerRequest(R"({"id":666,"jsonrpc":"2.0","method":"Player.GetActivePlayers"})"),
|
||||||
_currentPlayingItemRequest(R"({"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})"),
|
_currentPlayingItemRequest(R"({"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})"),
|
||||||
_checkScreensaverRequest(R"({"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}})"),
|
_checkScreensaverRequest(R"({"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}})"),
|
||||||
_getStereoscopicMode(R"({"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":1})"),
|
_getStereoscopicMode(R"({"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669})"),
|
||||||
_getXbmcVersion(R"({"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":1})"),
|
_getXbmcVersion(R"({"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":670})"),
|
||||||
_socket(),
|
_socket(),
|
||||||
_grabVideo(grabVideo),
|
_grabVideo(grabVideo),
|
||||||
_grabPhoto(grabPhoto),
|
_grabPhoto(grabPhoto),
|
||||||
@ -41,7 +39,8 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
|
|||||||
_enable3DDetection(enable3DDetection),
|
_enable3DDetection(enable3DDetection),
|
||||||
_previousScreensaverMode(false),
|
_previousScreensaverMode(false),
|
||||||
_previousGrabbingMode(GRABBINGMODE_INVALID),
|
_previousGrabbingMode(GRABBINGMODE_INVALID),
|
||||||
_previousVideoMode(VIDEO_2D)
|
_previousVideoMode(VIDEO_2D),
|
||||||
|
_xbmcVersion(0)
|
||||||
{
|
{
|
||||||
// setup socket
|
// setup socket
|
||||||
connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply()));
|
connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply()));
|
||||||
@ -124,7 +123,7 @@ void XBMCVideoChecker::receiveReply()
|
|||||||
}
|
}
|
||||||
else if (reply.contains("\"id\":667"))
|
else if (reply.contains("\"id\":667"))
|
||||||
{
|
{
|
||||||
if (xbmcVersion >= 13)
|
if (_xbmcVersion >= 13)
|
||||||
{
|
{
|
||||||
// check of active stereoscopicmode
|
// check of active stereoscopicmode
|
||||||
_socket.write(_getStereoscopicMode.toUtf8());
|
_socket.write(_getStereoscopicMode.toUtf8());
|
||||||
@ -162,13 +161,13 @@ void XBMCVideoChecker::receiveReply()
|
|||||||
// check here xbmc version
|
// check here xbmc version
|
||||||
if (_socket.state() == QTcpSocket::ConnectedState)
|
if (_socket.state() == QTcpSocket::ConnectedState)
|
||||||
{
|
{
|
||||||
if (xbmcVersion == 0)
|
if (_xbmcVersion == 0)
|
||||||
{
|
{
|
||||||
_socket.write(_getXbmcVersion.toUtf8());
|
_socket.write(_getXbmcVersion.toUtf8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (reply.contains("\"stereoscopicmode\""))
|
else if (reply.contains("\"id\":669"))
|
||||||
{
|
{
|
||||||
QRegExp regex("\"mode\":\"(split_vertical|split_horizontal)\"");
|
QRegExp regex("\"mode\":\"(split_vertical|split_horizontal)\"");
|
||||||
int pos = regex.indexIn(reply);
|
int pos = regex.indexIn(reply);
|
||||||
@ -185,13 +184,13 @@ void XBMCVideoChecker::receiveReply()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (reply.contains("\"version\":"))
|
else if (reply.contains("\"id\":670"))
|
||||||
{
|
{
|
||||||
QRegExp regex("\"major\":(\\d+)");
|
QRegExp regex("\"major\":(\\d+)");
|
||||||
int pos = regex.indexIn(reply);
|
int pos = regex.indexIn(reply);
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
{
|
{
|
||||||
xbmcVersion = regex.cap(1).toInt();
|
_xbmcVersion = regex.cap(1).toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user