X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECDeviceMap.cpp;h=1280de6e2f43eb4db87376e7529000b0c9a42bcd;hb=d3caa81bbff5c84e49cdc9c4c1de5d0b583eb45d;hp=23e7a6fad980e89b60b357608a35adb280a6360a;hpb=e4e827e620365d043ef94da8874d942f80aefb9b;p=deb_libcec.git diff --git a/src/lib/devices/CECDeviceMap.cpp b/src/lib/devices/CECDeviceMap.cpp index 23e7a6f..1280de6 100644 --- a/src/lib/devices/CECDeviceMap.cpp +++ b/src/lib/devices/CECDeviceMap.cpp @@ -45,7 +45,8 @@ using namespace std; using namespace CEC; CCECDeviceMap::CCECDeviceMap(CCECProcessor *processor) : - m_processor(processor) + m_processor(processor), + m_iActiveSource(CEC_INVALID_PHYSICAL_ADDRESS) { for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_BROADCAST; iPtr++) { @@ -206,6 +207,9 @@ CCECBusDevice *CCECDeviceMap::GetActiveSource(void) const { for (CECDEVICEMAP::const_iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++) { + if (m_iActiveSource != CEC_INVALID_PHYSICAL_ADDRESS && !it->second->IsActiveSource() && + m_iActiveSource == it->second->GetCurrentPhysicalAddress()) + it->second->MarkAsActiveSource(); if (it->second->IsActiveSource()) return it->second; } @@ -283,3 +287,19 @@ void CCECDeviceMap::GetChildrenOf(CECDEVICEVEC& devices, CCECBusDevice* device) devices.push_back(it->second); } } + +void CCECDeviceMap::SetActiveSource(uint16_t iPhysicalAddress) +{ + m_iActiveSource = iPhysicalAddress; +} + +uint16_t CCECDeviceMap::GetActiveSourceAddress(void) const +{ + return m_iActiveSource; +} + +void CCECDeviceMap::SignalAll(cec_opcode opcode) +{ + for (CECDEVICEMAP::iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++) + it->second->SignalOpcode(opcode); +}