X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=095fb63335fed7322d71506df85d607abe9f1caf;hb=5347b94bbd7455453754fd79b6aaa64aa368ce59;hp=6e5bf19f6f7880609c033433866b85befbc0f469;hpb=f3b6afa4b5b7637741592ce4535e34e04e68cb6a;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 6e5bf19..095fb63 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -132,7 +132,10 @@ CCECProcessor::~CCECProcessor(void) Close(); for (unsigned int iPtr = 0; iPtr < 16; iPtr++) + { delete m_busDevices[iPtr]; + m_busDevices[iPtr] = NULL; + } } void CCECProcessor::Close(void) @@ -453,23 +456,27 @@ void CCECProcessor::ReplaceHandlers(void) bool CCECProcessor::OnCommandReceived(const cec_command &command) { - ParseCommand(command); - return true; + return m_inBuffer.Push(command); } void *CCECProcessor::Process(void) { CLibCEC::AddLog(CEC_LOG_DEBUG, "processor thread started"); + cec_command command; + command.Clear(); + while (!IsStopped() && m_communication->IsOpen()) { + if (m_inBuffer.Pop(command, 500)) + ParseCommand(command); + if (IsInitialised()) { ReplaceHandlers(); m_controller->CheckKeypressTimeout(); } - Sleep(5); } return NULL; @@ -571,6 +578,12 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, { bool bReturn(false); + // limit the HDMI port range to 1-15 + if (iPort < 1) + iPort = 1; + if (iPort > 15) + iPort = 15; + { CLockObject lock(m_mutex); m_configuration.baseDevice = iBaseDevice; @@ -1599,6 +1612,7 @@ bool CCECProcessor::SetConfiguration(const libcec_configuration *configuration) // just copy these m_configuration.clientVersion = configuration->clientVersion; + m_configuration.bUseTVMenuLanguage = configuration->bUseTVMenuLanguage; m_configuration.bActivateSource = configuration->bActivateSource; m_configuration.bGetSettingsFromROM = configuration->bGetSettingsFromROM; m_configuration.powerOffDevices = configuration->powerOffDevices;