virtual uint8_t VolumeDown(bool bSendRelease = true) = 0;
/*!
+ * @deprecated Use AudioToggleMute() instead
* @brief Sends a mute keypress to an audiosystem if it's present.
* @param bSendRelease Send a key release after the keypress.
* @return The new audio status.
virtual const char *ToString(const cec_server_version version) = 0;
virtual const char *ToString(const cec_user_control_code key) = 0;
virtual const char *ToString(const cec_adapter_type type) = 0;
+
+ /*!
+ * @brief Toggle the mute status of the AVR (if present)
+ * @return The new audio status.
+ */
+ virtual uint8_t AudioToggleMute(void) = 0;
+
+ /*!
+ * @brief Mute the AVR (if present)
+ * @return The new audio status.
+ */
+ virtual uint8_t AudioMute(void) = 0;
+
+ /*!
+ * @brief Mute the AVR (if connected)
+ * @return The new audio status.
+ */
+ virtual uint8_t AudioUnmute(void) = 0;
+
+ /*!
+ * @brief Get the current audio status (if an AVR is connected)
+ * @return The current audio status, or cec_audio_status if unknown.
+ */
+ virtual uint8_t AudioStatus(void) = 0;
};
};
extern DECLSPEC uint16_t cec_get_adapter_product_id(void);
+extern DECLSPEC uint8_t cec_audio_toggle_mute(void);
+
+extern DECLSPEC uint8_t cec_audio_mute(void);
+
+extern DECLSPEC uint8_t cec_audio_unmute(void);
+
+extern DECLSPEC uint8_t cec_audio_status(void);
+
#ifdef __cplusplus
};
#endif
(uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
}
+uint8_t CCECClient::AudioToggleMute(void)
+{
+ CCECBusDevice *device = GetPrimaryDevice();
+ CCECAudioSystem *audio = m_processor->GetAudioSystem();
+
+ return device && audio && audio->IsPresent() ?
+ audio->MuteAudio(device->GetLogicalAddress()) :
+ (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
+uint8_t CCECClient::AudioMute(void)
+{
+ CCECBusDevice *device = GetPrimaryDevice();
+ CCECAudioSystem *audio = m_processor->GetAudioSystem();
+ uint8_t iStatus = device && audio && audio->IsPresent() ? audio->GetAudioStatus(device->GetLogicalAddress()) : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+ if ((iStatus & CEC_AUDIO_MUTE_STATUS_MASK) != CEC_AUDIO_MUTE_STATUS_MASK)
+ iStatus = audio->MuteAudio(device->GetLogicalAddress());
+
+ return iStatus;
+}
+
+uint8_t CCECClient::AudioUnmute(void)
+{
+ CCECBusDevice *device = GetPrimaryDevice();
+ CCECAudioSystem *audio = m_processor->GetAudioSystem();
+ uint8_t iStatus = device && audio && audio->IsPresent() ? audio->GetAudioStatus(device->GetLogicalAddress()) : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+ if ((iStatus & CEC_AUDIO_MUTE_STATUS_MASK) == CEC_AUDIO_MUTE_STATUS_MASK)
+ iStatus = audio->MuteAudio(device->GetLogicalAddress());
+
+ return iStatus;
+}
+
+uint8_t CCECClient::AudioStatus(void)
+{
+ CCECBusDevice *device = GetPrimaryDevice();
+ CCECAudioSystem *audio = m_processor->GetAudioSystem();
+ return device && audio && audio->IsPresent() ? audio->GetAudioStatus(device->GetLogicalAddress()) : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
bool CCECClient::SendKeypress(const cec_logical_address iDestination, const cec_user_control_code key, bool bWait /* = true */)
{
CCECBusDevice *dest = m_processor->GetDevice(iDestination);
virtual uint8_t SendVolumeUp(bool bSendRelease = true);
virtual uint8_t SendVolumeDown(bool bSendRelease = true);
virtual uint8_t SendMuteAudio(void);
+ virtual uint8_t AudioToggleMute(void);
+ virtual uint8_t AudioMute(void);
+ virtual uint8_t AudioUnmute(void);
+ virtual uint8_t AudioStatus(void);
virtual bool SendKeypress(const cec_logical_address iDestination, const cec_user_control_code key, bool bWait = true);
virtual bool SendKeyRelease(const cec_logical_address iDestination, bool bWait = true);
virtual cec_osd_name GetDeviceOSDName(const cec_logical_address iAddress);
uint8_t CLibCEC::MuteAudio(bool UNUSED(bSendRelease) /* = true */)
{
+ AddLog(CEC_LOG_WARNING, "deprecated function called: %s", __FUNCTION__);
return m_client ? m_client->SendMuteAudio() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
}
{
return m_cec && m_cec->IsRunning() ? m_cec->GetAdapterProductId() : 0;
}
+
+uint8_t CLibCEC::AudioToggleMute(void)
+{
+ return m_client ? m_client->AudioToggleMute() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
+uint8_t CLibCEC::AudioMute(void)
+{
+ return m_client ? m_client->AudioMute() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
+uint8_t CLibCEC::AudioUnmute(void)
+{
+ return m_client ? m_client->AudioUnmute() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
+uint8_t CLibCEC::AudioStatus(void)
+{
+ return m_client ? m_client->AudioStatus() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
uint16_t GetAdapterVendorId(void) const;
uint16_t GetAdapterProductId(void) const;
+ uint8_t AudioToggleMute(void);
+ uint8_t AudioMute(void);
+ uint8_t AudioUnmute(void);
+ uint8_t AudioStatus(void);
+
CCECProcessor * m_cec;
protected:
return cec_parser ? cec_parser->GetAdapterProductId() : 0;
}
+uint8_t cec_audio_toggle_mute(void)
+{
+ return cec_parser ? cec_parser->AudioToggleMute() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
+uint8_t cec_audio_mute(void)
+{
+ return cec_parser ? cec_parser->AudioMute() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
+uint8_t cec_audio_unmute(void)
+{
+ return cec_parser ? cec_parser->AudioUnmute() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
+uint8_t cec_audio_status(void)
+{
+ return cec_parser ? cec_parser->AudioStatus() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
+}
+
//@}
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;
}
uint8_t VolumeUp(const cec_logical_address source, bool bSendRelease = true);
uint8_t VolumeDown(const cec_logical_address source, bool bSendRelease = true);
uint8_t MuteAudio(const cec_logical_address source);
+ uint8_t GetAudioStatus(const cec_logical_address initiator, bool bUpdate = false);
bool TransmitActiveSource(void) { return false; }
protected:
+ bool RequestAudioStatus(const cec_logical_address initiator, bool bWaitForResponse = true);
+
cec_system_audio_status m_systemAudioStatus;
uint8_t m_audioStatus;
};
return Transmit(command, !bWaitForResponse, false);
}
+bool CCECCommandHandler::TransmitRequestAudioStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_AUDIO_STATUS);
+
+ return Transmit(command, !bWaitForResponse, false);
+}
+
bool CCECCommandHandler::TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
{
cec_command command;
virtual bool TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestMenuLanguage(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
+ virtual bool TransmitRequestAudioStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);