From: Lars Op den Kamp Date: Tue, 27 Dec 2011 19:22:53 +0000 (+0100) Subject: cec: let CCECProcessor replace the command handlers X-Git-Tag: upstream/2.2.0~1^2~43^2~11 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a3ffc068ae63ee4fd655ebed4016dd055a7025e0;p=deb_libcec.git cec: let CCECProcessor replace the command handlers --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 63205f4..dc094ac 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -268,6 +268,12 @@ bool CCECProcessor::FindLogicalAddresses(void) return bReturn; } +void CCECProcessor::ReplaceHandlers(void) +{ + for (uint8_t iPtr = 0; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++) + m_busDevices[iPtr]->ReplaceHandler(true); +} + void *CCECProcessor::Process(void) { bool bParseFrame(false); @@ -283,6 +289,8 @@ void *CCECProcessor::Process(void) while (!IsStopped()) { + ReplaceHandlers(); + command.Clear(); msg.clear(); diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index 9cb1bf9..13243ab 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -134,6 +134,7 @@ namespace CEC CMutex m_transmitMutex; private: + void ReplaceHandlers(void); void ScanCECBus(void); bool PhysicalAddressInUse(uint16_t iPhysicalAddress); bool TryLogicalAddress(cec_logical_address address); diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 1ea78d7..824e561 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -92,7 +92,6 @@ bool CCECBusDevice::HandleCommand(const cec_command &command) } /* handle the command */ - ReplaceHandler(true); bHandled = m_handler->HandleCommand(command); /* change status to present */ @@ -844,7 +843,6 @@ void CCECBusDevice::SetUnsupportedFeature(cec_opcode opcode) bool CCECBusDevice::InitHandler(void) { CLockObject lock(&m_mutex); - ReplaceHandler(false); return m_handler->InitHandler(); }