[kodi] Add patch for libcec 4.0 support

Michael Cronenworth mooninite at rpmfusion.org
Tue Nov 1 14:46:48 CET 2016


commit cfb759c7bbe68b5e89e22b43e6e6ecae04fdb1e5
Author: Michael Cronenworth <mike at cchtml.com>
Date:   Tue Nov 1 08:46:36 2016 -0500

    Add patch for libcec 4.0 support

 kodi-17b5-libcec4.patch | 468 ++++++++++++++++++++++++++++++++++++++++++++++++
 kodi.spec               |  20 ++-
 2 files changed, 486 insertions(+), 2 deletions(-)
---
diff --git a/kodi-17b5-libcec4.patch b/kodi-17b5-libcec4.patch
new file mode 100644
index 0000000..18a7476
--- /dev/null
+++ b/kodi-17b5-libcec4.patch
@@ -0,0 +1,468 @@
+From e2e1ba73de53e0f64baa2edc6a45263c0eb72f0b Mon Sep 17 00:00:00 2001
+From: Lars Op den Kamp <lars at opdenkamp.eu>
+Date: Tue, 25 Oct 2016 19:15:46 +0200
+Subject: [PATCH] bump to libCEC 4.0.0
+
+---
+ configure.ac                                      |   4 +-
+ xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 192 ++++++++++------------
+ xbmc/peripherals/devices/PeripheralCecAdapter.h   |  17 +-
+ 3 files changed, 97 insertions(+), 116 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 149c8f1..158f1ef 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1453,9 +1453,9 @@ if test "x$use_libcec" != "xno"; then
+   # libcec is dyloaded, so we need to check for its headers and link any depends.
+   if test "x$use_libcec" != "xno"; then
+     if test "x$use_libcec" != "xauto"; then
+-      PKG_CHECK_MODULES([CEC],[libcec >= 3.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)])
++      PKG_CHECK_MODULES([CEC],[libcec >= 4.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)])
+     else
+-      PKG_CHECK_MODULES([CEC],[libcec >= 3.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
++      PKG_CHECK_MODULES([CEC],[libcec >= 4.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
+     fi
+ 
+     if test "x$use_libcec" != "xno"; then
+diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+index 90ba0b1..314a8d6 100644
+--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+@@ -43,7 +43,7 @@ using namespace PERIPHERALS;
+ using namespace ANNOUNCEMENT;
+ using namespace CEC;
+ 
+-#define CEC_LIB_SUPPORTED_VERSION LIBCEC_VERSION_TO_UINT(3, 0, 0)
++#define CEC_LIB_SUPPORTED_VERSION LIBCEC_VERSION_TO_UINT(4, 0, 0)
+ 
+ /* time in seconds to ignore standby commands from devices after the screensaver has been activated */
+ #define SCREENSAVER_TIMEOUT       20
+@@ -119,25 +119,30 @@ void CPeripheralCecAdapter::ResetMembers(void)
+     m_dll->CECDestroy(m_cecAdapter);
+   m_cecAdapter               = NULL;
+   delete m_dll;
+-  m_dll                      = NULL;
+-  m_bStarted                 = false;
+-  m_bHasButton               = false;
+-  m_bIsReady                 = false;
+-  m_bHasConnectedAudioSystem = false;
+-  m_strMenuLanguage          = "???";
+-  m_lastKeypress             = 0;
+-  m_lastChange               = VOLUME_CHANGE_NONE;
+-  m_iExitCode                = EXITCODE_QUIT;
+-  m_bIsMuted                 = false; //! @todo fetch the correct initial value when system audiostatus is implemented in libCEC
+-  m_bGoingToStandby          = false;
+-  m_bIsRunning               = false;
+-  m_bDeviceRemoved           = false;
+-  m_bActiveSourcePending     = false;
+-  m_bStandbyPending          = false;
++  m_dll                        = NULL;
++  m_bStarted                   = false;
++  m_bHasButton                 = false;
++  m_bIsReady                   = false;
++  m_bHasConnectedAudioSystem   = false;
++  m_strMenuLanguage            = "???";
++  m_lastKeypress               = 0;
++  m_lastChange                 = VOLUME_CHANGE_NONE;
++  m_iExitCode                  = EXITCODE_QUIT;
++  m_bIsMuted                   = false; //! @todo fetch the correct initial value when system audiostatus is implemented in libCEC
++  m_bGoingToStandby            = false;
++  m_bIsRunning                 = false;
++  m_bDeviceRemoved             = false;
++  m_bActiveSourcePending       = false;
++  m_bStandbyPending            = false;
+   m_bActiveSourceBeforeStandby = false;
+-  m_bOnPlayReceived          = false;
+-  m_bPlaybackPaused          = false;
+-  m_queryThread              = NULL;
++  m_bOnPlayReceived            = false;
++  m_bPlaybackPaused            = false;
++  m_queryThread                = NULL;
++  m_bPowerOnScreensaver        = false;
++  m_bUseTVMenuLanguage         = false;
++  m_bSendInactiveSource        = false;
++  m_bPowerOffScreensaver       = false;
++  m_bShutdownOnStandby         = false;
+ 
+   m_currentButton.iButton    = 0;
+   m_currentButton.iDuration  = 0;
+@@ -166,8 +171,8 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
+       if (bIgnoreDeactivate)
+         CLog::Log(LOGDEBUG, "%s - ignoring OnScreensaverDeactivated for power action", __FUNCTION__);
+     }
+-    if (m_configuration.bPowerOnScreensaver == 1 && !bIgnoreDeactivate &&
+-        m_configuration.bActivateSource == 1)
++    if (m_bPowerOnScreensaver && !bIgnoreDeactivate &&
++        m_configuration.bActivateSource)
+     {
+       ActivateSource();
+     }
+@@ -175,7 +180,7 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
+   else if (flag == GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverActivated") && m_bIsReady)
+   {
+     // Don't put devices to standby if application is currently playing
+-    if (!g_application.m_pPlayer->IsPlaying() && m_configuration.bPowerOffScreensaver == 1)
++    if (!g_application.m_pPlayer->IsPlaying() && m_bPowerOffScreensaver)
+     {
+       // only power off when we're the active source
+       if (m_cecAdapter->IsLibCECActiveSource())
+@@ -278,14 +283,14 @@ bool CPeripheralCecAdapter::InitialiseFeature(const PeripheralFeature feature)
+ 
+     SetConfigurationFromSettings();
+     m_callbacks.Clear();
+-    m_callbacks.CBCecLogMessage           = &CecLogMessage;
+-    m_callbacks.CBCecKeyPress             = &CecKeyPress;
+-    m_callbacks.CBCecCommand              = &CecCommand;
+-    m_callbacks.CBCecConfigurationChanged = &CecConfiguration;
+-    m_callbacks.CBCecAlert                = &CecAlert;
+-    m_callbacks.CBCecSourceActivated      = &CecSourceActivated;
+-    m_configuration.callbackParam         = this;
+-    m_configuration.callbacks             = &m_callbacks;
++    m_callbacks.logMessage           = &CecLogMessage;
++    m_callbacks.keyPress             = &CecKeyPress;
++    m_callbacks.commandReceived      = &CecCommand;
++    m_callbacks.configurationChanged = &CecConfiguration;
++    m_callbacks.alert                = &CecAlert;
++    m_callbacks.sourceActivated      = &CecSourceActivated;
++    m_configuration.callbackParam    = this;
++    m_configuration.callbacks        = &m_callbacks;
+ 
+     m_dll = new DllLibCEC;
+     if (m_dll->Load() && m_dll->IsLoaded())
+@@ -451,7 +456,7 @@ void CPeripheralCecAdapter::Process(void)
+         m_standbySent = CDateTime::GetCurrentDateTime();
+         m_cecAdapter->StandbyDevices();
+       }
+-      else if (m_configuration.bSendInactiveSource == 1)
++      else if (m_bSendInactiveSource)
+       {
+         CLog::Log(LOGDEBUG, "%s - sending inactive source commands", __FUNCTION__);
+         m_cecAdapter->SetInactiveView();
+@@ -651,43 +656,43 @@ void CPeripheralCecAdapter::SetMenuLanguage(const char *strLanguage)
+     CLog::Log(LOGWARNING, "%s - TV menu language set to unknown value '%s'", __FUNCTION__, strLanguage);
+ }
+ 
+-int CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command command)
++void CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command* command)
+ {
+-  CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
++  CPeripheralCecAdapter *adapter = static_cast<CPeripheralCecAdapter *>(cbParam);
+   if (!adapter)
+-    return 0;
++    return;
+ 
+   if (adapter->m_bIsReady)
+   {
+-    switch (command.opcode)
++    switch (command->opcode)
+     {
+     case CEC_OPCODE_STANDBY:
+       /* a device was put in standby mode */
+-      if (command.initiator == CECDEVICE_TV &&
+-          (adapter->m_configuration.bPowerOffOnStandby == 1 || adapter->m_configuration.bShutdownOnStandby == 1) &&
++      if (command->initiator == CECDEVICE_TV &&
++          (adapter->m_configuration.bPowerOffOnStandby == 1 || adapter->m_bShutdownOnStandby) &&
+           (!adapter->m_standbySent.IsValid() || CDateTime::GetCurrentDateTime() - adapter->m_standbySent > CDateTimeSpan(0, 0, 0, SCREENSAVER_TIMEOUT)))
+       {
+         adapter->m_bStarted = false;
+         if (adapter->m_configuration.bPowerOffOnStandby == 1)
+           g_application.ExecuteXBMCAction("Suspend");
+-        else if (adapter->m_configuration.bShutdownOnStandby == 1)
++        else if (adapter->m_bShutdownOnStandby)
+           g_application.ExecuteXBMCAction("Shutdown");
+       }
+       break;
+     case CEC_OPCODE_SET_MENU_LANGUAGE:
+-      if (adapter->m_configuration.bUseTVMenuLanguage == 1 && command.initiator == CECDEVICE_TV && command.parameters.size == 3)
++      if (adapter->m_bUseTVMenuLanguage == 1 && command->initiator == CECDEVICE_TV && command->parameters.size == 3)
+       {
+         char strNewLanguage[4];
+         for (int iPtr = 0; iPtr < 3; iPtr++)
+-          strNewLanguage[iPtr] = command.parameters[iPtr];
++          strNewLanguage[iPtr] = command->parameters[iPtr];
+         strNewLanguage[3] = 0;
+         adapter->SetMenuLanguage(strNewLanguage);
+       }
+       break;
+     case CEC_OPCODE_DECK_CONTROL:
+-      if (command.initiator == CECDEVICE_TV &&
+-          command.parameters.size == 1 &&
+-          command.parameters[0] == CEC_DECK_CONTROL_MODE_STOP)
++      if (command->initiator == CECDEVICE_TV &&
++          command->parameters.size == 1 &&
++          command->parameters[0] == CEC_DECK_CONTROL_MODE_STOP)
+       {
+         cec_keypress key;
+         key.duration = 500;
+@@ -696,17 +701,17 @@ int CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command command)
+       }
+       break;
+     case CEC_OPCODE_PLAY:
+-      if (command.initiator == CECDEVICE_TV &&
+-          command.parameters.size == 1)
++      if (command->initiator == CECDEVICE_TV &&
++          command->parameters.size == 1)
+       {
+-        if (command.parameters[0] == CEC_PLAY_MODE_PLAY_FORWARD)
++        if (command->parameters[0] == CEC_PLAY_MODE_PLAY_FORWARD)
+         {
+           cec_keypress key;
+           key.duration = 500;
+           key.keycode = CEC_USER_CONTROL_CODE_PLAY;
+           adapter->PushCecKeypress(key);
+         }
+-        else if (command.parameters[0] == CEC_PLAY_MODE_PLAY_STILL)
++        else if (command->parameters[0] == CEC_PLAY_MODE_PLAY_STILL)
+         {
+           cec_keypress key;
+           key.duration = 500;
+@@ -719,25 +724,23 @@ int CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command command)
+       break;
+     }
+   }
+-  return 1;
+ }
+ 
+-int CPeripheralCecAdapter::CecConfiguration(void *cbParam, const libcec_configuration config)
++void CPeripheralCecAdapter::CecConfiguration(void *cbParam, const libcec_configuration* config)
+ {
+-  CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
++  CPeripheralCecAdapter *adapter = static_cast<CPeripheralCecAdapter *>(cbParam);
+   if (!adapter)
+-    return 0;
++    return;
+ 
+   CSingleLock lock(adapter->m_critSection);
+-  adapter->SetConfigurationFromLibCEC(config);
+-  return 1;
++  adapter->SetConfigurationFromLibCEC(*config);
+ }
+ 
+-int CPeripheralCecAdapter::CecAlert(void *cbParam, const libcec_alert alert, const libcec_parameter data)
++void CPeripheralCecAdapter::CecAlert(void *cbParam, const libcec_alert alert, const libcec_parameter data)
+ {
+-  CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
++  CPeripheralCecAdapter *adapter = static_cast<CPeripheralCecAdapter *>(cbParam);
+   if (!adapter)
+-    return 0;
++    return;
+ 
+   bool bReopenConnection(false);
+   int iAlertString(0);
+@@ -780,18 +783,13 @@ int CPeripheralCecAdapter::CecAlert(void *cbParam, const libcec_alert alert, con
+     // calls this callback function synchronously and must not be destroyed meanwhile.
+     adapter->ReopenConnection(true);
+   }
+-
+-  return 1;
+ }
+ 
+-int CPeripheralCecAdapter::CecKeyPress(void *cbParam, const cec_keypress key)
++void CPeripheralCecAdapter::CecKeyPress(void *cbParam, const cec_keypress* key)
+ {
+-  CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
+-  if (!adapter)
+-    return 0;
+-
+-  adapter->PushCecKeypress(key);
+-  return 1;
++  CPeripheralCecAdapter *adapter = static_cast<CPeripheralCecAdapter *>(cbParam);
++  if (!!adapter)
++    adapter->PushCecKeypress(*key);
+ }
+ 
+ void CPeripheralCecAdapter::GetNextKey(void)
+@@ -1191,7 +1189,7 @@ void CPeripheralCecAdapter::OnSettingChanged(const std::string &strChangedSettin
+ 
+ void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_logical_address address, const uint8_t activated)
+ {
+-  CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
++  CPeripheralCecAdapter *adapter = static_cast<CPeripheralCecAdapter *>(cbParam);
+   if (!adapter)
+     return;
+ 
+@@ -1233,14 +1231,14 @@ void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_log
+   }
+ }
+ 
+-int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message message)
++void CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message* message)
+ {
+-  CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
++  CPeripheralCecAdapter *adapter = static_cast<CPeripheralCecAdapter *>(cbParam);
+   if (!adapter)
+-    return 0;
++    return;
+ 
+   int iLevel = -1;
+-  switch (message.level)
++  switch (message->level)
+   {
+   case CEC_LOG_ERROR:
+     iLevel = LOGERROR;
+@@ -1260,9 +1258,7 @@ int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message me
+   }
+ 
+   if (iLevel >= CEC_LOG_NOTICE || (iLevel >= 0 && CLog::IsLogLevelLogged(LOGDEBUG) && g_advancedSettings.CanLogComponent(LOGCEC)))
+-    CLog::Log(iLevel, "%s - %s", __FUNCTION__, message.message);
+-
+-  return 1;
++    CLog::Log(iLevel, "%s - %s", __FUNCTION__, message->message);
+ }
+ 
+ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configuration &config)
+@@ -1307,35 +1303,18 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu
+   bChanged |= WriteLogicalAddresses(config.powerOffDevices, "standby_devices", "standby_devices_advanced");
+ 
+   // set the boolean settings
+-  m_configuration.bUseTVMenuLanguage = config.bUseTVMenuLanguage;
+-  bChanged |= SetSetting("use_tv_menu_language", m_configuration.bUseTVMenuLanguage == 1);
+-
+   m_configuration.bActivateSource = config.bActivateSource;
+   bChanged |= SetSetting("activate_source", m_configuration.bActivateSource == 1);
+ 
+-  m_configuration.bPowerOffScreensaver = config.bPowerOffScreensaver;
+-  bChanged |= SetSetting("cec_standby_screensaver", m_configuration.bPowerOffScreensaver == 1);
+-
+-  m_configuration.bPowerOnScreensaver = config.bPowerOnScreensaver;
+-  bChanged |= SetSetting("cec_wake_screensaver", m_configuration.bPowerOnScreensaver == 1);
+-
+   m_configuration.bPowerOffOnStandby = config.bPowerOffOnStandby;
+ 
+-  m_configuration.bSendInactiveSource = config.bSendInactiveSource;
+-  bChanged |= SetSetting("send_inactive_source", m_configuration.bSendInactiveSource == 1);
+-
+   m_configuration.iFirmwareVersion = config.iFirmwareVersion;
+-  m_configuration.bShutdownOnStandby = config.bShutdownOnStandby;
+ 
+   memcpy(m_configuration.strDeviceLanguage, config.strDeviceLanguage, 3);
+   m_configuration.iFirmwareBuildDate = config.iFirmwareBuildDate;
+ 
+   SetVersionInfo(m_configuration);
+ 
+-  bChanged |= SetSetting("standby_pc_on_tv_standby",
+-             m_configuration.bPowerOffOnStandby == 1 ? 13011 :
+-             m_configuration.bShutdownOnStandby == 1 ? 13005 : 36028);
+-
+   if (bChanged)
+     CLog::Log(LOGDEBUG, "SetConfigurationFromLibCEC - settings updated by libCEC");
+ }
+@@ -1343,7 +1322,7 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu
+ void CPeripheralCecAdapter::SetConfigurationFromSettings(void)
+ {
+   // client version matches the version of libCEC that we originally used the API from
+-  m_configuration.clientVersion = LIBCEC_VERSION_TO_UINT(3, 0, 0);
++  m_configuration.clientVersion = LIBCEC_VERSION_TO_UINT(4, 0, 0);
+ 
+   // device name 'XBMC'
+   snprintf(m_configuration.strDeviceName, 13, "%s", GetSettingString("device_name").c_str());
+@@ -1410,16 +1389,16 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void)
+     ReadLogicalAddresses(GetSettingInt("standby_devices"), m_configuration.powerOffDevices);
+ 
+   // read the boolean settings
+-  m_configuration.bUseTVMenuLanguage   = GetSettingBool("use_tv_menu_language") ? 1 : 0;
++  m_bUseTVMenuLanguage                 = GetSettingBool("use_tv_menu_language") ? 1 : 0;
+   m_configuration.bActivateSource      = GetSettingBool("activate_source") ? 1 : 0;
+-  m_configuration.bPowerOffScreensaver = GetSettingBool("cec_standby_screensaver") ? 1 : 0;
+-  m_configuration.bPowerOnScreensaver  = GetSettingBool("cec_wake_screensaver") ? 1 : 0;
+-  m_configuration.bSendInactiveSource  = GetSettingBool("send_inactive_source") ? 1 : 0;
++  m_bPowerOffScreensaver               = GetSettingBool("cec_standby_screensaver") ? 1 : 0;
++  m_bPowerOnScreensaver                = GetSettingBool("cec_wake_screensaver") ? 1 : 0;
++  m_bSendInactiveSource                = GetSettingBool("send_inactive_source") ? 1 : 0;
+ 
+   // read the mutually exclusive boolean settings
+   int iStandbyAction(GetSettingInt("standby_pc_on_tv_standby"));
+   m_configuration.bPowerOffOnStandby = iStandbyAction == 13011 ? 1 : 0;
+-  m_configuration.bShutdownOnStandby = iStandbyAction == 13005 ? 1 : 0;
++  m_bShutdownOnStandby = iStandbyAction == 13005;
+ 
+ #if defined(CEC_DOUBLE_TAP_TIMEOUT_MS_OLD)
+   // double tap prevention timeout in ms. libCEC uses 50ms units for this in 2.2.0, so divide by 50
+@@ -1566,14 +1545,11 @@ bool CPeripheralCecAdapterUpdateThread::WaitReady(void)
+ void CPeripheralCecAdapterUpdateThread::UpdateMenuLanguage(void)
+ {
+   // request the menu language of the TV
+-  if (m_configuration.bUseTVMenuLanguage == 1)
++  if (m_adapter->m_bUseTVMenuLanguage == 1)
+   {
+     CLog::Log(LOGDEBUG, "%s - requesting the menu language of the TV", __FUNCTION__);
+-    cec_menu_language language;
+-    if (m_adapter->m_cecAdapter->GetDeviceMenuLanguage(CECDEVICE_TV, &language))
+-      m_adapter->SetMenuLanguage(language.language);
+-    else
+-      CLog::Log(LOGDEBUG, "%s - unknown menu language", __FUNCTION__);
++    std::string language(m_adapter->m_cecAdapter->GetDeviceMenuLanguage(CECDEVICE_TV));
++    m_adapter->SetMenuLanguage(language.c_str());
+   }
+   else
+   {
+@@ -1590,9 +1566,9 @@ std::string CPeripheralCecAdapterUpdateThread::UpdateAudioSystemStatus(void)
+   if (m_adapter->m_cecAdapter->IsActiveDeviceType(CEC_DEVICE_TYPE_AUDIO_SYSTEM))
+   {
+     // request the OSD name of the amp
+-    cec_osd_name ampName = m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_AUDIOSYSTEM);
+-    CLog::Log(LOGDEBUG, "%s - CEC capable amplifier found (%s). volume will be controlled on the amp", __FUNCTION__, ampName.name);
+-    strAmpName += StringUtils::Format("%s", ampName.name);
++    std::string ampName(m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_AUDIOSYSTEM));
++    CLog::Log(LOGDEBUG, "%s - CEC capable amplifier found (%s). volume will be controlled on the amp", __FUNCTION__, ampName.c_str());
++    strAmpName += StringUtils::Format("%s", ampName.c_str());
+ 
+     // set amp present
+     m_adapter->SetAudioSystemConnected(true);
+@@ -1629,8 +1605,8 @@ bool CPeripheralCecAdapterUpdateThread::SetInitialConfiguration(void)
+ 
+   // request the OSD name of the TV
+   std::string strNotification;
+-  cec_osd_name tvName = m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV);
+-  strNotification = StringUtils::Format("%s: %s", g_localizeStrings.Get(36016).c_str(), tvName.name);
++  std::string tvName(m_adapter->m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV));
++  strNotification = StringUtils::Format("%s: %s", g_localizeStrings.Get(36016).c_str(), tvName.c_str());
+ 
+   std::string strAmpName = UpdateAudioSystemStatus();
+   if (!strAmpName.empty())
+@@ -1803,7 +1779,7 @@ void CPeripheralCecAdapter::ProcessStandbyDevices(void)
+       m_standbySent = CDateTime::GetCurrentDateTime();
+       m_cecAdapter->StandbyDevices(CECDEVICE_BROADCAST);
+     }
+-    else if (m_configuration.bSendInactiveSource == 1)
++    else if (m_bSendInactiveSource == 1)
+     {
+       CLog::Log(LOGDEBUG, "%s - sending inactive source commands", __FUNCTION__);
+       m_cecAdapter->SetInactiveView();
+diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h
+index e7f769f..30b22c9 100644
+--- a/xbmc/peripherals/devices/PeripheralCecAdapter.h
++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h
+@@ -146,12 +146,12 @@ namespace PERIPHERALS
+     void SetMenuLanguage(const char *strLanguage);
+ 
+     // callbacks from libCEC
+-    static int CecLogMessage(void *cbParam, const CEC::cec_log_message message);
+-    static int CecCommand(void *cbParam, const CEC::cec_command command);
+-    static int CecConfiguration(void *cbParam, const CEC::libcec_configuration config);
+-    static int CecAlert(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter data);
++    static void CecLogMessage(void *cbParam, const CEC::cec_log_message* message);
++    static void CecCommand(void *cbParam, const CEC::cec_command* command);
++    static void CecConfiguration(void *cbParam, const CEC::libcec_configuration* config);
++    static void CecAlert(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter data);
+     static void CecSourceActivated(void *param, const CEC::cec_logical_address address, const uint8_t activated);
+-    static int CecKeyPress(void *cbParam, const CEC::cec_keypress key);
++    static void CecKeyPress(void *cbParam, const CEC::cec_keypress* key);
+ 
+     DllLibCEC*                        m_dll;
+     CEC::ICECAdapter*                 m_cecAdapter;
+@@ -181,7 +181,12 @@ namespace PERIPHERALS
+     bool                              m_bActiveSourceBeforeStandby;
+     bool                              m_bOnPlayReceived;
+     bool                              m_bPlaybackPaused;
+-    std::string                        m_strComPort;
++    std::string                       m_strComPort;
++    bool                              m_bPowerOnScreensaver;
++    bool                              m_bUseTVMenuLanguage;
++    bool                              m_bSendInactiveSource;
++    bool                              m_bPowerOffScreensaver;
++    bool                              m_bShutdownOnStandby;
+   };
+ 
+   class CPeripheralCecAdapterUpdateThread : public CThread
diff --git a/kodi.spec b/kodi.spec
index 297ce1e..e6f29c8 100644
--- a/kodi.spec
+++ b/kodi.spec
@@ -38,6 +38,10 @@ Patch1: kodi-16.0-versioning.patch
 # Drop DVD library support
 Patch2: kodi-17a2-libdvd.patch
 
