cec: added SetStreamPath()/cec_set_stream_path_logical()/cec_set_stream_path_physical...
[deb_libcec.git] / src / lib / CECProcessor.cpp
index 20b63bd7347ad1726d92647de2a80712d73b8751..78d24360b6da344ed7471379b9e7b96ee097c118 100644 (file)
@@ -162,6 +162,12 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint
   return bReturn;
 }
 
+bool CCECProcessor::IsInitialised(void)
+{
+  CLockObject lock(m_mutex);
+  return m_bInitialised;
+}
+
 void CCECProcessor::SetInitialised(bool bSetTo /* = true */)
 {
   CLockObject lock(m_mutex);
@@ -377,6 +383,9 @@ bool CCECProcessor::FindLogicalAddresses(void)
 
 void CCECProcessor::ReplaceHandlers(void)
 {
+  CLockObject lock(m_mutex);
+  if (!IsInitialised())
+    return;
   for (uint8_t iPtr = 0; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++)
     m_busDevices[iPtr]->ReplaceHandler(m_bInitialised);
 }
@@ -628,6 +637,7 @@ bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpda
   bool bSendActiveView(false);
   bool bReturn(false);
   cec_logical_addresses sendUpdatesTo;
+  sendUpdatesTo.Clear();
 
   {
     CLockObject lock(m_mutex);
@@ -1315,10 +1325,16 @@ bool CCECProcessor::PingAdapter(void)
 
 void CCECProcessor::HandlePoll(cec_logical_address initiator, cec_logical_address destination)
 {
-  m_busDevices[initiator]->GetHandler()->HandlePoll(initiator, destination);
+  m_busDevices[initiator]->HandlePoll(destination);
 }
 
 bool CCECProcessor::HandleReceiveFailed(cec_logical_address initiator)
 {
-  return !m_busDevices[initiator]->GetHandler()->HandleReceiveFailed();
+  return !m_busDevices[initiator]->HandleReceiveFailed();
+}
+
+bool CCECProcessor::SetStreamPath(uint16_t iPhysicalAddress)
+{
+  // stream path changes are sent by the TV
+  return m_busDevices[CECDEVICE_TV]->GetHandler()->TransmitSetStreamPath(iPhysicalAddress);
 }