From: Lars Op den Kamp Date: Thu, 10 Nov 2011 17:30:00 +0000 (+0100) Subject: cec: fixed handling of CEC_OPCODE_SET_STREAM_PATH X-Git-Tag: upstream/2.2.0~1^2~73 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=04437dcf953eb9bf3accaceb4dab0fe06d935264;p=deb_libcec.git cec: fixed handling of CEC_OPCODE_SET_STREAM_PATH --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 53a1da3..6259dae 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -298,15 +298,15 @@ bool CCECProcessor::SetActiveView(void) return bReturn; if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary]) - { - SetStreamPath(m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress()); - bReturn = m_busDevices[m_logicalAddresses.primary]->TransmitActiveSource(); - } - return false; + bReturn = SetStreamPath(m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress()); + + return bReturn; } bool CCECProcessor::SetStreamPath(uint16_t iStreamPath) { + bool bReturn(false); + CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath); if (device) { @@ -314,10 +314,14 @@ bool CCECProcessor::SetStreamPath(uint16_t iStreamPath) m_busDevices[iPtr]->m_bActiveSource = false; device->m_bActiveSource = true; - return true; + + if (m_logicalAddresses.isset(device->m_iLogicalAddress)) + bReturn = device->TransmitActiveSource(); + else + bReturn = true; } - return false; + return bReturn; } bool CCECProcessor::SetInactiveView(void) diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index e9b0a79..2db0c72 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -341,11 +341,10 @@ bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command) { int streamaddr = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); CStdString strLog; - strLog.Format(">> %i requests stream path from physical address %04x", command.initiator, streamaddr); + strLog.Format(">> %i sets stream path to physical address %04x", command.initiator, streamaddr); m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); - CCECBusDevice *device = GetDeviceByPhysicalAddress(streamaddr); - if (device) - return device->TransmitActiveSource(); + + return m_busDevice->GetProcessor()->SetStreamPath(streamaddr); } return true; }