Changed XBMC Video checker from emitting all black on a lower channel than the grabber to commanding the grabber

This commit is contained in:
johan
2013-09-23 22:33:38 +02:00
parent 82617dea51
commit cf0f94224f
6 changed files with 81 additions and 18 deletions

View File

@@ -7,6 +7,7 @@
// Utils includes
#include <utils/RgbColor.h>
#include <utils/RgbImage.h>
#include <utils/GrabbingMode.h>
// Forward class declaration
class DispmanxFrameGrabber;
@@ -53,6 +54,12 @@ public slots:
///
void stop();
///
/// \brief Set the grabbing mode
/// \param mode The new grabbing mode
///
void setGrabbingMode(GrabbingMode mode);
private:
/// The update rate [Hz]
const int _updateInterval_ms;

View File

@@ -0,0 +1,11 @@
#pragma once
enum GrabbingMode
{
GRABBINGMODE_OFF,
GRABBINGMODE_VIDEO,
GRABBINGMODE_PHOTO,
GRABBINGMODE_AUDIO,
GRABBINGMODE_MENU,
GRABBINGMODE_INVALID
};

View File

@@ -14,6 +14,9 @@
// Hyperion includes
#include <hyperion/Hyperion.h>
// Utils includes
#include <utils/GrabbingMode.h>
///
/// This class will check if XBMC is playing something. When it does not, this class will send all black data to Hyperion.
/// This allows grabbed screen data to be overriden while in the XBMC menus.
@@ -31,16 +34,21 @@ public:
/// @param address Network address of the XBMC instance
/// @param port Port number to use (XBMC default = 9090)
/// @param interval The interval at which XBMC is polled
/// @param hyperion The Hyperion instance
/// @param priority The priority at which to send the all black data
/// @param grabVideo Whether or not to grab when the XBMC video player is playing
/// @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)
///
XBMCVideoChecker(const std::string & address, uint16_t port, uint64_t interval, Hyperion * hyperion, int priority);
XBMCVideoChecker(const std::string & address, uint16_t port, uint64_t interval, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu);
///
/// Start polling XBMC
///
void start();
signals:
void grabbingMode(GrabbingMode grabbingMode);
private slots:
///
/// Send a request to XBMC
@@ -68,9 +76,18 @@ private:
/// The QT TCP Socket with connection to XBMC
QTcpSocket _socket;
/// The Hyperion instance to switch leds to black if in XBMC menu
Hyperion * _hyperion;
/// Flag indicating whether or not to grab when the XBMC video player is playing
bool _grabVideo;
/// The priority of the BLACK led value when in XBMC menu
const int _priority;
/// Flag indicating whether or not to grab when the XBMC photo player is playing
bool _grabPhoto;
/// Flag indicating whether or not to grab when the XBMC audio player is playing
bool _grabAudio;
/// Flag indicating whether or not to grab when XBMC is playing nothing (in menu)
bool _grabMenu;
/// Previous emitted grab state
GrabbingMode _previousMode;
};