mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Changed XBMC video checker from HTPP (using QNetworkAccessManager) to a plain TCP socket because of thre required CPU
This commit is contained in:
@@ -8,36 +8,43 @@
|
||||
// QT includes
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QTcpSocket>
|
||||
#include <QByteArray>
|
||||
|
||||
// Hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
|
||||
/// Check if XBMC is playing something. When it does not, this class will send all black data Hyperion to
|
||||
/// override (grabbed) data with a lower priority
|
||||
///
|
||||
/// Note: The json TCP server needs to be enabled manually in XBMC in System/Settings/Network/Services
|
||||
class XBMCVideoChecker : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
XBMCVideoChecker(QString address, uint64_t interval, Hyperion * hyperion, int priority);
|
||||
XBMCVideoChecker(QString address, uint16_t port, uint64_t interval, Hyperion * hyperion, int priority);
|
||||
|
||||
void start();
|
||||
|
||||
private slots:
|
||||
void sendRequest();
|
||||
|
||||
void receiveReply(QNetworkReply * reply);
|
||||
void receiveReply();
|
||||
|
||||
private:
|
||||
const QString _address;
|
||||
|
||||
const uint16_t _port;
|
||||
|
||||
const QByteArray _request;
|
||||
|
||||
QTimer _timer;
|
||||
|
||||
QNetworkAccessManager _networkManager;
|
||||
|
||||
QNetworkRequest _request;
|
||||
QTcpSocket _socket;
|
||||
|
||||
Hyperion * _hyperion;
|
||||
|
||||
int _priority;
|
||||
const int _priority;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user