cec: silence all 'unused' compiler warnings
[deb_libcec.git] / src / lib / CECProcessor.cpp
index bcaea356f210b55676232e55ebfd9dab8b023939..68e8fbf8ff9e2e4777054401f2b44d4aa53b496d 100644 (file)
@@ -417,7 +417,16 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE
 
   m_busDevices[addr]->SetActiveSource();
   if (m_busDevices[addr]->GetPhysicalAddress(false) != 0xFFFF)
-    bReturn = m_busDevices[addr]->GetHandler()->ActivateSource();
+  {
+    bReturn = m_busDevices[addr]->TransmitActiveSource();
+
+    if (bReturn && (m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE ||
+        m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE) &&
+        m_busDevices[addr]->GetHandler()->SendDeckStatusUpdateOnActiveSource())
+    {
+      bReturn = ((CCECPlaybackDevice *)m_busDevices[addr])->TransmitDeckStatus(CECDEVICE_TV);
+    }
+  }
 
   return bReturn;
 }
@@ -488,14 +497,12 @@ bool CCECProcessor::SetDeckInfo(cec_deck_info info, bool bSendUpdate /* = true *
 bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, bool bForce /* = false */)
 {
   bool bReturn(false);
-  {
-    CLockObject lock(&m_mutex);
+  CLockObject lock(&m_mutex);
 
-    m_iBaseDevice = iBaseDevice;
-    m_iHDMIPort = iPort;
-    if (!m_bStarted && !bForce)
-      return true;
-  }
+  m_iBaseDevice = iBaseDevice;
+  m_iHDMIPort = iPort;
+  if (!m_bStarted && !bForce)
+    return true;
 
   CStdString strLog;
   strLog.Format("setting HDMI port to %d on device %s (%d)", iPort, ToString(iBaseDevice), (int)iBaseDevice);
@@ -503,7 +510,11 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort,
 
   uint16_t iPhysicalAddress(0);
   if (iBaseDevice > CECDEVICE_TV)
+  {
+    lock.Leave();
     iPhysicalAddress = m_busDevices[iBaseDevice]->GetPhysicalAddress();
+    lock.Lock();
+  }
 
   if (iPhysicalAddress < 0xffff)
   {
@@ -588,7 +599,7 @@ bool CCECProcessor::SetMenuState(cec_menu_state state, bool bSendUpdate /* = tru
   return true;
 }
 
-bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress)
+bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpdate /* = true */)
 {
   bool bWasActiveSource(false);
   CLockObject lock(&m_mutex);
@@ -600,10 +611,11 @@ bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress)
         bWasActiveSource |= m_busDevices[iPtr]->IsActiveSource();
         m_busDevices[iPtr]->SetInactiveSource();
         m_busDevices[iPtr]->SetPhysicalAddress(iPhysicalAddress);
-        m_busDevices[iPtr]->TransmitPhysicalAddress();
+        if (bSendUpdate)
+          m_busDevices[iPtr]->TransmitPhysicalAddress();
       }
 
-    return bWasActiveSource ? SetActiveView() : true;
+    return bWasActiveSource && bSendUpdate ? SetActiveView() : true;
   }
   return false;
 }
@@ -1385,7 +1397,7 @@ const char *CCECProcessor::ToString(const cec_system_audio_status mode)
   }
 }
 
-const char *CCECProcessor::ToString(const cec_audio_status status)
+const char *CCECProcessor::ToString(const cec_audio_status UNUSED(status))
 {
   // TODO this is a mask
   return "TODO";