cec: transmit the menu state as (active) when the stream path is set
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 11 Nov 2011 17:05:30 +0000 (18:05 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 11 Nov 2011 17:05:30 +0000 (18:05 +0100)
src/lib/CECProcessor.cpp
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/VLCommandHandler.cpp
src/lib/implementations/VLCommandHandler.h

index f2eafaac5022bf095a7a6b678c61fd16151105ba..8247eb35ba7ba0e9f7a3de9f445a3e998f0e6eb8 100644 (file)
@@ -364,11 +364,6 @@ bool CCECProcessor::SetStreamPath(uint16_t iStreamPath)
 
     device->m_bActiveSource = true;
     device->m_powerStatus   = CEC_POWER_STATUS_ON;
-
-    if (m_logicalAddresses.isset(device->m_iLogicalAddress))
-      bReturn = device->TransmitActiveSource();
-    else
-      bReturn = true;
   }
 
   return bReturn;
index a6b5d10302bab4c7baf77997620d25b8b9f88922..fee99806079f8aae569b87ad20ac7d82aebaf96a 100644 (file)
@@ -356,12 +356,21 @@ bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command)
 {
   if (command.parameters.size >= 2)
   {
-    uint16_t streamaddr = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
+    uint16_t iStreamAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
     CStdString strLog;
-    strLog.Format(">> %i sets stream path to physical address %04x", command.initiator, streamaddr);
+    strLog.Format(">> %i sets stream path to physical address %04x", command.initiator, iStreamAddress);
     m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
 
-    return m_busDevice->GetProcessor()->SetStreamPath(streamaddr);
+    if (m_busDevice->GetProcessor()->SetStreamPath(iStreamAddress))
+    {
+      CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress);
+      if (device)
+      {
+        return device->TransmitActiveSource() &&
+            device->TransmitMenuState(command.initiator);
+      }
+    }
+    return false;
   }
   return true;
 }
index e3d570bf6f1e0dd51ec2965c354f4eaaec2f3738..fbbfa290c9b021690eca84182f97f1737d783257 100644 (file)
@@ -40,25 +40,3 @@ CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice) :
     CCECCommandHandler(busDevice)
 {
 }
-
-bool CVLCommandHandler::HandleSetStreamPath(const cec_command &command)
-{
-  if (command.parameters.size >= 2)
-  {
-    int streamaddr = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
-    CStdString strLog;
-    strLog.Format(">> %i requests stream path from physical address %04x", command.initiator, streamaddr);
-    m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str());
-    if (streamaddr == m_busDevice->GetMyPhysicalAddress())
-    {
-      CCECBusDevice *device = GetDevice(command.destination);
-      if (device)
-      {
-        return device->TransmitActiveSource() &&
-               device->TransmitMenuState(command.initiator);
-      }
-      return false;
-    }
-  }
-  return true;
-}
index 57213e96e5328d869286e167c2fd308c750c2be5..3959ad79b1f2a3ba6ea8ea6d508aebb9d3796e29 100644 (file)
@@ -41,8 +41,5 @@ namespace CEC
     CVLCommandHandler(CCECBusDevice *busDevice);
     virtual ~CVLCommandHandler(void) {};
     virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_PANASONIC; };
-
-  protected:
-    virtual bool HandleSetStreamPath(const cec_command &command);
   };
 };