diff options
author | Lars Op den Kamp <lars@opdenkamp.eu> | 2012-02-27 22:13:45 +0100 |
---|---|---|
committer | Lars Op den Kamp <lars@opdenkamp.eu> | 2012-03-27 16:05:14 +0200 |
commit | 689be59469fc316404a063ea98e4758c97c077d0 (patch) | |
tree | 8653b9829d672134720cddf0d585beccf66e8200 | |
parent | 53be108df7455cb872ddeac56c2992fce09cffd9 (diff) |
cec: don't send standby or inactive source messages when rebooting
-rw-r--r-- | xbmc/Application.cpp | 3 | ||||
-rw-r--r-- | xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 28 | ||||
-rw-r--r-- | xbmc/peripherals/devices/PeripheralCecAdapter.h | 1 |
3 files changed, 25 insertions, 7 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 4aa0c233fa..4bc71ee1a2 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -3308,7 +3308,8 @@ void CApplication::Stop(int exitCode) { try { - CAnnouncementManager::Announce(System, "xbmc", "OnQuit"); + CVariant vExitCode(exitCode); + CAnnouncementManager::Announce(System, "xbmc", "OnQuit", vExitCode); // cancel any jobs from the jobmanager CJobManager::GetInstance().CancelJobs(); diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp index 658a9ea30b..6c129ee7ff 100644 --- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp @@ -33,6 +33,7 @@ #include "settings/GUISettings.h" #include "settings/Settings.h" #include "utils/log.h" +#include "utils/Variant.h" #include <libcec/cec.h> @@ -77,7 +78,8 @@ CPeripheralCecAdapter::CPeripheralCecAdapter(const PeripheralType type, const Pe m_bHasConnectedAudioSystem(false), m_strMenuLanguage("???"), m_lastKeypress(0), - m_lastChange(VOLUME_CHANGE_NONE) + m_lastChange(VOLUME_CHANGE_NONE), + m_iExitCode(0) { m_button.iButton = 0; m_button.iDuration = 0; @@ -107,6 +109,7 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender, { if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnQuit") && m_bIsReady) { + m_iExitCode = data.asInteger(0); StopThread(false); } else if (flag == GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverDeactivated") && m_bIsReady) @@ -305,12 +308,25 @@ void CPeripheralCecAdapter::Process(void) delete m_queryThread; - if (m_cecAdapter->IsLibCECActiveSource()) + if (m_iExitCode != EXITCODE_REBOOT) { - if (m_configuration.bPowerOffOnStandby == 1) - m_cecAdapter->StandbyDevices(); - else if (m_configuration.bSendInactiveSource == 1) - m_cecAdapter->SetInactiveView(); + if (m_cecAdapter->IsLibCECActiveSource()) + { + if (!m_configuration.powerOffDevices.IsEmpty()) + { + CLog::Log(LOGDEBUG, "%s - sending standby commands", __FUNCTION__); + m_cecAdapter->StandbyDevices(); + } + else if (m_configuration.bSendInactiveSource == 1) + { + CLog::Log(LOGDEBUG, "%s - sending inactive source commands", __FUNCTION__); + m_cecAdapter->SetInactiveView(); + } + } + else + { + CLog::Log(LOGDEBUG, "%s - XBMC is not the active source, not sending any standby commands", __FUNCTION__); + } } m_cecAdapter->Close(); diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h index 4c3e069107..de4e745723 100644 --- a/xbmc/peripherals/devices/PeripheralCecAdapter.h +++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h @@ -116,6 +116,7 @@ namespace PERIPHERALS std::queue<CecVolumeChange> m_volumeChangeQueue; unsigned int m_lastKeypress; CecVolumeChange m_lastChange; + int m_iExitCode; CPeripheralCecAdapterUpdateThread*m_queryThread; CEC::ICECCallbacks m_callbacks; CCriticalSection m_critSection; |