From: Lars Op den Kamp Date: Sun, 6 Nov 2011 16:38:55 +0000 (+0100) Subject: cec: opcode 0x80 means the stream path changed, not the physical address X-Git-Tag: upstream/2.2.0~1^2~93 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9dc04b07e7abdfb28b443eb973a8cd02c69ca32f;p=deb_libcec.git cec: opcode 0x80 means the stream path changed, not the physical address --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 77e6461..9a33e0d 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -42,6 +42,7 @@ using namespace CEC; CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress) : m_iPhysicalAddress(iPhysicalAddress), + m_iStreamPath(0), m_iLogicalAddress(iLogicalAddress), m_powerStatus(CEC_POWER_STATUS_UNKNOWN), m_processor(processor), @@ -254,7 +255,7 @@ void CCECBusDevice::SetMenuLanguage(const cec_menu_language &language) } } -void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */) +void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress) { if (iNewAddress > 0) { @@ -266,6 +267,18 @@ void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddres } } +void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */) +{ + if (iNewAddress > 0) + { + CStdString strLog; + strLog.Format(">> %i stream path from %04x to %04x", m_iLogicalAddress, iOldAddress, iNewAddress); + AddLog(CEC_LOG_DEBUG, strLog.c_str()); + + m_iStreamPath = iNewAddress; + } +} + void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus) { if (m_powerStatus != powerStatus) diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 509e57c..0a04bd7 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -71,7 +71,8 @@ namespace CEC virtual const char * GetVendorName(void) { return GetVendor().AsString(); } virtual bool MyLogicalAddressContains(cec_logical_address address) const; - virtual void SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress = 0); + virtual void SetPhysicalAddress(uint16_t iNewAddress); + virtual void SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress = 0); virtual void SetCecVersion(const cec_version newVersion); virtual void SetMenuLanguage(const cec_menu_language &menuLanguage); virtual void SetVendorId(const cec_datapacket &data); @@ -95,6 +96,7 @@ namespace CEC cec_device_type m_type; CStdString m_strDeviceName; uint16_t m_iPhysicalAddress; + uint16_t m_iStreamPath; cec_logical_address m_iLogicalAddress; cec_power_status m_powerStatus; cec_menu_language m_menuLanguage; diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index e30810c..33644d8 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -288,7 +288,7 @@ bool CCECCommandHandler::HandleRoutingChange(const cec_command &command) CCECBusDevice *device = GetDevice(command.initiator); if (device) - device->SetPhysicalAddress(iNewAddress, iOldAddress); + device->SetStreamPath(iNewAddress, iOldAddress); } return true; }