From: Lars Op den Kamp Date: Fri, 11 Nov 2011 17:05:30 +0000 (+0100) Subject: cec: transmit the menu state as (active) when the stream path is set X-Git-Tag: upstream/2.2.0~1^2~50 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=b6c7bc94e8a569d0fd49c1ecd1bcf02dcbee54c5 cec: transmit the menu state as (active) when the stream path is set --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index f2eafaa..8247eb3 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -364,11 +364,6 @@ bool CCECProcessor::SetStreamPath(uint16_t iStreamPath) device->m_bActiveSource = true; device->m_powerStatus = CEC_POWER_STATUS_ON; - - if (m_logicalAddresses.isset(device->m_iLogicalAddress)) - bReturn = device->TransmitActiveSource(); - else - bReturn = true; } return bReturn; diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index a6b5d10..fee9980 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -356,12 +356,21 @@ bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command) { if (command.parameters.size >= 2) { - uint16_t streamaddr = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); + uint16_t iStreamAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); CStdString strLog; - strLog.Format(">> %i sets stream path to physical address %04x", command.initiator, streamaddr); + strLog.Format(">> %i sets stream path to physical address %04x", command.initiator, iStreamAddress); m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); - return m_busDevice->GetProcessor()->SetStreamPath(streamaddr); + if (m_busDevice->GetProcessor()->SetStreamPath(iStreamAddress)) + { + CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress); + if (device) + { + return device->TransmitActiveSource() && + device->TransmitMenuState(command.initiator); + } + } + return false; } return true; } diff --git a/src/lib/implementations/VLCommandHandler.cpp b/src/lib/implementations/VLCommandHandler.cpp index e3d570b..fbbfa29 100644 --- a/src/lib/implementations/VLCommandHandler.cpp +++ b/src/lib/implementations/VLCommandHandler.cpp @@ -40,25 +40,3 @@ CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice) : CCECCommandHandler(busDevice) { } - -bool CVLCommandHandler::HandleSetStreamPath(const cec_command &command) -{ - if (command.parameters.size >= 2) - { - 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); - m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); - if (streamaddr == m_busDevice->GetMyPhysicalAddress()) - { - CCECBusDevice *device = GetDevice(command.destination); - if (device) - { - return device->TransmitActiveSource() && - device->TransmitMenuState(command.initiator); - } - return false; - } - } - return true; -} diff --git a/src/lib/implementations/VLCommandHandler.h b/src/lib/implementations/VLCommandHandler.h index 57213e9..3959ad7 100644 --- a/src/lib/implementations/VLCommandHandler.h +++ b/src/lib/implementations/VLCommandHandler.h @@ -41,8 +41,5 @@ namespace CEC CVLCommandHandler(CCECBusDevice *busDevice); virtual ~CVLCommandHandler(void) {}; virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_PANASONIC; }; - - protected: - virtual bool HandleSetStreamPath(const cec_command &command); }; };