bReturn = SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true);
}
- /* make the primary device the active source */
if (bReturn)
{
m_bInitialised = true;
- m_busDevices[m_logicalAddresses.primary]->m_bActiveSource = true;
- bReturn = m_busDevices[CECDEVICE_TV]->ActivateSource();
- }
-
- if (bReturn)
- {
m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");
}
else
bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, bool bForce /* = false */)
{
bool bReturn(false);
- {
- CLockObject lock(&m_mutex);
+ CLockObject lock(&m_mutex);
- m_iBaseDevice = iBaseDevice;
- m_iHDMIPort = iPort;
- if (!m_bStarted && !bForce)
- return true;
- }
+ m_iBaseDevice = iBaseDevice;
+ m_iHDMIPort = iPort;
+ if (!m_bStarted && !bForce)
+ return true;
CStdString strLog;
strLog.Format("setting HDMI port to %d on device %s (%d)", iPort, ToString(iBaseDevice), (int)iBaseDevice);
uint16_t iPhysicalAddress(0);
if (iBaseDevice > CECDEVICE_TV)
+ {
+ lock.Leave();
iPhysicalAddress = m_busDevices[iBaseDevice]->GetPhysicalAddress();
+ lock.Lock();
+ }
if (iPhysicalAddress < 0xffff)
{
return true;
}
-bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress)
+bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpdate /* = true */)
{
+ bool bWasActiveSource(false);
CLockObject lock(&m_mutex);
if (!m_logicalAddresses.IsEmpty())
{
for (uint8_t iPtr = 0; iPtr < 15; iPtr++)
if (m_logicalAddresses[iPtr])
{
+ bWasActiveSource |= m_busDevices[iPtr]->IsActiveSource();
m_busDevices[iPtr]->SetInactiveSource();
m_busDevices[iPtr]->SetPhysicalAddress(iPhysicalAddress);
- m_busDevices[iPtr]->TransmitPhysicalAddress();
+ if (bSendUpdate)
+ m_busDevices[iPtr]->TransmitPhysicalAddress();
}
- return SetActiveView();
+
+ return bWasActiveSource && bSendUpdate ? SetActiveView() : true;
}
return false;
}
}
}
-const char *CCECProcessor::ToString(const cec_audio_status status)
+const char *CCECProcessor::ToString(const cec_audio_status UNUSED(status))
{
// TODO this is a mask
return "TODO";