From dc83e8c9a1be55cc81d08846b9d98d232b273b32 Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Sun, 9 Aug 2015 15:40:23 +0200 Subject: [PATCH] Fix CEC build problems --- CMakeLists.txt | 3 +-- src/input/cec.c | 15 +++++++++++++-- src/input/cec.h | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e52ad5f..953b190 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,6 @@ pkg_check_modules(AVUTIL libavutil) pkg_check_modules(SWSCALE libswscale) if(CEC_FOUND) - include_directories(./third_party/libcec) list(APPEND MOONLIGHT_DEFINITIONS HAVE_LIBCEC) endif() @@ -69,7 +68,7 @@ set_property(TARGET moonlight PROPERTY C_STANDARD 11) if (CEC_FOUND) list(APPEND MOONLIGHT_DEFINITIONS HAVE_LIBCEC) - target_include_directories(moonlight PRIVATE ./third_party/libcec ${CEC_INCLUDE_DIRS}) + target_include_directories(moonlight PRIVATE ./third_party/libcec ${CEC_INCLUDE_DIRS}/libcec) target_link_libraries (moonlight PUBLIC ${CEC_LIBRARIES}) endif() diff --git a/src/input/cec.c b/src/input/cec.c index 7ae4dd9..854a0e2 100644 --- a/src/input/cec.c +++ b/src/input/cec.c @@ -18,8 +18,19 @@ */ #ifdef HAVE_LIBCEC + +#include "limelight-common/Limelight.h" + #include +#define KEY_LEFT 0x25 +#define KEY_UP 0x26 +#define KEY_RIGHT 0x27 +#define KEY_DOWN 0x28 +#define KEY_ENTER 0x0D +#define KEY_TAB 0x09 +#define KEY_ESC 0x1B + static libcec_configuration g_config; static char g_strPort[50] = { 0 }; static libcec_interface_t g_iface; @@ -57,12 +68,12 @@ static int on_cec_keypress(void* userdata, const cec_keypress key) { } if (value != 0) { - short code = 0x80 << 8 | keyCodes[value]; + short code = 0x80 << 8 | value; LiSendKeyboardEvent(code, (key.duration > 0)?KEY_ACTION_UP:KEY_ACTION_DOWN, 0); } } -void init_cec() { +void cec_init() { libcecc_reset_configuration(&g_config); g_config.clientVersion = LIBCEC_VERSION_CURRENT; g_config.bActivateSource = 0; diff --git a/src/input/cec.h b/src/input/cec.h index 298ca44..61663de 100644 --- a/src/input/cec.h +++ b/src/input/cec.h @@ -17,4 +17,4 @@ * along with Moonlight; if not, see . */ -void init_cec(); \ No newline at end of file +void cec_init();