{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X): physical address changed from %04x to %04x", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress, iNewAddress);
m_iPhysicalAddress = iNewAddress;
+
+ if (m_processor->GetDevices()->GetActiveSourceAddress() == iNewAddress)
+ MarkAsActiveSource();
}
return true;
}
CLockObject lock(m_mutex);
status = m_deviceStatus;
bNeedsPoll = !bSuppressPoll &&
- (bForcePoll || m_deviceStatus == CEC_DEVICE_STATUS_UNKNOWN) &&
- m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC;
+ m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC &&
+ // poll forced
+ (bForcePoll ||
+ // don't know the status
+ m_deviceStatus == CEC_DEVICE_STATUS_UNKNOWN ||
+ // always poll the TV if it's marked as not present
+ (m_deviceStatus == CEC_DEVICE_STATUS_NOT_PRESENT && m_iLogicalAddress == CECDEVICE_TV));
}
if (bNeedsPoll)
if (m_deviceStatus != newStatus)
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X): device status changed into 'not present'", GetLogicalAddressName(), m_iLogicalAddress);
- ResetDeviceStatus();
+ ResetDeviceStatus(true);
m_deviceStatus = newStatus;
}
break;
}
}
-void CCECBusDevice::ResetDeviceStatus(void)
+void CCECBusDevice::ResetDeviceStatus(bool bClientUnregistered /* = false */)
{
CLockObject lock(m_mutex);
SetPowerStatus (CEC_POWER_STATUS_UNKNOWN);
SetCecVersion (CEC_VERSION_UNKNOWN);
SetStreamPath (CEC_INVALID_PHYSICAL_ADDRESS);
SetOSDName (ToString(m_iLogicalAddress));
- MarkAsInactiveSource();
+ MarkAsInactiveSource(bClientUnregistered);
m_iLastActive = 0;
m_bVendorIdRequested = false;
if (bWasActivated)
{
+ if (IsHandledByLibCEC())
+ m_processor->SetActiveSource(true, false);
CCECClient *client = GetClient();
if (client)
client->SourceActivated(m_iLogicalAddress);
}
}
-void CCECBusDevice::MarkAsInactiveSource(void)
+void CCECBusDevice::MarkAsInactiveSource(bool bClientUnregistered /* = false */)
{
bool bWasDeactivated(false);
{
if (bWasDeactivated)
{
+ if (IsHandledByLibCEC())
+ m_processor->SetActiveSource(false, bClientUnregistered);
CCECClient *client = GetClient();
if (client)
client->SourceDeactivated(m_iLogicalAddress);
return bReturn;
}
+void CCECBusDevice::SetActiveRoute(uint16_t iRoute)
+{
+ CCECDeviceMap* map = m_processor->GetDevices();
+ if (!map)
+ return;
+
+ CCECBusDevice* previouslyActive = map->GetActiveSource();
+ if (!previouslyActive)
+ return;
+
+ CECDEVICEVEC devices;
+ m_processor->GetDevices()->GetChildrenOf(devices, this);
+
+ for (CECDEVICEVEC::iterator it = devices.begin(); it != devices.end(); it++)
+ {
+ if (!CCECTypeUtils::PhysicalAddressIsIncluded(iRoute, (*it)->GetCurrentPhysicalAddress()))
+ (*it)->MarkAsInactiveSource();
+ }
+}
+
void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */)
{
CLockObject lock(m_mutex);