From: Lars Op den Kamp Date: Thu, 10 Nov 2011 17:30:00 +0000 (+0100) Subject: cec: handle CEC_OPCODE_ACTIVE_SOURCE X-Git-Tag: upstream/2.2.0~1^2~74 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=be5b0e24ecd0ab142b4a85197d10b07a57bf0e17;p=deb_libcec.git cec: handle CEC_OPCODE_ACTIVE_SOURCE --- diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 7229480..e9b0a79 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -147,6 +147,11 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command) /* pass to listeners */ m_busDevice->GetProcessor()->AddCommand(command); break; + case CEC_OPCODE_ACTIVE_SOURCE: + HandleActiveSource(command); + /* pass to listeners */ + m_busDevice->GetProcessor()->AddCommand(command); + break; default: UnhandledCommand(command); /* pass to listeners */ @@ -166,6 +171,17 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command) return bHandled; } +bool CCECCommandHandler::HandleActiveSource(const cec_command &command) +{ + if (command.parameters.size == 2) + { + uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); + return m_busDevice->GetProcessor()->SetStreamPath(iAddress); + } + + return true; +} + bool CCECCommandHandler::HandleDeviceCecVersion(const cec_command &command) { if (command.parameters.size == 1) diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index 58b13e9..843aa63 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -52,6 +52,7 @@ namespace CEC static const char* ToString(const cec_opcode opcode); protected: + virtual bool HandleActiveSource(const cec_command &command); virtual bool HandleDeviceCecVersion(const cec_command &command); virtual bool HandleDeviceVendorCommandWithId(const cec_command &command); virtual bool HandleDeviceVendorId(const cec_command &command);