+# Libcec 4.0 support
+# https://github.com/popcornmix/xbmc/commit/e2e1ba73de53e0f64baa2edc6a45263c0eb72f0b.patch
+Patch3: kodi-17b5-libcec4.patch
+
 # Optional deps (not in EPEL)
 %if 0%{?fedora}
 # (libbluray in EPEL 6 is too old.)
@@ -105,7 +109,11 @@ BuildRequires: libbluray-devel
 BuildRequires: libcap-devel
 BuildRequires: libcdio-devel
 %if 0%{?_with_libcec}
-BuildRequires: libcec-devel >= 3.0.0
+%if 0%{?fedora} > 25
+BuildRequires: libcec-devel >= 4.0.0
+%else
+BuildRequires: libcec-devel < 4.0.0
+%endif
 %endif
 %if 0%{?_with_crystalhd}
 BuildRequires: libcrystalhd-devel
@@ -183,7 +191,11 @@ Requires: dejavu-sans-fonts
 Requires: libbluray%{?_isa}
 %endif
 %if 0%{?_with_libcec}
-Requires: libcec%{?_isa} >= 3.0.0
+%if 0%{?fedora} > 25
+Requires: libcec%{?_isa} >= 4.0.0
+%else
+Requires: libcec%{?_isa} < 4.0.0
+%endif
 %endif
 %if 0%{?_with_crystalhd}
 Requires: libcrystalhd%{?_isa}
@@ -247,6 +259,9 @@ library.
 %setup -q -n %{name}-%{DIRVERSION}
 %patch1 -p1 -b.versioning
 %patch2 -p1 -b.libdvd
+%if 0%{?fedora} > 25
+%patch3 -p1 -b.libcec4
+%endif
 %if 0%{?_with_dvd}
 cp -p %{SOURCE2} tools/depends/target/libdvdnav/libdvdnav-master.tar.gz
 cp -p %{SOURCE3} tools/depends/target/libdvdread/libdvdread-master.tar.gz
@@ -402,6 +417,7 @@ fi
 %changelog
 * Mon Oct 31 2016 Michael Cronenworth <mike at cchtml.com> - 17.0-0.8
 - Kodi 17 beta 5
+- Include patch for libcec 4.0 support
 
 * Mon Oct 10 2016 Michael Cronenworth <mike at cchtml.com> - 17.0-0.7
 - Kodi 17 beta 3


More information about the rpmfusion-commits mailing list