From 04437dcf953eb9bf3accaceb4dab0fe06d935264 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Thu, 10 Nov 2011 18:30:00 +0100 Subject: [PATCH] cec: fixed handling of CEC_OPCODE_SET_STREAM_PATH --- src/lib/CECProcessor.cpp | 18 +++++++++++------- src/lib/implementations/CECCommandHandler.cpp | 7 +++---- 2 files changed, 14 insertions(+), 11 deletions(-) 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; } -- 2.34.1