return bReturn;
}
+void CCECBusDevice::SetActiveRoute(uint16_t iRoute)
+{
+ CCECDeviceMap* map = m_processor->GetDevices();
+ if (!map)
+ return;
+
+ CCECBusDevice* previouslyActive = map->GetActiveSource();
+ if (!previouslyActive)
+ return;
+
+ CECDEVICEVEC devices;
+ m_processor->GetDevices()->GetChildrenOf(devices, this);
+
+ for (CECDEVICEVEC::iterator it = devices.begin(); it != devices.end(); it++)
+ {
+ if (!CCECTypeUtils::PhysicalAddressIsIncluded(iRoute, (*it)->GetCurrentPhysicalAddress()))
+ (*it)->MarkAsInactiveSource();
+ }
+}
+
void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */)
{
CLockObject lock(m_mutex);
virtual bool TransmitImageViewOn(void);
virtual bool TransmitInactiveSource(void);
virtual bool TransmitPendingActiveSourceCommands(void);
+ virtual void SetActiveRoute(uint16_t iRoute);
virtual void SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress = CEC_INVALID_PHYSICAL_ADDRESS);
virtual bool PowerOn(const cec_logical_address initiator);
{
if (command.parameters.size == 4)
{
- uint16_t iOldAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
- uint16_t iNewAddress = ((uint16_t)command.parameters[2] << 8) | ((uint16_t)command.parameters[3]);
-
CCECBusDevice *device = GetDevice(command.initiator);
if (device)
{
- device->SetStreamPath(iNewAddress, iOldAddress);
+ uint16_t iNewAddress = ((uint16_t)command.parameters[2] << 8) | ((uint16_t)command.parameters[3]);
+ device->SetActiveRoute(iNewAddress);
return COMMAND_HANDLED;
}
}
{
if (command.parameters.size == 2)
{
- uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
- CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iNewAddress);
+ CCECBusDevice *device = GetDevice(command.initiator);
if (device)
{
- device->MarkAsActiveSource();
+ uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
+ device->SetActiveRoute(iNewAddress);
return COMMAND_HANDLED;
}
}
uint16_t iStreamAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
LIB_CEC->AddLog(CEC_LOG_DEBUG, ">> %s (%x) sets stream path to physical address %04x", ToString(command.initiator), command.initiator, iStreamAddress);
- // a device will only change the stream path when it's powered on
- m_busDevice->SetPowerStatus(CEC_POWER_STATUS_ON);
-
/* one of the device handled by libCEC has been made active */
CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamAddress);
if (device && device->IsHandledByLibCEC())