aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Op den Kamp <lars@opdenkamp.eu>2012-12-06 02:27:17 +0100
committerLars Op den Kamp <lars@opdenkamp.eu>2012-12-06 02:28:49 +0100
commitabcb3f86843ed098822c30d1dab17e378aa0b946 (patch)
treecb455f56b937bac59979bf5a85721cd3a9862d7f
parent906bd93ada2f303874e0cc275bcaa7c2f64fa025 (diff)
[cec] fixed - make xbmc the active source again when resuming from standby and xbmc was the active source before it went to standby
-rw-r--r--xbmc/peripherals/devices/PeripheralCecAdapter.cpp23
-rw-r--r--xbmc/peripherals/devices/PeripheralCecAdapter.h3
2 files changed, 21 insertions, 5 deletions
diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
index f0a615efe1..b26ef3809d 100644
--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
@@ -130,6 +130,7 @@ void CPeripheralCecAdapter::ResetMembers(void)
m_bDeviceRemoved = false;
m_bActiveSourcePending = false;
m_bStandbyPending = false;
+ m_bActiveSourceBeforeStandby = false;
m_currentButton.iButton = 0;
m_currentButton.iDuration = 0;
@@ -180,14 +181,24 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
// this will also power off devices when we're the active source
{
CSingleLock lock(m_critSection);
- m_bGoingToStandby = false;
+ m_bGoingToStandby = true;
}
StopThread();
}
else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnWake"))
{
CLog::Log(LOGDEBUG, "%s - reconnecting to the CEC adapter after standby mode", __FUNCTION__);
- ReopenConnection();
+ if (ReopenConnection())
+ {
+ bool bActivate(false);
+ {
+ CSingleLock lock(m_critSection);
+ bActivate = m_bActiveSourceBeforeStandby;
+ m_bActiveSourceBeforeStandby = false;
+ }
+ if (bActivate)
+ ActivateSource();
+ }
}
else if (flag == Player && !strcmp(sender, "xbmc") && !strcmp(message, "OnStop"))
{
@@ -391,6 +402,7 @@ void CPeripheralCecAdapter::Process(void)
m_iExitCode = EXITCODE_QUIT;
m_bGoingToStandby = false;
m_bIsRunning = true;
+ m_bActiveSourceBeforeStandby = false;
}
CAnnouncementManager::AddAnnouncer(this);
@@ -424,6 +436,9 @@ void CPeripheralCecAdapter::Process(void)
!m_bDeviceRemoved &&
(!m_bGoingToStandby || GetSettingBool("standby_tv_on_pc_standby")) &&
GetSettingBool("enabled");
+
+ if (m_bGoingToStandby)
+ m_bActiveSourceBeforeStandby = m_cecAdapter->IsLibCECActiveSource();
}
if (bSendStandbyCommands)
@@ -1669,7 +1684,7 @@ void CPeripheralCecAdapter::OnDeviceRemoved(void)
m_bDeviceRemoved = true;
}
-void CPeripheralCecAdapter::ReopenConnection(void)
+bool CPeripheralCecAdapter::ReopenConnection(void)
{
// stop running thread
{
@@ -1684,7 +1699,7 @@ void CPeripheralCecAdapter::ReopenConnection(void)
ResetMembers();
// reopen the connection
- InitialiseFeature(FEATURE_CEC);
+ return InitialiseFeature(FEATURE_CEC);
}
void CPeripheralCecAdapter::ActivateSource(void)
diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h
index 13b653ee97..03e213adc0 100644
--- a/xbmc/peripherals/devices/PeripheralCecAdapter.h
+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h
@@ -129,7 +129,7 @@ namespace PERIPHERALS
static int 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);
bool IsRunning(void) const;
- void ReopenConnection(void);
+ bool ReopenConnection(void);
void ProcessActivateSource(void);
void ProcessStandbyDevices(void);
@@ -168,6 +168,7 @@ namespace PERIPHERALS
bool m_bActiveSourcePending;
bool m_bStandbyPending;
CDateTime m_preventActivateSourceOnPlay;
+ bool m_bActiveSourceBeforeStandby;
};
class CPeripheralCecAdapterUpdateThread : public CThread