Fix CEC build problems

This commit is contained in:
Iwan Timmer 2015-08-09 15:40:23 +02:00
parent 86a9eb2233
commit dc83e8c9a1
3 changed files with 15 additions and 5 deletions

View File

@ -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()

View File

@ -18,8 +18,19 @@
*/
#ifdef HAVE_LIBCEC
#include "limelight-common/Limelight.h"
#include <ceccloader.h>
#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;

View File

@ -17,4 +17,4 @@
* along with Moonlight; if not, see <http://www.gnu.org/licenses/>.
*/
void init_cec();
void cec_init();