X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fimplementations%2FCECCommandHandler.cpp;h=a424bca3414d2ea38ccedac4a5dc9cfde91e9893;hb=6685ae0785b7c20af2ddb380e3068a2550cdf978;hp=94348676b94600b020b27405667ddf7468140a98;hpb=a1f8fb1b065d260eb9d6eaf7e053f7415b453613;p=deb_libcec.git diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 9434867..a424bca 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -313,13 +313,9 @@ bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command) CStdString strLog; strLog.Format(">> %i requests stream path from physical address %04x", command.initiator, streamaddr); m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); - if (streamaddr == m_busDevice->GetMyPhysicalAddress()) - { - CCECBusDevice *device = GetDevice(command.destination); - if (device) - return device->TransmitActiveSource(); - return false; - } + CCECBusDevice *device = GetDeviceByPhysicalAddress(streamaddr); + if (device) + return device->TransmitActiveSource(); } return true; } @@ -364,3 +360,19 @@ CCECBusDevice *CCECCommandHandler::GetDevice(cec_logical_address iLogicalAddress return device; } + +CCECBusDevice *CCECCommandHandler::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress) const +{ + CCECBusDevice *device = NULL; + + for (unsigned int iPtr = 0; iPtr < 16; iPtr++) + { + if (m_busDevice->GetProcessor()->m_busDevices[iPtr]->GetPhysicalAddress() == iPhysicalAddress) + { + device = m_busDevice->GetProcessor()->m_busDevices[iPtr]; + break; + } + } + + return device; +}