Kodi checker rework (+enable option) (#96)

* big kodichecker rework

- use new logger
- 'enable' flag in config
- startable on runtime (atm not stoppable and no reconfigure)
- rename xbmc to kodi

* remove unnecceasry checks for kodi

* make kodichecker stoppable and add reconfigure

* tune config
This commit is contained in:
redPanther 2016-07-10 22:04:31 +02:00 committed by brindosch
parent d4635bba4e
commit 3ac0781c1f
19 changed files with 385 additions and 338 deletions

View File

@ -29,13 +29,13 @@
/// The configuration contains a list of color-transforms. Each transform contains the /// The configuration contains a list of color-transforms. Each transform contains the
/// following fields: /// following fields:
/// * 'channelAdjustment' /// * 'channelAdjustment'
/// * 'id' : The unique identifier of the channel adjustments (eg 'device_1') /// * 'id' : The unique identifier of the channel adjustments (eg 'device_1')
/// * 'leds' : The indices (or index ranges) of the leds to which this channel adjustment applies /// * 'leds' : The indices (or index ranges) of the leds to which this channel adjustment applies
/// (eg '0-5, 9, 11, 12-17'). The indices are zero based. /// (eg '0-5, 9, 11, 12-17'). The indices are zero based.
/// * 'pureRed'/'pureGreen'/'pureBlue' : The manipulation in the Red-Green-Blue color domain with the /// * 'pureRed'/'pureGreen'/'pureBlue' : The manipulation in the Red-Green-Blue color domain with the
/// following tuning parameters for each channel: /// following tuning parameters for each channel:
/// * 'temperature' /// * 'temperature'
/// * 'id' : The unique identifier of the temperature (eg 'device_1') /// * 'id' : The unique identifier of the temperature (eg 'device_1')
/// * 'leds' : The indices (or index ranges) of the leds to which this temperature applies /// * 'leds' : The indices (or index ranges) of the leds to which this temperature applies
/// (eg '0-5, 9, 11, 12-17'). The indices are zero based. /// (eg '0-5, 9, 11, 12-17'). The indices are zero based.
/// * 'red'/'green'/'blue' : The temperature manipulation in the Red-Green-Blue color domain with the /// * 'red'/'green'/'blue' : The temperature manipulation in the Red-Green-Blue color domain with the
@ -141,7 +141,7 @@
}, },
/// Configuration for the embedded V4L2 grabber /// Configuration for the embedded V4L2 grabber
/// * enable : Enable or disable the v4lgrabber (true/false) /// * enable : Enable or disable the v4lgrabber (true/false)
/// * device : V4L2 Device to use [default="/dev/video0"] /// * device : V4L2 Device to use [default="/dev/video0"]
/// * input : V4L2 input to use [default=0] /// * input : V4L2 input to use [default=0]
/// * standard : Video standard (no-change/PAL/NTSC) [default="no-change"] /// * standard : Video standard (no-change/PAL/NTSC) [default="no-change"]
@ -185,12 +185,12 @@
/// * frequency_Hz : The frequency of the frame grab [Hz] /// * frequency_Hz : The frequency of the frame grab [Hz]
/// * priority : The priority of the frame-gabber (Default=890) HINT: lower value result in HIGHER priority! /// * priority : The priority of the frame-gabber (Default=890) HINT: lower value result in HIGHER priority!
/// * ATTENTION : Power-of-Two resolution is not supported and leads to unexpected behaviour! /// * ATTENTION : Power-of-Two resolution is not supported and leads to unexpected behaviour!
"framegrabber" : "framegrabber" :
{ {
"width" : 64, "width" : 64,
"height" : 64, "height" : 64,
"frequency_Hz" : 10.0, "frequency_Hz" : 10.0,
"priority" : 890 "priority" : 890
}, },
/// The black border configuration, contains the following items: /// The black border configuration, contains the following items:
@ -203,18 +203,19 @@
/// * mode : Border detection mode (values=default,classic,osd) /// * mode : Border detection mode (values=default,classic,osd)
"blackborderdetector" : "blackborderdetector" :
{ {
"enable" : true, "enable" : true,
"threshold" : 0.0, "threshold" : 0.0,
"unknownFrameCnt" : 600, "unknownFrameCnt" : 600,
"borderFrameCnt" : 50, "borderFrameCnt" : 50,
"maxInconsistentCnt" : 10, "maxInconsistentCnt" : 10,
"blurRemoveCnt" : 1, "blurRemoveCnt" : 1,
"mode" : "default" "mode" : "default"
}, },
/// The configuration of the Kodi connection used to enable and disable the frame-grabber. Contains the following fields: /// The configuration of the Kodi connection used to enable and disable the frame-grabber. Contains the following fields:
/// * xbmcAddress : The IP address of the Kodi-host /// * enable : enable/disable Kodi-Checker
/// * xbmcTcpPort : The TCP-port of the Kodi-server /// * kodiAddress : The IP address of the Kodi-host
/// * kodiTcpPort : The TCP-port of the Kodi-server
/// * grabVideo : Flag indicating that the frame-grabber is on(true) during video playback /// * grabVideo : Flag indicating that the frame-grabber is on(true) during video playback
/// * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show /// * grabPictures : Flag indicating that the frame-grabber is on(true) during picture show
/// * grabAudio : Flag indicating that the frame-grabber is on(true) during audio playback /// * grabAudio : Flag indicating that the frame-grabber is on(true) during audio playback
@ -222,49 +223,50 @@
/// * grabPause : Flag indicating that the frame-grabber is on(true) at player state "pause" /// * grabPause : Flag indicating that the frame-grabber is on(true) at player state "pause"
/// * grabScreensaver : Flag indicating that the frame-grabber is on(true) when Kodi is on screensaver /// * grabScreensaver : Flag indicating that the frame-grabber is on(true) when Kodi is on screensaver
/// * enable3DDetection : Flag indicating that the frame-grabber should switch to a 3D compatible modus if a 3D video is playing /// * enable3DDetection : Flag indicating that the frame-grabber should switch to a 3D compatible modus if a 3D video is playing
"xbmcVideoChecker" : "kodiVideoChecker" :
{ {
"xbmcAddress" : "127.0.0.1", "enable" : true,
"xbmcTcpPort" : 9090, "kodiAddress" : "127.0.0.1",
"grabVideo" : true, "kodiTcpPort" : 9090,
"grabPictures" : true, "grabVideo" : true,
"grabAudio" : true, "grabPictures" : true,
"grabMenu" : false, "grabAudio" : true,
"grabPause" : false, "grabMenu" : false,
"grabScreensaver" : true, "grabPause" : false,
"enable3DDetection" : true "grabScreensaver" : true,
}, "enable3DDetection" : true
},
/// Initial Effect sets a "booteffect" or "color" (foreground-effect) and optional set a "effect" or "color" during inactive grabbers and network receivers (background-effect) /// Initial Effect sets a "booteffect" or "color" (foreground-effect) and optional set a "effect" or "color" during inactive grabbers and network receivers (background-effect)
/// * background-effect : 2 options: set a effect (example: "Rainbow swirl fast") or set a color (RGB) (example: [255,134,0]) /// * background-effect : 2 options: set a effect (example: "Rainbow swirl fast") or set a color (RGB) (example: [255,134,0])
/// * background-effect-args : Set optional effect arguments (Have a look at the select effect to get the possible values) /// * background-effect-args : Set optional effect arguments (Have a look at the select effect to get the possible values)
/// * foreground-effect : 2 options: set a effect (example: "Rainbow swirl fast") or set a color (RGB) (example: [255,134,0]) /// * foreground-effect : 2 options: set a effect (example: "Rainbow swirl fast") or set a color (RGB) (example: [255,134,0])
/// * foreground-effect-args : Set optional effect arguments (Have a look at the select effect to get the possible values) /// * foreground-effect-args : Set optional effect arguments (Have a look at the select effect to get the possible values)
/// * foreground-duration_ms : The duration of the selected foreground-effect or color (0=endless) /// * foreground-duration_ms : The duration of the selected foreground-effect or color (0=endless)
/// HINT: "foreground-effect" starts always with priority 0, so it blocks all remotes and grabbers if the loop is endless /// HINT: "foreground-effect" starts always with priority 0, so it blocks all remotes and grabbers if the loop is endless
/// HINT: Set a empty value if you want to disable a component (example: "") /// HINT: Set a empty value if you want to disable a component (example: "")
"initialEffect" : "initialEffect" :
{ {
"background-effect" : "Full color mood blobs", "background-effect" : "Full color mood blobs",
"background-effect-args" : {}, "background-effect-args" : {},
"foreground-effect" : "Rainbow swirl fast", "foreground-effect" : "Rainbow swirl fast",
"foreground-effect-args" : {}, "foreground-effect-args" : {},
"foreground-duration_ms" : 3000 "foreground-duration_ms" : 3000
}, },
/// The configuration of the Json/Proto forwarder. Forward messages to multiple instances of Hyperion on same and/or other hosts /// The configuration of the Json/Proto forwarder. Forward messages to multiple instances of Hyperion on same and/or other hosts
/// 'proto' is mostly used for video streams and 'json' for effects /// 'proto' is mostly used for video streams and 'json' for effects
/// * enable : Enable or disable the forwarder (true/false) /// * enable : Enable or disable the forwarder (true/false)
/// * proto : Proto server adress and port of your target. Syntax:[IP:PORT] -> ["127.0.0.1:19447"] or more instances to forward ["127.0.0.1:19447","192.168.0.24:19449"] /// * proto : Proto server adress and port of your target. Syntax:[IP:PORT] -> ["127.0.0.1:19447"] or more instances to forward ["127.0.0.1:19447","192.168.0.24:19449"]
/// * json : Json server adress and port of your target. Syntax:[IP:PORT] -> ["127.0.0.1:19446"] or more instances to forward ["127.0.0.1:19446","192.168.0.24:19448"] /// * json : Json server adress and port of your target. Syntax:[IP:PORT] -> ["127.0.0.1:19446"] or more instances to forward ["127.0.0.1:19446","192.168.0.24:19448"]
/// HINT:If you redirect to "127.0.0.1" (localhost) you could start a second hyperion with another device/led config! /// HINT:If you redirect to "127.0.0.1" (localhost) you could start a second hyperion with another device/led config!
/// Be sure your client(s) is/are listening on the configured ports. The second Hyperion (if used) also needs to be configured! (HyperCon -> External -> Json Server/Proto Server) /// Be sure your client(s) is/are listening on the configured ports. The second Hyperion (if used) also needs to be configured! (HyperCon -> External -> Json Server/Proto Server)
"forwarder" : "forwarder" :
{ {
"enable" : false, "enable" : false,
"proto" : ["127.0.0.1:19447"], "proto" : ["127.0.0.1:19447"],
"json" : ["127.0.0.1:19446"] "json" : ["127.0.0.1:19446"]
}, },
/// The configuration of the Json server which enables the json remote interface /// The configuration of the Json server which enables the json remote interface
/// * port : Port at which the json server is started /// * port : Port at which the json server is started
@ -281,31 +283,31 @@
}, },
/// The configuration of the boblight server which enables the boblight remote interface /// The configuration of the boblight server which enables the boblight remote interface
/// * enable : Enable or disable the boblight server (true/false) /// * enable : Enable or disable the boblight server (true/false)
/// * port : Port at which the boblight server is started /// * port : Port at which the boblight server is started
/// * priority : Priority of the boblight server (Default=800) HINT: lower value result in HIGHER priority! /// * priority : Priority of the boblight server (Default=800) HINT: lower value result in HIGHER priority!
"boblightServer" : "boblightServer" :
{ {
"enable" : false, "enable" : false,
"port" : 19333, "port" : 19333,
"priority" : 800 "priority" : 800
}, },
/// The configuration of the udp listener /// The configuration of the udp listener
/// * enable : Enable or disable the udp listener (true/false) /// * enable : Enable or disable the udp listener (true/false)
/// * address : The listener address, pre configured is multicast which listen also to unicast ip addresses at the same time. If emtpy, multicast is disabled and it also accepts unicast from all IPs /// * address : The listener address, pre configured is multicast which listen also to unicast ip addresses at the same time. If emtpy, multicast is disabled and it also accepts unicast from all IPs
/// * port : Port at which the udp listener starts /// * port : Port at which the udp listener starts
/// * priority : Priority of the udp lstener server (Default=800) /// * priority : Priority of the udp lstener server (Default=800)
/// * timeout : The timeout sets the timelimit for a "soft" off of the udp listener, if no packages are received (for example to switch to a gabber or InitialEffect - background-effect) /// * timeout : The timeout sets the timelimit for a "soft" off of the udp listener, if no packages are received (for example to switch to a gabber or InitialEffect - background-effect)
/// * shared : If true, the udp listener is shared across all hyperion instances (if using more than one (forwarder)) /// * shared : If true, the udp listener is shared across all hyperion instances (if using more than one (forwarder))
"udpListener" : "udpListener" :
{ {
"enable" : false, "enable" : false,
"address" : "239.255.28.01", "address" : "239.255.28.01",
"port" : 2801, "port" : 2801,
"priority" : 800, "priority" : 800,
"timeout" : 10000, "timeout" : 10000,
"shared" : false "shared" : false
}, },
/// Configuration of the Hyperion webserver /// Configuration of the Hyperion webserver
@ -314,9 +316,9 @@
/// * port : the port where hyperion webapp is accasible /// * port : the port where hyperion webapp is accasible
"webConfig" : "webConfig" :
{ {
"enable" : true, "enable" : true,
"document_root" : "/usr/share/hyperion/webconfig", "document_root" : "/usr/share/hyperion/webconfig",
"port" : 8099 "port" : 8099
}, },
/// The configuration of the effect engine, contains the following items: /// The configuration of the effect engine, contains the following items:

View File

@ -9,7 +9,7 @@
"name" : "DefaultHyperionConfig", "name" : "DefaultHyperionConfig",
"type" : "file", "type" : "file",
"output" : "/dev/null", "output" : "/dev/null",
"rate" : 1000000, "rate" : 1000000,
"colorOrder" : "rgb" "colorOrder" : "rgb"
}, },
@ -22,21 +22,21 @@
"leds" : "*", "leds" : "*",
"pureRed" : "pureRed" :
{ {
"redChannel" : 255, "redChannel" : 255,
"greenChannel" : 0, "greenChannel" : 0,
"blueChannel" : 0 "blueChannel" : 0
}, },
"pureGreen" : "pureGreen" :
{ {
"redChannel" : 0, "redChannel" : 0,
"greenChannel" : 255, "greenChannel" : 255,
"blueChannel" : 0 "blueChannel" : 0
}, },
"pureBlue" : "pureBlue" :
{ {
"redChannel" : 0, "redChannel" : 0,
"greenChannel" : 0, "greenChannel" : 0,
"blueChannel" : 255 "blueChannel" : 255
} }
} }
], ],
@ -47,9 +47,9 @@
"leds" : "*", "leds" : "*",
"correctionValues" : "correctionValues" :
{ {
"red" : 255, "red" : 255,
"green" : 255, "green" : 255,
"blue" : 255 "blue" : 255
} }
} }
], ],
@ -60,24 +60,24 @@
"leds" : "*", "leds" : "*",
"hsl" : "hsl" :
{ {
"saturationGain" : 1.0000, "saturationGain" : 1.0000,
"luminanceGain" : 1.0000, "luminanceGain" : 1.0000,
"luminanceMinimum" : 0.0000 "luminanceMinimum" : 0.0000
}, },
"red" : "red" :
{ {
"threshold" : 0.0000, "threshold" : 0.0000,
"gamma" : 2.5000 "gamma" : 2.5000
}, },
"green" : "green" :
{ {
"threshold" : 0.0000, "threshold" : 0.0000,
"gamma" : 2.5000 "gamma" : 2.5000
}, },
"blue" : "blue" :
{ {
"threshold" : 0.0000, "threshold" : 0.0000,
"gamma" : 2.5000 "gamma" : 2.5000
} }
} }
], ],
@ -90,28 +90,28 @@
} }
}, },
"grabber-v4l2" : "grabber-v4l2" :
{ {
"enable" : false, "enable" : false,
"device" : "/dev/video0", "device" : "/dev/video0",
"input" : 0, "input" : 0,
"standard" : "PAL", "standard" : "PAL",
"width" : -1, "width" : -1,
"height" : -1, "height" : -1,
"frameDecimation" : 2, "frameDecimation" : 2,
"sizeDecimation" : 8, "sizeDecimation" : 8,
"priority" : 900, "priority" : 900,
"mode" : "2D", "mode" : "2D",
"cropLeft" : 15, "cropLeft" : 15,
"cropRight" : 12, "cropRight" : 12,
"cropTop" : 5, "cropTop" : 5,
"cropBottom" : 5, "cropBottom" : 5,
"redSignalThreshold" : 0.0, "redSignalThreshold" : 0.0,
"greenSignalThreshold" : 0.0, "greenSignalThreshold" : 0.0,
"blueSignalThreshold" : 0.0 "blueSignalThreshold" : 0.0
}, },
"framegrabber" : "framegrabber" :
{ {
"width" : 128, "width" : 128,
"height" : 128, "height" : 128,
@ -119,86 +119,87 @@
"priority" : 890 "priority" : 890
}, },
"blackborderdetector" : "blackborderdetector" :
{ {
"enable" : true, "enable" : true,
"threshold" : 0.0, "threshold" : 0.0,
"mode" : "default" "mode" : "default"
}, },
"xbmcVideoChecker" : "kodiVideoChecker" :
{ {
"xbmcAddress" : "localhost", "enable" : true,
"xbmcTcpPort" : 9090, "kodiAddress" : "localhost",
"grabVideo" : true, "kodiTcpPort" : 9090,
"grabPictures" : true, "grabVideo" : true,
"grabAudio" : true, "grabPictures" : true,
"grabMenu" : false, "grabAudio" : true,
"grabPause" : false, "grabMenu" : false,
"grabScreensaver" : true, "grabPause" : false,
"grabScreensaver" : true,
"enable3DDetection" : true "enable3DDetection" : true
}, },
"initialEffect" : "initialEffect" :
{ {
"background-effect" : "Full color mood blobs", "background-effect" : "Full color mood blobs",
"background-effect-args" : {}, "background-effect-args" : {},
"foreground-effect" : "Rainbow swirl fast", "foreground-effect" : "Rainbow swirl fast",
"foreground-effect-args" : {}, "foreground-effect-args" : {},
"foreground-duration_ms" : 3000 "foreground-duration_ms" : 3000
}, },
"forwarder" : "forwarder" :
{ {
"enable" : false, "enable" : false,
"json" : ["127.0.0.1:19446"], "json" : ["127.0.0.1:19446"],
"proto" : ["127.0.0.1:19447"] "proto" : ["127.0.0.1:19447"]
}, },
"jsonServer" : "jsonServer" :
{ {
"port" : 19444 "port" : 19444
}, },
"protoServer" : "protoServer" :
{ {
"port" : 19445 "port" : 19445
}, },
"boblightServer" : "boblightServer" :
{ {
"enable" : false, "enable" : false,
"port" : 19333, "port" : 19333,
"priority" : 800 "priority" : 800
}, },
"udpListener" : "udpListener" :
{ {
"enable" : false, "enable" : false,
"address" : "239.255.28.01", "address" : "239.255.28.01",
"port" : 2801, "port" : 2801,
"priority" : 800, "priority" : 800,
"timeout" : 10000, "timeout" : 10000,
"shared" : false "shared" : false
}, },
"webConfig" : "webConfig" :
{ {
"enable" : true, "enable" : true,
"document_root" : "/usr/share/hyperion/webconfig", "document_root" : "/usr/share/hyperion/webconfig",
"port" : 8099 "port" : 8099
}, },
"effects" : "effects" :
{ {
"paths" : "paths" :
[ [
"/storage/hyperion/effects", "/storage/hyperion/effects",
"/usr/share/hyperion/effects" "/usr/share/hyperion/effects"
] ]
}, },
"leds" : "leds" :
[ [
{ {
"index" : 0, "index" : 0,

View File

@ -17,26 +17,36 @@
// Utils includes // Utils includes
#include <utils/GrabbingMode.h> #include <utils/GrabbingMode.h>
#include <utils/VideoMode.h> #include <utils/VideoMode.h>
#include <utils/Logger.h>
/// ///
/// This class will check if XBMC is playing something. When it does not, this class will send all black data to Hyperion. /// This class will check if KODI 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. /// This allows grabbed screen data to be overriden while in the KODI menus.
/// ///
/// Note: The json TCP server needs to be enabled manually in XBMC in System/Settings/Network/Services /// Note: The json TCP server needs to be enabled manually in KODI in System/Settings/Network/Services
/// ///
class XBMCVideoChecker : public QObject class KODIVideoChecker : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static XBMCVideoChecker* initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection); static KODIVideoChecker* initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
static XBMCVideoChecker* getInstance(); static KODIVideoChecker* getInstance();
~KODIVideoChecker();
void setConfig(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
public slots:
/// ///
/// Start polling XBMC /// Start polling KODI
/// ///
void start(); void start();
///
/// Stop polling KODI
///
void stop();
signals: signals:
/// Signal emitted when the grabbing mode changes /// Signal emitted when the grabbing mode changes
void grabbingMode(GrabbingMode grabbingMode); void grabbingMode(GrabbingMode grabbingMode);
@ -45,16 +55,16 @@ signals:
void videoMode(VideoMode videoMode); void videoMode(VideoMode videoMode);
private slots: private slots:
/// Receive a reply from XBMC /// Receive a reply from KODI
void receiveReply(); void receiveReply();
/// Called when connected to XBMC /// Called when connected to KODI
void connected(); void connected();
/// Called when disconnected from XBMC /// Called when disconnected from KODI
void disconnected(); void disconnected();
/// reconnect to XBMC /// reconnect to KODI
void reconnect(); void reconnect();
/// Called when a connection error was encountered /// Called when a connection error was encountered
@ -64,16 +74,16 @@ private:
/// ///
/// Constructor /// Constructor
/// ///
/// @param address Network address of the XBMC instance /// @param address Network address of the KODI instance
/// @param port Port number to use (XBMC default = 9090) /// @param port Port number to use (KODI default = 9090)
/// @param grabVideo Whether or not to grab when the XBMC video player is playing /// @param grabVideo Whether or not to grab when the KODI video player is playing
/// @param grabPhoto Whether or not to grab when the XBMC photo player is playing /// @param grabPhoto Whether or not to grab when the KODI photo player is playing
/// @param grabAudio Whether or not to grab when the XBMC audio player is playing /// @param grabAudio Whether or not to grab when the KODI audio player is playing
/// @param grabMenu Whether or not to grab when nothing is playing (in XBMC menu) /// @param grabMenu Whether or not to grab when nothing is playing (in KODI menu)
/// @param grabScreensaver Whether or not to grab when the XBMC screensaver is activated /// @param grabScreensaver Whether or not to grab when the KODI screensaver is activated
/// @param enable3DDetection Wheter or not to enable the detection of 3D movies playing /// @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 grabPause, bool grabScreensaver, bool enable3DDetection); KODIVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection);
/// Set the grabbing mode /// Set the grabbing mode
void setGrabbingMode(GrabbingMode grabbingMode); void setGrabbingMode(GrabbingMode grabbingMode);
@ -84,11 +94,11 @@ private:
void setVideoMode(VideoMode videoMode); void setVideoMode(VideoMode videoMode);
private: private:
/// The network address of the XBMC instance /// The network address of the KODI instance
const QString _address; QString _address;
/// The port number of XBMC /// The port number of KODI
const uint16_t _port; uint16_t _port;
/// The JSON-RPC message to check the active player /// The JSON-RPC message to check the active player
const QString _activePlayerRequest; const QString _activePlayerRequest;
@ -102,34 +112,34 @@ private:
/// The JSON-RPC message to check the active stereoscopicmode /// The JSON-RPC message to check the active stereoscopicmode
const QString _getStereoscopicMode; const QString _getStereoscopicMode;
/// The JSON-RPC message to check the xbmc version /// The JSON-RPC message to check the kodi version
const QString _getXbmcVersion; QString _getKodiVersion;
/// The QT TCP Socket with connection to XBMC /// The QT TCP Socket with connection to KODI
QTcpSocket _socket; QTcpSocket _socket;
/// Flag indicating whether or not to grab when the XBMC video player is playing /// Flag indicating whether or not to grab when the KODI video player is playing
const bool _grabVideo; bool _grabVideo;
/// Flag indicating whether or not to grab when the XBMC photo player is playing /// Flag indicating whether or not to grab when the KODI photo player is playing
const bool _grabPhoto; bool _grabPhoto;
/// Flag indicating whether or not to grab when the XBMC audio player is playing /// Flag indicating whether or not to grab when the KODI audio player is playing
const bool _grabAudio; bool _grabAudio;
/// Flag indicating whether or not to grab when XBMC is playing nothing (in menu) /// Flag indicating whether or not to grab when KODI is playing nothing (in menu)
const bool _grabMenu; bool _grabMenu;
/// Flag indicating whether or not to grab when the XBMC videoplayer is at pause state /// Flag indicating whether or not to grab when the KODI videoplayer is at pause state
const bool _grabPause; bool _grabPause;
/// Flag indicating whether or not to grab when the XBMC screensaver is activated /// Flag indicating whether or not to grab when the KODI screensaver is activated
const bool _grabScreensaver; bool _grabScreensaver;
/// Flag indicating wheter or not to enable the detection of 3D movies playing /// Flag indicating wheter or not to enable the detection of 3D movies playing
const bool _enable3DDetection; bool _enable3DDetection;
/// Flag indicating if XBMC is on screensaver /// Flag indicating if KODI is on screensaver
bool _previousScreensaverMode; bool _previousScreensaverMode;
/// Previous emitted grab mode /// Previous emitted grab mode
@ -138,8 +148,14 @@ private:
/// Previous emitted video mode /// Previous emitted video mode
VideoMode _previousVideoMode; VideoMode _previousVideoMode;
/// XBMC version number /// KODI version number
int _xbmcVersion; int _kodiVersion;
/// Logger Instance
Logger * _log;
static XBMCVideoChecker* _kodichecker; /// flag indicating state
bool _active;
static KODIVideoChecker* _kodichecker;
}; };

View File

@ -92,7 +92,7 @@ private slots:
signals: signals:
/// ///
/// XBMC Video Checker Message /// KODI Video Checker Message
/// ///
void setGrabbingMode(const GrabbingMode mode); void setGrabbingMode(const GrabbingMode mode);
void setVideoMode(const VideoMode videoMode); void setVideoMode(const VideoMode videoMode);

View File

@ -21,7 +21,7 @@ public:
signals: signals:
/// ///
/// Forwarding XBMC Video Checker Message /// Forwarding KODI Video Checker Message
/// ///
void setGrabbingMode(const GrabbingMode mode); void setGrabbingMode(const GrabbingMode mode);
void setVideoMode(const VideoMode videoMode); void setVideoMode(const VideoMode videoMode);

View File

@ -54,7 +54,7 @@ public slots:
signals: signals:
/// ///
/// Forwarding XBMC Checker /// Forwarding KODI Checker
/// ///
void grabbingMode(const GrabbingMode mode); void grabbingMode(const GrabbingMode mode);
void videoMode(const VideoMode VideoMode); void videoMode(const VideoMode VideoMode);

View File

@ -12,7 +12,7 @@ add_subdirectory(boblightserver)
add_subdirectory(udplistener) add_subdirectory(udplistener)
add_subdirectory(leddevice) add_subdirectory(leddevice)
add_subdirectory(utils) add_subdirectory(utils)
add_subdirectory(xbmcvideochecker) add_subdirectory(kodivideochecker)
add_subdirectory(effectengine) add_subdirectory(effectengine)
add_subdirectory(grabber) add_subdirectory(grabber)
add_subdirectory(webconfig) add_subdirectory(webconfig)

View File

@ -227,16 +227,16 @@
}, },
"additionalProperties" : false "additionalProperties" : false
}, },
"xbmcVideoChecker" : "kodiVideoChecker" :
{ {
"type" : "object", "type" : "object",
"required" : false, "required" : false,
"properties" : { "properties" : {
"xbmcAddress" : { "kodiAddress" : {
"type" : "string", "type" : "string",
"required" : true "required" : true
}, },
"xbmcTcpPort" : { "kodiTcpPort" : {
"type" : "integer", "type" : "integer",
"required" : true "required" : true
}, },

View File

@ -259,16 +259,16 @@
}, },
"additionalProperties" : false "additionalProperties" : false
}, },
"xbmcVideoChecker" : "kodiVideoChecker" :
{ {
"type" : "object", "type" : "object",
"required" : false, "required" : false,
"properties" : { "properties" : {
"xbmcAddress" : { "kodiAddress" : {
"type" : "string", "type" : "string",
"required" : true "required" : true
}, },
"xbmcTcpPort" : { "kodiTcpPort" : {
"type" : "integer", "type" : "integer",
"required" : true "required" : true
}, },

View File

@ -0,0 +1,29 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/kodivideochecker)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/kodivideochecker)
# Group the headers that go through the MOC compiler
SET(KODIVideoChecker_QT_HEADERS
${CURRENT_HEADER_DIR}/KODIVideoChecker.h
)
SET(KODIVideoChecker_HEADERS
)
SET(KODIVideoChecker_SOURCES
${CURRENT_SOURCE_DIR}/KODIVideoChecker.cpp
)
QT5_WRAP_CPP(KODIVideoChecker_HEADERS_MOC ${KODIVideoChecker_QT_HEADERS})
add_library(kodivideochecker
${KODIVideoChecker_HEADERS}
${KODIVideoChecker_QT_HEADERS}
${KODIVideoChecker_HEADERS_MOC}
${KODIVideoChecker_SOURCES}
)
target_link_libraries(kodivideochecker
hyperion
${QT_LIBRARIES})

View File

@ -3,23 +3,23 @@
#include <QRegExp> #include <QRegExp>
#include <QStringRef> #include <QStringRef>
#include <xbmcvideochecker/XBMCVideoChecker.h> #include <kodivideochecker/KODIVideoChecker.h>
XBMCVideoChecker* XBMCVideoChecker::_kodichecker = nullptr; KODIVideoChecker* KODIVideoChecker::_kodichecker = nullptr;
XBMCVideoChecker* XBMCVideoChecker::initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection) KODIVideoChecker* KODIVideoChecker::initInstance(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
{ {
if ( XBMCVideoChecker::_kodichecker != nullptr ) if ( KODIVideoChecker::_kodichecker != nullptr )
throw std::runtime_error("XBMCVideoChecker::initInstance can be called only one time"); throw std::runtime_error("KODIVideoChecker::initInstance can be called only one time");
XBMCVideoChecker::_kodichecker = new XBMCVideoChecker(address, port, grabVideo, grabPhoto, grabAudio, grabMenu, grabPause, grabScreensaver, enable3DDetection); KODIVideoChecker::_kodichecker = new KODIVideoChecker(address, port, grabVideo, grabPhoto, grabAudio, grabMenu, grabPause, grabScreensaver, enable3DDetection);
return XBMCVideoChecker::_kodichecker; return KODIVideoChecker::_kodichecker;
} }
XBMCVideoChecker* XBMCVideoChecker::getInstance() KODIVideoChecker* KODIVideoChecker::getInstance()
{ {
return XBMCVideoChecker::_kodichecker; return KODIVideoChecker::_kodichecker;
} }
@ -39,27 +39,29 @@ XBMCVideoChecker* XBMCVideoChecker::getInstance()
// {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669} // {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669}
// {"id":669,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}} // {"id":669,"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 grabPause, bool grabScreensaver, bool enable3DDetection) : KODIVideoChecker::KODIVideoChecker(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
QObject(), : QObject()
_address(QString::fromStdString(address)), , _address(QString::fromStdString(address))
_port(port), , _port(port)
_activePlayerRequest(R"({"jsonrpc":"2.0","method":"Player.GetActivePlayers", "id":666})"), , _activePlayerRequest(R"({"jsonrpc":"2.0","method":"Player.GetActivePlayers", "id":666})")
_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":669})"), , _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":670})"), , _getKodiVersion(R"({"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":670})")
_socket(), , _socket()
_grabVideo(grabVideo), , _grabVideo(grabVideo)
_grabPhoto(grabPhoto), , _grabPhoto(grabPhoto)
_grabAudio(grabAudio), , _grabAudio(grabAudio)
_grabMenu(grabMenu), , _grabMenu(grabMenu)
_grabPause(grabPause), , _grabPause(grabPause)
_grabScreensaver(grabScreensaver), , _grabScreensaver(grabScreensaver)
_enable3DDetection(enable3DDetection), , _enable3DDetection(enable3DDetection)
_previousScreensaverMode(false), , _previousScreensaverMode(false)
_previousGrabbingMode(GRABBINGMODE_INVALID), , _previousGrabbingMode(GRABBINGMODE_INVALID)
_previousVideoMode(VIDEO_2D), , _previousVideoMode(VIDEO_2D)
_xbmcVersion(0) , _kodiVersion(0)
, _log(Logger::getInstance("KODI"))
, _active(false)
{ {
// setup socket // setup socket
connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply())); connect(&_socket, SIGNAL(readyRead()), this, SLOT(receiveReply()));
@ -68,17 +70,56 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
connect(&_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectionError(QAbstractSocket::SocketError))); connect(&_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectionError(QAbstractSocket::SocketError)));
} }
void XBMCVideoChecker::start() KODIVideoChecker::~KODIVideoChecker()
{ {
stop();
}
void KODIVideoChecker::setConfig(const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabPause, bool grabScreensaver, bool enable3DDetection)
{
_address = QString::fromStdString(address);
_port = port;
_grabVideo = grabVideo;
_grabPhoto = grabPhoto;
_grabAudio = grabAudio;
_grabMenu = grabMenu;
_grabPause = grabPause;
_grabScreensaver = grabScreensaver;
_enable3DDetection = enable3DDetection;
_previousScreensaverMode = false;
_previousGrabbingMode = GRABBINGMODE_INVALID;
_previousVideoMode = VIDEO_2D;
_kodiVersion = 0;
// restart if active
if (_active)
{
stop();
QTimer::singleShot(2000, this, SLOT(()));
}
}
void KODIVideoChecker::start()
{
Info(_log, "started");
_active = true;
reconnect(); reconnect();
} }
void XBMCVideoChecker::receiveReply() void KODIVideoChecker::stop()
{
Info(_log, "stopped");
_active = false;
_socket.close();
}
void KODIVideoChecker::receiveReply()
{ {
// expect that the reply is received as a single message. Probably oke considering the size of the expected reply // expect that the reply is received as a single message. Probably oke considering the size of the expected reply
QString reply(_socket.readAll()); QString reply(_socket.readAll());
// silence - no "debug" code should be at the log Debug(_log, "message: %s", reply.toStdString().c_str());
// std::cout << "KODICHECK INFO: Kodi Message: " << reply.toStdString() << std::endl;
if (reply.contains("\"method\":\"Player.OnPlay\"")) if (reply.contains("\"method\":\"Player.OnPlay\""))
{ {
@ -147,7 +188,7 @@ void XBMCVideoChecker::receiveReply()
} }
else if (reply.contains("\"id\":667")) else if (reply.contains("\"id\":667"))
{ {
if (_xbmcVersion >= 13) if (_kodiVersion >= 13)
{ {
// check of active stereoscopicmode // check of active stereoscopicmode
_socket.write(_getStereoscopicMode.toUtf8()); _socket.write(_getStereoscopicMode.toUtf8());
@ -182,12 +223,12 @@ void XBMCVideoChecker::receiveReply()
bool active = reply.contains("\"System.ScreenSaverActive\":true"); bool active = reply.contains("\"System.ScreenSaverActive\":true");
setScreensaverMode(!_grabScreensaver && active); setScreensaverMode(!_grabScreensaver && active);
// check here xbmc version // check here kodi version
if (_socket.state() == QTcpSocket::ConnectedState) if (_socket.state() == QTcpSocket::ConnectedState)
{ {
if (_xbmcVersion == 0) if (_kodiVersion == 0)
{ {
_socket.write(_getXbmcVersion.toUtf8()); _socket.write(_getKodiVersion.toUtf8());
} }
} }
} }
@ -214,7 +255,7 @@ void XBMCVideoChecker::receiveReply()
int pos = regex.indexIn(reply); int pos = regex.indexIn(reply);
if (pos > 0) if (pos > 0)
{ {
_xbmcVersion = regex.cap(1).toInt(); _kodiVersion = regex.cap(1).toInt();
} }
} }
else if (reply.contains("picture") && reply.contains("\"method\":\"Playlist.OnAdd\"")) else if (reply.contains("picture") && reply.contains("\"method\":\"Playlist.OnAdd\""))
@ -224,33 +265,34 @@ void XBMCVideoChecker::receiveReply()
} }
} }
void XBMCVideoChecker::connected() void KODIVideoChecker::connected()
{ {
std::cout << "KODICHECK INFO: Kodi Connected" << std::endl; Info(_log, "Connected");
// send a request for the current player state // send a request for the current player state
_socket.write(_activePlayerRequest.toUtf8()); _socket.write(_activePlayerRequest.toUtf8());
_socket.write(_checkScreensaverRequest.toUtf8()); _socket.write(_checkScreensaverRequest.toUtf8());
} }
void XBMCVideoChecker::disconnected() void KODIVideoChecker::disconnected()
{ {
std::cout << "KODICHECK INFO: Kodi Disconnected" << std::endl; Info(_log, "Disconnected");
reconnect(); reconnect();
} }
void XBMCVideoChecker::reconnect() void KODIVideoChecker::reconnect()
{ {
if (_socket.state() == QTcpSocket::ConnectedState) if (_socket.state() == QTcpSocket::ConnectedState || ! _active )
{ {
return; return;
} }
Debug(_log, "try reconnect");
// try to connect // try to connect
switch (_socket.state()) switch (_socket.state())
{ {
case QTcpSocket::ConnectingState: case QTcpSocket::ConnectingState:
// Somehow when XBMC restarts we get stuck in connecting state // Somehow when KODI restarts we get stuck in connecting state
// If we get here we tried to connect already for 5 seconds. abort and try again in 1 second. // If we get here we tried to connect already for 5 seconds. abort and try again in 1 second.
_socket.reset(); _socket.reset();
_socket.waitForDisconnected(50); _socket.waitForDisconnected(50);
@ -266,15 +308,15 @@ void XBMCVideoChecker::reconnect()
} }
} }
void XBMCVideoChecker::connectionError(QAbstractSocket::SocketError error) void KODIVideoChecker::connectionError(QAbstractSocket::SocketError error)
{ {
std::cout << "KODICHECK ERROR: Kodi Connection error (" << error << ")" << std::endl; Error(_log,"Connection error (%s)", error);
// close the socket // close the socket
_socket.close(); _socket.close();
} }
void XBMCVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode) void KODIVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode)
{ {
if (newGrabbingMode == _previousGrabbingMode) if (newGrabbingMode == _previousGrabbingMode)
{ {
@ -285,25 +327,25 @@ void XBMCVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode)
switch (newGrabbingMode) switch (newGrabbingMode)
{ {
case GRABBINGMODE_VIDEO: case GRABBINGMODE_VIDEO:
std::cout << "KODICHECK INFO: switching to VIDEO mode" << std::endl; Info(_log, "switching to VIDEO mode");
break; break;
case GRABBINGMODE_PHOTO: case GRABBINGMODE_PHOTO:
std::cout << "KODICHECK INFO: switching to PHOTO mode" << std::endl; Info(_log, "switching to PHOTO mode");
break; break;
case GRABBINGMODE_AUDIO: case GRABBINGMODE_AUDIO:
std::cout << "KODICHECK INFO: switching to AUDIO mode" << std::endl; Info(_log, "switching to AUDIO mode");
break; break;
case GRABBINGMODE_MENU: case GRABBINGMODE_MENU:
std::cout << "KODICHECK INFO: switching to MENU mode" << std::endl; Info(_log, "switching to MENU mode");
break; break;
case GRABBINGMODE_PAUSE: case GRABBINGMODE_PAUSE:
std::cout << "KODICHECK INFO: switching to PAUSE mode" << std::endl; Info(_log, "switching to PAUSE mode");
break; break;
case GRABBINGMODE_OFF: case GRABBINGMODE_OFF:
std::cout << "KODICHECK INFO: switching to OFF mode" << std::endl; Info(_log, "switching to OFF mode");
break; break;
case GRABBINGMODE_INVALID: default:
std::cout << "KODICHECK INFO: switching to INVALID mode" << std::endl; Warning(_log, "switching to INVALID mode");
break; break;
} }
@ -315,7 +357,7 @@ void XBMCVideoChecker::setGrabbingMode(GrabbingMode newGrabbingMode)
_previousGrabbingMode = newGrabbingMode; _previousGrabbingMode = newGrabbingMode;
} }
void XBMCVideoChecker::setScreensaverMode(bool isOnScreensaver) void KODIVideoChecker::setScreensaverMode(bool isOnScreensaver)
{ {
if (isOnScreensaver == _previousScreensaverMode) if (isOnScreensaver == _previousScreensaverMode)
{ {
@ -327,7 +369,7 @@ void XBMCVideoChecker::setScreensaverMode(bool isOnScreensaver)
_previousScreensaverMode = isOnScreensaver; _previousScreensaverMode = isOnScreensaver;
} }
void XBMCVideoChecker::setVideoMode(VideoMode newVideoMode) void KODIVideoChecker::setVideoMode(VideoMode newVideoMode)
{ {
if (newVideoMode == _previousVideoMode) if (newVideoMode == _previousVideoMode)
{ {
@ -338,13 +380,13 @@ void XBMCVideoChecker::setVideoMode(VideoMode newVideoMode)
switch (newVideoMode) switch (newVideoMode)
{ {
case VIDEO_2D: case VIDEO_2D:
std::cout << "KODICHECK INFO: switching to 2D mode" << std::endl; Info(_log, "KODICHECK INFO: switching to 2D mode");
break; break;
case VIDEO_3DSBS: case VIDEO_3DSBS:
std::cout << "KODICHECK INFO: switching to 3D SBS mode" << std::endl; Info(_log, "KODICHECK INFO: switching to 3D SBS mode");
break; break;
case VIDEO_3DTAB: case VIDEO_3DTAB:
std::cout << "KODICHECK INFO: switching to 3D TAB mode" << std::endl; Info(_log, "KODICHECK INFO: switching to 3D TAB mode");
break; break;
} }

View File

@ -43,7 +43,7 @@ public:
public slots: public slots:
/// ///
/// Send XBMC Video Checker message to connected client /// Send KODI Video Checker message to connected client
/// ///
void setGrabbingMode(const GrabbingMode mode); void setGrabbingMode(const GrabbingMode mode);
void setVideoMode(const VideoMode videoMode); void setVideoMode(const VideoMode videoMode);

View File

@ -65,7 +65,7 @@ void ProtoServer::newConnection()
connect(connection, SIGNAL(connectionClosed(ProtoClientConnection*)), this, SLOT(closedConnection(ProtoClientConnection*))); connect(connection, SIGNAL(connectionClosed(ProtoClientConnection*)), this, SLOT(closedConnection(ProtoClientConnection*)));
connect(connection, SIGNAL(newMessage(const proto::HyperionRequest*)), this, SLOT(newMessage(const proto::HyperionRequest*))); connect(connection, SIGNAL(newMessage(const proto::HyperionRequest*)), this, SLOT(newMessage(const proto::HyperionRequest*)));
// register forward signal for xbmc checker // register forward signal for kodi checker
connect(this, SIGNAL(grabbingMode(GrabbingMode)), connection, SLOT(setGrabbingMode(GrabbingMode))); connect(this, SIGNAL(grabbingMode(GrabbingMode)), connection, SLOT(setGrabbingMode(GrabbingMode)));
connect(this, SIGNAL(videoMode(VideoMode)), connection, SLOT(setVideoMode(VideoMode))); connect(this, SIGNAL(videoMode(VideoMode)), connection, SLOT(setVideoMode(VideoMode)));

View File

@ -76,9 +76,9 @@ message HyperionReply {
// string indicating the reason for failure (if applicable) // string indicating the reason for failure (if applicable)
optional string error = 3; optional string error = 3;
// XBMC Video Checker Proto Messages for Grabbing mode // KODI Video Checker Proto Messages for Grabbing mode
optional int32 grabbing = 4; optional int32 grabbing = 4;
// XBMC Video Checker Proto Messages for Video mode // KODI Video Checker Proto Messages for Video mode
optional int32 video = 5; optional int32 video = 5;
} }

View File

@ -1,29 +0,0 @@
# Define the current source locations
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/xbmcvideochecker)
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/xbmcvideochecker)
# Group the headers that go through the MOC compiler
SET(XBMCVideoChecker_QT_HEADERS
${CURRENT_HEADER_DIR}/XBMCVideoChecker.h
)
SET(XBMCVideoChecker_HEADERS
)
SET(XBMCVideoChecker_SOURCES
${CURRENT_SOURCE_DIR}/XBMCVideoChecker.cpp
)
QT5_WRAP_CPP(XBMCVideoChecker_HEADERS_MOC ${XBMCVideoChecker_QT_HEADERS})
add_library(xbmcvideochecker
${XBMCVideoChecker_HEADERS}
${XBMCVideoChecker_QT_HEADERS}
${XBMCVideoChecker_HEADERS_MOC}
${XBMCVideoChecker_SOURCES}
)
target_link_libraries(xbmcvideochecker
hyperion
${QT_LIBRARIES})

View File

@ -104,7 +104,7 @@ int main(int argc, char ** argv)
// Connect the screen capturing to the proto processing // Connect the screen capturing to the proto processing
QObject::connect(&x11Wrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>))); QObject::connect(&x11Wrapper, SIGNAL(sig_screenshot(const Image<ColorRgb> &)), &protoWrapper, SLOT(receiveImage(Image<ColorRgb>)));
// Connect the XBMC Video Checker to the proto processing // Connect the KODI Video Checker to the proto processing
QObject::connect(&protoWrapper, SIGNAL(setGrabbingMode(GrabbingMode)), &x11Wrapper, SLOT(setGrabbingMode(GrabbingMode))); QObject::connect(&protoWrapper, SIGNAL(setGrabbingMode(GrabbingMode)), &x11Wrapper, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(&protoWrapper, SIGNAL(setVideoMode(VideoMode)), &x11Wrapper, SLOT(setVideoMode(VideoMode))); QObject::connect(&protoWrapper, SIGNAL(setVideoMode(VideoMode)), &x11Wrapper, SLOT(setVideoMode(VideoMode)));

View File

@ -5,7 +5,7 @@ add_executable(hyperiond
target_link_libraries(hyperiond target_link_libraries(hyperiond
getoptPlusPlus getoptPlusPlus
hyperion hyperion
xbmcvideochecker kodivideochecker
effectengine effectengine
jsonserver jsonserver
boblightserver boblightserver

View File

@ -29,7 +29,7 @@
HyperionDaemon::HyperionDaemon(std::string configFile, QObject *parent) HyperionDaemon::HyperionDaemon(std::string configFile, QObject *parent)
: QObject(parent) : QObject(parent)
, _log(Logger::getInstance("MAIN")) , _log(Logger::getInstance("MAIN"))
, _xbmcVideoChecker(nullptr) , _kodiVideoChecker(nullptr)
, _jsonServer(nullptr) , _jsonServer(nullptr)
, _protoServer(nullptr) , _protoServer(nullptr)
, _boblightServer(nullptr) , _boblightServer(nullptr)
@ -73,7 +73,7 @@ HyperionDaemon::~HyperionDaemon()
delete _fbGrabber; delete _fbGrabber;
delete _osxGrabber; delete _osxGrabber;
delete _v4l2Grabber; delete _v4l2Grabber;
delete _xbmcVideoChecker; delete _kodiVideoChecker;
delete _jsonServer; delete _jsonServer;
delete _protoServer; delete _protoServer;
delete _boblightServer; delete _boblightServer;
@ -85,7 +85,7 @@ HyperionDaemon::~HyperionDaemon()
void HyperionDaemon::run() void HyperionDaemon::run()
{ {
startInitialEffect(); startInitialEffect();
createXBMCVideoChecker(); createKODIVideoChecker();
// ---- network services ----- // ---- network services -----
startNetworkServices(); startNetworkServices();
@ -193,31 +193,33 @@ void HyperionDaemon::startInitialEffect()
} }
// create XBMC video checker if the _configuration is present // create KODI video checker if the _configuration is present
void HyperionDaemon::createXBMCVideoChecker() void HyperionDaemon::createKODIVideoChecker()
{ {
if (_config.isMember("xbmcVideoChecker")) bool kodiCheckerConfigured = _config.isMember("kodiVideoChecker");
{
const Json::Value & videoCheckerConfig = _config["xbmcVideoChecker"];
_xbmcVideoChecker = XBMCVideoChecker::initInstance(
videoCheckerConfig["xbmcAddress"].asString(),
videoCheckerConfig["xbmcTcpPort"].asUInt(),
videoCheckerConfig["grabVideo"].asBool(),
videoCheckerConfig["grabPictures"].asBool(),
videoCheckerConfig["grabAudio"].asBool(),
videoCheckerConfig["grabMenu"].asBool(),
videoCheckerConfig.get("grabPause", true).asBool(),
videoCheckerConfig.get("grabScreensaver", true).asBool(),
videoCheckerConfig.get("enable3DDetection", true).asBool());
_xbmcVideoChecker->start(); const Json::Value & videoCheckerConfig = _config["kodiVideoChecker"];
Info(_log, "Kodi checker created and started"); _kodiVideoChecker = KODIVideoChecker::initInstance(
videoCheckerConfig.get("kodiAddress","127.0.0.1").asString(),
videoCheckerConfig.get("kodiTcpPort",9090).asUInt(),
videoCheckerConfig.get("grabVideo",true).asBool(),
videoCheckerConfig.get("grabPictures",true).asBool(),
videoCheckerConfig.get("grabAudio",true).asBool(),
videoCheckerConfig.get("grabMenu",false).asBool(),
videoCheckerConfig.get("grabPause", true).asBool(),
videoCheckerConfig.get("grabScreensaver", false).asBool(),
videoCheckerConfig.get("enable3DDetection", true).asBool());
Debug(_log, "KODI checker created ");
if( kodiCheckerConfigured && videoCheckerConfig.get("enable", true).asBool() )
{
_kodiVideoChecker->start();
} }
} }
void HyperionDaemon::startNetworkServices() void HyperionDaemon::startNetworkServices()
{ {
XBMCVideoChecker* xbmcVideoChecker = XBMCVideoChecker::getInstance(); KODIVideoChecker* kodiVideoChecker = KODIVideoChecker::getInstance();
// Create Json server if configuration is present // Create Json server if configuration is present
unsigned int jsonPort = 19444; unsigned int jsonPort = 19444;
@ -241,10 +243,10 @@ void HyperionDaemon::startNetworkServices()
} }
_protoServer = new ProtoServer(protoPort ); _protoServer = new ProtoServer(protoPort );
if (xbmcVideoChecker != nullptr) if (kodiVideoChecker != nullptr)
{ {
QObject::connect(xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _protoServer, SIGNAL(grabbingMode(GrabbingMode))); QObject::connect(kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _protoServer, SIGNAL(grabbingMode(GrabbingMode)));
QObject::connect(xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _protoServer, SIGNAL(videoMode(VideoMode))); QObject::connect(kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _protoServer, SIGNAL(videoMode(VideoMode)));
} }
Info(_log, "Proto server created and started on port %d", _protoServer->getPort()); Info(_log, "Proto server created and started on port %d", _protoServer->getPort());
@ -335,12 +337,8 @@ void HyperionDaemon::createGrabberDispmanx()
frameGrabberConfig.get("cropTop", 0).asInt(), frameGrabberConfig.get("cropTop", 0).asInt(),
frameGrabberConfig.get("cropBottom", 0).asInt()); frameGrabberConfig.get("cropBottom", 0).asInt());
if (_xbmcVideoChecker != nullptr) QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _dispmanx, SLOT(setGrabbingMode(GrabbingMode)));
{ QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _dispmanx, SLOT(setVideoMode(VideoMode)));
QObject::connect(_xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _dispmanx, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _dispmanx, SLOT(setVideoMode(VideoMode)));
}
QObject::connect(_dispmanx, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) ); QObject::connect(_dispmanx, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
_dispmanx->start(); _dispmanx->start();
@ -405,12 +403,8 @@ void HyperionDaemon::createGrabberAmlogic()
grabberConfig["frequency_Hz"].asUInt(), grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt()); grabberConfig.get("priority",900).asInt());
if (_xbmcVideoChecker != nullptr) QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _amlGrabber, SLOT(setGrabbingMode(GrabbingMode)));
{ QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _amlGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _amlGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _amlGrabber, SLOT(setVideoMode(VideoMode)));
}
QObject::connect(_amlGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) ); QObject::connect(_amlGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
_amlGrabber->start(); _amlGrabber->start();
@ -436,12 +430,8 @@ void HyperionDaemon::createGrabberFramebuffer()
grabberConfig["frequency_Hz"].asUInt(), grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt()); grabberConfig.get("priority",900).asInt());
if (_xbmcVideoChecker != nullptr) QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _fbGrabber, SLOT(setGrabbingMode(GrabbingMode)));
{ QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _fbGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _fbGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _fbGrabber, SLOT(setVideoMode(VideoMode)));
}
QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) ); QObject::connect(_fbGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
_fbGrabber->start(); _fbGrabber->start();
@ -467,12 +457,8 @@ void HyperionDaemon::createGrabberOsx()
grabberConfig["frequency_Hz"].asUInt(), grabberConfig["frequency_Hz"].asUInt(),
grabberConfig.get("priority",900).asInt()); grabberConfig.get("priority",900).asInt());
if (_xbmcVideoChecker != nullptr) QObject::connect(_kodiVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _osxGrabber, SLOT(setGrabbingMode(GrabbingMode)));
{ QObject::connect(_kodiVideoChecker, SIGNAL(videoMode(VideoMode)), _osxGrabber, SLOT(setVideoMode(VideoMode)));
QObject::connect(_xbmcVideoChecker, SIGNAL(grabbingMode(GrabbingMode)), _osxGrabber, SLOT(setGrabbingMode(GrabbingMode)));
QObject::connect(_xbmcVideoChecker, SIGNAL(videoMode(VideoMode)), _osxGrabber, SLOT(setVideoMode(VideoMode)));
}
QObject::connect(_osxGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) ); QObject::connect(_osxGrabber, SIGNAL(emitImage(int, const Image<ColorRgb>&, const int)), _protoServer, SLOT(sendImageToProtoSlaves(int, const Image<ColorRgb>&, const int)) );
_osxGrabber->start(); _osxGrabber->start();

View File

@ -34,7 +34,7 @@
#include <utils/Logger.h> #include <utils/Logger.h>
#include <xbmcvideochecker/XBMCVideoChecker.h> #include <kodivideochecker/KODIVideoChecker.h>
#include <jsonserver/JsonServer.h> #include <jsonserver/JsonServer.h>
#include <protoserver/ProtoServer.h> #include <protoserver/ProtoServer.h>
#include <boblightserver/BoblightServer.h> #include <boblightserver/BoblightServer.h>
@ -51,7 +51,7 @@ public:
void run(); void run();
void startInitialEffect(); void startInitialEffect();
void createXBMCVideoChecker(); void createKODIVideoChecker();
void startNetworkServices(); void startNetworkServices();
// grabber creators // grabber creators
@ -64,7 +64,7 @@ public:
private: private:
Logger* _log; Logger* _log;
Json::Value _config; Json::Value _config;
XBMCVideoChecker* _xbmcVideoChecker; KODIVideoChecker* _kodiVideoChecker;
JsonServer* _jsonServer; JsonServer* _jsonServer;
ProtoServer* _protoServer; ProtoServer* _protoServer;
BoblightServer* _boblightServer; BoblightServer* _boblightServer;