X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fdevices%2FCECAudioSystem.cpp;h=662054f0a2b167e1d8a35754f890833e4b4a2ff8;hb=6d2bc8defa92bf09ab5b6600a1d17b81c024b3d8;hp=add3e6f3f6286137370a5d53fa3982012c8ce8d9;hpb=ac3f990141108fb7864f8c67f3c997ccc536fdd6;p=deb_libcec.git diff --git a/src/lib/devices/CECAudioSystem.cpp b/src/lib/devices/CECAudioSystem.cpp index add3e6f..662054f 100644 --- a/src/lib/devices/CECAudioSystem.cpp +++ b/src/lib/devices/CECAudioSystem.cpp @@ -139,6 +139,40 @@ uint8_t CCECAudioSystem::MuteAudio(const cec_logical_address source) TransmitKeypress(source, CEC_USER_CONTROL_CODE_MUTE); TransmitKeyRelease(source); + return GetAudioStatus(source, true); +} + +bool CCECAudioSystem::RequestAudioStatus(const cec_logical_address initiator, bool bWaitForResponse /* = true */) +{ + bool bReturn(false); + + if (!IsHandledByLibCEC() && + !IsUnsupportedFeature(CEC_OPCODE_GIVE_AUDIO_STATUS)) + { + MarkBusy(); + LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< requesting audio status of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); + bReturn = m_handler->TransmitRequestAudioStatus(initiator, m_iLogicalAddress, bWaitForResponse); + MarkReady(); + } + return bReturn; +} + +uint8_t CCECAudioSystem::GetAudioStatus(const cec_logical_address initiator, bool bUpdate /* = false */) +{ + bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT); + bool bRequestUpdate(false); + { + CLockObject lock(m_mutex); + bRequestUpdate = bIsPresent && + (bUpdate || m_audioStatus == CEC_AUDIO_VOLUME_STATUS_UNKNOWN); + } + + if (bRequestUpdate) + { + CheckVendorIdRequested(initiator); + RequestAudioStatus(initiator); + } + CLockObject lock(m_mutex); return m_audioStatus; }