Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/include/xbmcvideochecker/XBMCVideoChecker.h b/include/xbmcvideochecker/XBMCVideoChecker.h
- index 08fc423..9368cf3 100644
- --- a/include/xbmcvideochecker/XBMCVideoChecker.h
- +++ b/include/xbmcvideochecker/XBMCVideoChecker.h
- @@ -38,7 +38,7 @@ public:
- /// @param grabPhoto Whether or not to grab when the XBMC photo player is playing
- /// @param grabAudio Whether or not to grab when the XBMC audio player is playing
- /// @param grabMenu Whether or not to grab when nothing is playing (in XBMC menu)
- - /// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated
- + /// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated
- /// @param enable3DDetection Wheter or not to enable the detection of 3D movies playing
- ///
- XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection);
- @@ -96,6 +96,9 @@ private:
- /// The JSON-RPC message to check the screensaver
- const QString _checkScreensaverRequest;
- + /// The JSON-RPC message to check the active stereoscopicmode
- + const QString _getStereoscopicMode;
- +
- /// The QT TCP Socket with connection to XBMC
- QTcpSocket _socket;
- @@ -111,7 +114,7 @@ private:
- /// Flag indicating whether or not to grab when XBMC is playing nothing (in menu)
- const bool _grabMenu;
- - /// Flag inidcating whether or not to grab when the XBMC screensaver is activated
- + /// Flag indicating whether or not to grab when the XBMC screensaver is activated
- const bool _grabScreensaver;
- /// Flag indicating wheter or not to enable the detection of 3D movies playing
- diff --git a/libsrc/xbmcvideochecker/XBMCVideoChecker.cpp b/libsrc/xbmcvideochecker/XBMCVideoChecker.cpp
- index 0c39669..68fb720 100644
- --- a/libsrc/xbmcvideochecker/XBMCVideoChecker.cpp
- +++ b/libsrc/xbmcvideochecker/XBMCVideoChecker.cpp
- @@ -17,6 +17,10 @@
- // {"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}}
- // {"id":668,"jsonrpc":"2.0","result":{"System.ScreenSaverActive":false}}
- +// Request stereoscopicmode example:
- +// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":1}
- +// {"id":1,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
- +
- XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection) :
- QObject(),
- _address(QString::fromStdString(address)),
- @@ -24,6 +28,7 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
- _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"]}})"),
- _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})"),
- _socket(),
- _grabVideo(grabVideo),
- _grabPhoto(grabPhoto),
- @@ -116,6 +121,9 @@ void XBMCVideoChecker::receiveReply()
- }
- else if (reply.contains("\"id\":667"))
- {
- + // check of active stereoscopicmode
- + _socket.write(_getStereoscopicMode.toUtf8());
- +
- // result of Player.GetItem
- // TODO: what if the filename contains a '"'. In Json this should have been escaped
- QRegExp regex("\"file\":\"((?!\").)*\"");
- @@ -143,6 +151,23 @@ void XBMCVideoChecker::receiveReply()
- bool active = reply.contains("\"System.ScreenSaverActive\":true");
- setScreensaverMode(!_grabScreensaver && active);
- }
- + else if (reply.contains("\"stereoscopicmode\""))
- + {
- + QRegExp regex("\"mode\":\"(split_vertical|split_horizontal)\"");
- + int pos = regex.indexIn(reply);
- + if (pos > 0)
- + {
- + QString sMode = regex.cap(1);
- + if (sMode == "split_vertical")
- + {
- + setVideoMode(VIDEO_3DSBS);
- + }
- + else if (sMode == "split_horizontal")
- + {
- + setVideoMode(VIDEO_3DTAB);
- + }
- + }
- + }
- }
- void XBMCVideoChecker::connected()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement