diff --git a/src/libcec/devices/CECBusDevice.cpp b/src/libcec/devices/CECBusDevice.cpp index 010406db..1645ea4a 100644 --- a/src/libcec/devices/CECBusDevice.cpp +++ b/src/libcec/devices/CECBusDevice.cpp @@ -1032,6 +1032,13 @@ bool CCECBusDevice::ActivateSource(uint64_t iDelay /* = 0 */) LIB_CEC->AddLog(CEC_LOG_DEBUG, "powering up the AVR"); audioSystem->PowerOn(m_iLogicalAddress); } + + /* Some TVs are doesn't send 'use external speakers' */ + if (audioSystem && audioSystem->IsPresent()) + { + LIB_CEC->AddLog(CEC_LOG_DEBUG, "explicitly routing sound to AVR"); + m_handler->TransmitSystemAudioModeRequest(m_iLogicalAddress, m_iPhysicalAddress, true); + } } LIB_CEC->AddLog(CEC_LOG_DEBUG, "sending active source message for '%s'", ToString(m_iLogicalAddress)); diff --git a/src/libcec/implementations/CECCommandHandler.cpp b/src/libcec/implementations/CECCommandHandler.cpp index 1167ab8a..210c39b5 100644 --- a/src/libcec/implementations/CECCommandHandler.cpp +++ b/src/libcec/implementations/CECCommandHandler.cpp @@ -1156,6 +1156,16 @@ bool CCECCommandHandler::TransmitSetStreamPath(uint16_t iStreamPath, bool bIsRep return Transmit(command, false, bIsReply); } +bool CCECCommandHandler::TransmitSystemAudioModeRequest(const cec_logical_address iInitiator, uint16_t iPhysicalAddress, bool bIsReply) +{ + cec_command command; + cec_command::Format(command, iInitiator, CECDEVICE_AUDIOSYSTEM, CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST); + command.parameters.PushBack((uint8_t) ((iPhysicalAddress >> 8) & 0xFF)); + command.parameters.PushBack((uint8_t) (iPhysicalAddress & 0xFF)); + + return Transmit(command, false, bIsReply); +} + bool CCECCommandHandler::TransmitSystemAudioModeStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state, bool bIsReply) { cec_command command; diff --git a/src/libcec/implementations/CECCommandHandler.h b/src/libcec/implementations/CECCommandHandler.h index cb726535..96080648 100644 --- a/src/libcec/implementations/CECCommandHandler.h +++ b/src/libcec/implementations/CECCommandHandler.h @@ -90,6 +90,7 @@ namespace CEC virtual bool TransmitVendorID(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint64_t iVendorId, bool bIsReply); virtual bool TransmitAudioStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint8_t state, bool bIsReply); virtual bool TransmitSetSystemAudioMode(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state, bool bIsReply); + virtual bool TransmitSystemAudioModeRequest(const cec_logical_address iInitiator, uint16_t iPhysicalAddress, bool bIsReply); virtual bool TransmitSystemAudioModeStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state, bool bIsReply); virtual bool TransmitDeckStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_deck_info state, bool bIsReply); virtual bool TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);