X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECBusDevice.cpp;h=83c9b4cd6140323f4ec9ea6defd23e74b4bafbd2;hb=2ff07c6755cf06f25e06e3e5597ea9dc8f7b8f34;hp=fa063f4e52d47209bf3b223228c939b683602652;hpb=89ea1724e7a4bde3f7a4f958b414889cefddb841;p=deb_libcec.git diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index fa063f4..83c9b4c 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -1134,8 +1134,26 @@ void CCECBusDevice::SetActiveRoute(uint16_t iRoute) return; CCECBusDevice* newRoute = m_processor->GetDeviceByPhysicalAddress(iRoute, true); - if (newRoute && newRoute->IsHandledByLibCEC()) - newRoute->ActivateSource(); + if (newRoute) + { + // we were made the active source, send notification + if (newRoute->IsHandledByLibCEC()) + newRoute->ActivateSource(); + // another device was made active + else + newRoute->MarkAsActiveSource(); + } + else + { + // get the current active source and it's physical address + CCECBusDevice *device = m_processor->GetDevices()->GetActiveSource(); + uint16_t iPhysicalAddress(device ? device->GetCurrentPhysicalAddress() : CEC_INVALID_PHYSICAL_ADDRESS); + + // check whether the route below the device changed + if (CLibCEC::IsValidPhysicalAddress(iPhysicalAddress) && + !CCECTypeUtils::PhysicalAddressIsIncluded(iPhysicalAddress, iRoute)) + device->MarkAsInactiveSource(); + } } void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */)