From be5b0e24ecd0ab142b4a85197d10b07a57bf0e17 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Thu, 10 Nov 2011 18:30:00 +0100 Subject: [PATCH] cec: handle CEC_OPCODE_ACTIVE_SOURCE --- src/lib/implementations/CECCommandHandler.cpp | 16 ++++++++++++++++ src/lib/implementations/CECCommandHandler.h | 1 + 2 files changed, 17 insertions(+) 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); -- 2.34.1