From: Lars Op den Kamp Date: Thu, 1 Dec 2011 18:56:00 +0000 (+0100) Subject: cec: added a hook in libcec for physical address autodetection X-Git-Tag: upstream/2.2.0~1^2~44^2~70 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2dbd78f8f765f83e98190c01a123c569aea7c5b6;p=deb_libcec.git cec: added a hook in libcec for physical address autodetection --- diff --git a/include/cec.h b/include/cec.h index 6fef482..44bf024 100644 --- a/include/cec.h +++ b/include/cec.h @@ -137,6 +137,20 @@ namespace CEC */ virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS) = 0; + /*! + * @brief Enable physical address detection (if the connected adapter supports this). + * @return True when physical address detection was enabled, false otherwise. + */ + virtual bool EnablePhysicalAddressDetection(void) = 0; + + /*! + * @brief Changes the active HDMI port. + * @param iBaseDevice The device to which this libcec is connected. + * @param iPort The new port number. + * @return True when changed, false otherwise. + */ + virtual bool SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort) = 0; + /*! * @brief Power on the connected CEC capable devices. * @param address The logical address to power on. @@ -263,14 +277,6 @@ namespace CEC */ virtual bool IsActiveDeviceType(cec_device_type type) = 0; - /*! - * @brief Changes the active HDMI port. - * @param iBaseDevice The device to which this libcec is connected. - * @param iPort The new port number. - * @return True when changed, false otherwise. - */ - virtual bool SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort) = 0; - /*! * @brief Sends a volume up keypress to an audiosystem if it's present. * @param bWait Wait for the response of the audiosystem when true. diff --git a/include/cecc.h b/include/cecc.h index e2c09da..972c4a2 100644 --- a/include/cecc.h +++ b/include/cecc.h @@ -215,6 +215,8 @@ extern DECLSPEC CEC::cec_osd_name cec_get_osd_name(CEC::cec_logical_address iAdd extern DECLSPEC cec_osd_name cec_get_osd_name(cec_logical_address iAddress); #endif +extern DECLSPEC int cec_enable_physical_address_detection(void); + #ifdef __cplusplus }; #endif diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index 05dc4b2..5ee861d 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -91,6 +91,7 @@ namespace CEC virtual uint8_t MuteAudio(bool bWait = true); virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = false); virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = false); + virtual bool EnablePhysicalAddressDetection(void) { return false; }; const char *ToString(const cec_menu_state state); const char *ToString(const cec_version version); diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp index 118be7d..445798b 100644 --- a/src/lib/LibCEC.cpp +++ b/src/lib/LibCEC.cpp @@ -171,6 +171,11 @@ bool CLibCEC::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort /* = CE return m_cec ? m_cec->SetHDMIPort(iBaseDevice, iPort) : false; } +bool CLibCEC::EnablePhysicalAddressDetection(void) +{ + return m_cec ? m_cec->EnablePhysicalAddressDetection() : false; +} + bool CLibCEC::PowerOnDevices(cec_logical_address address /* = CECDEVICE_TV */) { return m_cec && address >= CECDEVICE_TV && address <= CECDEVICE_BROADCAST ? m_cec->m_busDevices[(uint8_t)address]->PowerOn() : false; diff --git a/src/lib/LibCEC.h b/src/lib/LibCEC.h index c6bf629..e1b991b 100644 --- a/src/lib/LibCEC.h +++ b/src/lib/LibCEC.h @@ -94,6 +94,7 @@ namespace CEC virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = false); virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = false); virtual cec_osd_name GetOSDName(cec_logical_address iAddress); + virtual bool EnablePhysicalAddressDetection(void); const char *ToString(const cec_menu_state state); const char *ToString(const cec_version version); diff --git a/src/lib/LibCECC.cpp b/src/lib/LibCECC.cpp index 6c8d141..fdcc9e7 100644 --- a/src/lib/LibCECC.cpp +++ b/src/lib/LibCECC.cpp @@ -319,4 +319,9 @@ cec_osd_name cec_get_osd_name(cec_logical_address iAddress) return retVal; } +int cec_enable_physical_address_detection(void) +{ + return cec_parser ? (cec_parser->EnablePhysicalAddressDetection() ? 1 : 0) : -1; +} + //@}