[CEC] fixed - screensaver being activated sends the tv to standby, which makes the...
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 11 Dec 2013 16:57:11 +0000 (17:57 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 12 Dec 2013 02:45:24 +0000 (03:45 +0100)
xbmc/peripherals/devices/PeripheralCecAdapter.cpp
xbmc/peripherals/devices/PeripheralCecAdapter.h

index 650df18..09ebf90 100644 (file)
@@ -139,7 +139,7 @@ void CPeripheralCecAdapter::ResetMembers(void)
 
   m_currentButton.iButton    = 0;
   m_currentButton.iDuration  = 0;
-  m_screensaverLastActivated.SetValid(false);
+  m_standbySent.SetValid(false);
   m_configuration.Clear();
 }
 
@@ -175,7 +175,6 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
     // Don't put devices to standby if application is currently playing
     if ((!g_application.m_pPlayer->IsPlaying() && !g_application.m_pPlayer->IsPaused()) && m_configuration.bPowerOffScreensaver == 1)
     {
-      m_screensaverLastActivated = CDateTime::GetCurrentDateTime();
       // only power off when we're the active source
       if (m_cecAdapter->IsLibCECActiveSource())
         StandbyDevices();
@@ -410,6 +409,7 @@ void CPeripheralCecAdapter::Process(void)
       if (!m_configuration.powerOffDevices.IsEmpty())
       {
         CLog::Log(LOGDEBUG, "%s - sending standby commands", __FUNCTION__);
+        m_standbySent = CDateTime::GetCurrentDateTime();
         m_cecAdapter->StandbyDevices();
       }
       else if (m_configuration.bSendInactiveSource == 1)
@@ -623,7 +623,7 @@ int CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command command)
       /* a device was put in standby mode */
       if (command.initiator == CECDEVICE_TV &&
           (adapter->m_configuration.bPowerOffOnStandby == 1 || adapter->m_configuration.bShutdownOnStandby == 1) &&
-          (!adapter->m_screensaverLastActivated.IsValid() || CDateTime::GetCurrentDateTime() - adapter->m_screensaverLastActivated > CDateTimeSpan(0, 0, 0, SCREENSAVER_TIMEOUT)))
+          (!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)
@@ -1684,6 +1684,7 @@ void CPeripheralCecAdapter::ProcessStandbyDevices(void)
   {
     if (!m_configuration.powerOffDevices.IsEmpty())
     {
+      m_standbySent = CDateTime::GetCurrentDateTime();
       m_cecAdapter->StandbyDevices(CECDEVICE_BROADCAST);
     }
     else if (m_configuration.bSendInactiveSource == 1)
@@ -1701,7 +1702,6 @@ bool CPeripheralCecAdapter::ToggleDeviceState(CecStateChange mode /*= STATE_SWIT
   if (m_cecAdapter->IsLibCECActiveSource() && (mode == STATE_SWITCH_TOGGLE || mode == STATE_STANDBY))
   {
     CLog::Log(LOGDEBUG, "%s - putting CEC device on standby...", __FUNCTION__);
-    m_screensaverLastActivated = CDateTime::GetCurrentDateTime();
     StandbyDevices();
     return false;
   }
index 0a4100e..0809b03 100644 (file)
@@ -156,7 +156,7 @@ namespace PERIPHERALS
     bool                              m_bIsReady;
     bool                              m_bHasConnectedAudioSystem;
     CStdString                        m_strMenuLanguage;
-    CDateTime                         m_screensaverLastActivated;
+    CDateTime                         m_standbySent;
     std::vector<CecButtonPress>       m_buttonQueue;
     CecButtonPress                    m_currentButton;
     std::queue<CecVolumeChange>       m_volumeChangeQueue;