Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for audio routing to TV #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/libcec/devices/CECBusDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
10 changes: 10 additions & 0 deletions src/libcec/implementations/CECCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/libcec/implementations/CECCommandHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down