From: Lars Op den Kamp Date: Tue, 20 Dec 2011 20:04:52 +0000 (+0100) Subject: cec: change the previously unused boolean parameter in volume control methods to... X-Git-Tag: upstream/2.2.0~1^2~43^2~38 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5c73f7f744d83cb19d23d1a0f66597cdc3cfd5f3;p=deb_libcec.git cec: change the previously unused boolean parameter in volume control methods to bSendRelease, and only send a key release when it's true. default to true --- diff --git a/include/cec.h b/include/cec.h index 88381c4..61e4bb3 100644 --- a/include/cec.h +++ b/include/cec.h @@ -286,24 +286,24 @@ namespace CEC /*! * @brief Sends a volume up keypress to an audiosystem if it's present. - * @param bWait Wait for the response of the audiosystem when true. + * @param bSendRelease Send a key release after the keypress. * @return The new audio status. */ - virtual uint8_t VolumeUp(bool bWait = true) = 0; + virtual uint8_t VolumeUp(bool bSendRelease = true) = 0; /*! * @brief Sends a volume down keypress to an audiosystem if it's present. - * @param bWait Wait for the response of the audiosystem when true. + * @param bSendRelease Send a key release after the keypress. * @return The new audio status. */ - virtual uint8_t VolumeDown(bool bWait = true) = 0; + virtual uint8_t VolumeDown(bool bSendRelease = true) = 0; /*! * @brief Sends a mute keypress to an audiosystem if it's present. - * @param bWait Wait for the response of the audiosystem when true. + * @param bSendRelease Send a key release after the keypress. * @return The new audio status. */ - virtual uint8_t MuteAudio(bool bWait = true) = 0; + virtual uint8_t MuteAudio(bool bSendRelease = true) = 0; /*! * @brief Send a keypress to a device on the CEC bus. diff --git a/include/cecc.h b/include/cecc.h index 37bccc1..ddb141b 100644 --- a/include/cecc.h +++ b/include/cecc.h @@ -227,11 +227,11 @@ extern DECLSPEC int cec_set_hdmi_port(CEC::cec_logical_address iBaseDevice, uint extern DECLSPEC int cec_set_hdmi_port(cec_logical_address iBaseDevice, uint8_t iPort); #endif -extern DECLSPEC int cec_volume_up(int bWait); +extern DECLSPEC int cec_volume_up(int bSendRelease); -extern DECLSPEC int cec_volume_down(int bWait); +extern DECLSPEC int cec_volume_down(int bSendRelease); -extern DECLSPEC int cec_mute_audio(int bWait); +extern DECLSPEC int cec_mute_audio(int bSendRelease); #ifdef __cplusplus extern DECLSPEC int cec_send_keypress(CEC::cec_logical_address iDestination, CEC::cec_user_control_code key, int bWait); diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 60a6d19..726f316 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -585,29 +585,29 @@ bool CCECProcessor::PollDevice(cec_logical_address iAddress) return false; } -uint8_t CCECProcessor::VolumeUp(void) +uint8_t CCECProcessor::VolumeUp(bool bSendRelease /* = true */) { uint8_t status = 0; if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM)) - status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeUp(); + status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeUp(bSendRelease); return status; } -uint8_t CCECProcessor::VolumeDown(void) +uint8_t CCECProcessor::VolumeDown(bool bSendRelease /* = true */) { uint8_t status = 0; if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM)) - status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeDown(); + status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeDown(bSendRelease); return status; } -uint8_t CCECProcessor::MuteAudio(void) +uint8_t CCECProcessor::MuteAudio(bool bSendRelease /* = true */) { uint8_t status = 0; if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM)) - status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->MuteAudio(); + status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->MuteAudio(bSendRelease); return status; } diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index a0e0e73..e039ce4 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -90,9 +90,9 @@ namespace CEC virtual bool SetActiveSource(uint16_t iStreamPath); virtual bool SwitchMonitoring(bool bEnable); virtual bool PollDevice(cec_logical_address iAddress); - virtual uint8_t VolumeUp(void); - virtual uint8_t VolumeDown(void); - virtual uint8_t MuteAudio(void); + virtual uint8_t VolumeUp(bool bSendRelease = true); + virtual uint8_t VolumeDown(bool bSendRelease = true); + virtual uint8_t MuteAudio(bool bSendRelease = true); virtual bool TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key); virtual bool TransmitKeyRelease(cec_logical_address iDestination); virtual bool EnablePhysicalAddressDetection(void) { return false; }; diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp index 0ca0188..a1e5383 100644 --- a/src/lib/LibCEC.cpp +++ b/src/lib/LibCEC.cpp @@ -278,25 +278,25 @@ bool CLibCEC::IsActiveDeviceType(cec_device_type type) return false; } -uint8_t CLibCEC::VolumeUp(bool bWait /* = true */) +uint8_t CLibCEC::VolumeUp(bool bSendRelease /* = true */) { if (m_cec) - return m_cec->VolumeUp(); + return m_cec->VolumeUp(bSendRelease); return 0; } -uint8_t CLibCEC::VolumeDown(bool bWait /* = true */) +uint8_t CLibCEC::VolumeDown(bool bSendRelease /* = true */) { if (m_cec) - return m_cec->VolumeDown(); + return m_cec->VolumeDown(bSendRelease); return 0; } -uint8_t CLibCEC::MuteAudio(bool bWait /* = true */) +uint8_t CLibCEC::MuteAudio(bool bSendRelease /* = true */) { if (m_cec) - return m_cec->MuteAudio(); + return m_cec->MuteAudio(bSendRelease); return 0; } diff --git a/src/lib/LibCEC.h b/src/lib/LibCEC.h index c891790..7f60424 100644 --- a/src/lib/LibCEC.h +++ b/src/lib/LibCEC.h @@ -89,9 +89,9 @@ namespace CEC virtual bool IsActiveDevice(cec_logical_address iAddress); virtual bool IsActiveDeviceType(cec_device_type type); virtual bool SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort = CEC_DEFAULT_HDMI_PORT); - virtual uint8_t VolumeUp(bool bWait = true); - virtual uint8_t VolumeDown(bool bWait = true); - virtual uint8_t MuteAudio(bool bWait = true); + virtual uint8_t VolumeUp(bool bSendRelease = true); + virtual uint8_t VolumeDown(bool bSendRelease = true); + virtual uint8_t MuteAudio(bool bSendRelease = 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 cec_osd_name GetDeviceOSDName(cec_logical_address iAddress); diff --git a/src/lib/LibCECC.cpp b/src/lib/LibCECC.cpp index 938e0b7..cbf7b28 100644 --- a/src/lib/LibCECC.cpp +++ b/src/lib/LibCECC.cpp @@ -312,24 +312,24 @@ int cec_set_hdmi_port(cec_logical_address iBaseDevice, uint8_t iPort) return -1; } -int cec_volume_up(int bWait) +int cec_volume_up(int bSendRelease) { if (cec_parser) - return cec_parser->VolumeUp(bWait == 1); + return cec_parser->VolumeUp(bSendRelease == 1); return -1; } -int cec_volume_down(int bWait) +int cec_volume_down(int bSendRelease) { if (cec_parser) - return cec_parser->VolumeDown(bWait == 1); + return cec_parser->VolumeDown(bSendRelease == 1); return -1; } -int cec_mute_audio(int bWait) +int cec_mute_audio(int bSendRelease) { if (cec_parser) - return cec_parser->MuteAudio(bWait == 1); + return cec_parser->MuteAudio(bSendRelease == 1); return -1; } diff --git a/src/lib/devices/CECAudioSystem.cpp b/src/lib/devices/CECAudioSystem.cpp index 81a92c3..5b22723 100644 --- a/src/lib/devices/CECAudioSystem.cpp +++ b/src/lib/devices/CECAudioSystem.cpp @@ -120,27 +120,27 @@ bool CCECAudioSystem::TransmitSystemAudioModeStatus(cec_logical_address dest) return m_handler->TransmitSystemAudioModeStatus(m_iLogicalAddress, dest, state); } -uint8_t CCECAudioSystem::VolumeUp(void) +uint8_t CCECAudioSystem::VolumeUp(bool bSendRelease /* = true */) { - if (TransmitKeypress(CEC_USER_CONTROL_CODE_VOLUME_UP)) + if (TransmitKeypress(CEC_USER_CONTROL_CODE_VOLUME_UP) && bSendRelease) TransmitKeyRelease(); CLockObject lock(&m_mutex); return m_audioStatus; } -uint8_t CCECAudioSystem::VolumeDown(void) +uint8_t CCECAudioSystem::VolumeDown(bool bSendRelease /* = true */) { - if (TransmitKeypress(CEC_USER_CONTROL_CODE_VOLUME_DOWN)) + if (TransmitKeypress(CEC_USER_CONTROL_CODE_VOLUME_DOWN) && bSendRelease) TransmitKeyRelease(); CLockObject lock(&m_mutex); return m_audioStatus; } -uint8_t CCECAudioSystem::MuteAudio(void) +uint8_t CCECAudioSystem::MuteAudio(bool bSendRelease /* = true */) { - if (TransmitKeypress(CEC_USER_CONTROL_CODE_MUTE)) + if (TransmitKeypress(CEC_USER_CONTROL_CODE_MUTE) && bSendRelease) TransmitKeyRelease(); CLockObject lock(&m_mutex); diff --git a/src/lib/devices/CECAudioSystem.h b/src/lib/devices/CECAudioSystem.h index 291b0ec..dc35ef0 100644 --- a/src/lib/devices/CECAudioSystem.h +++ b/src/lib/devices/CECAudioSystem.h @@ -47,9 +47,9 @@ namespace CEC virtual bool TransmitSetSystemAudioMode(cec_logical_address dest); virtual bool TransmitSystemAudioModeStatus(cec_logical_address dest); - virtual uint8_t VolumeUp(void); - virtual uint8_t VolumeDown(void); - virtual uint8_t MuteAudio(void); + virtual uint8_t VolumeUp(bool bSendRelease = true); + virtual uint8_t VolumeDown(bool bSendRelease = true); + virtual uint8_t MuteAudio(bool bSendRelease = true); virtual bool TransmitActiveSource(void) { return false; }