| 538 | } |
| 539 | |
| 540 | bool CCECClient::SendSetActiveSource(const cec_device_type type /* = CEC_DEVICE_TYPE_RESERVED */) |
| 541 | { |
| 542 | // get the devices that are controlled by us |
| 543 | CECDEVICEVEC devices; |
| 544 | m_processor->GetDevices()->GetByLogicalAddresses(devices, m_configuration.logicalAddresses); |
| 545 | |
| 546 | // filter out the device that matches the given type |
| 547 | if (type != CEC_DEVICE_TYPE_RESERVED) |
| 548 | CCECDeviceMap::FilterType(type, devices); |
| 549 | |
| 550 | // no devices left, re-fetch the list of devices that are controlled by us |
| 551 | if (devices.empty()) |
| 552 | m_processor->GetDevices()->GetByLogicalAddresses(devices, m_configuration.logicalAddresses); |
| 553 | |
| 554 | if (!devices.empty()) |
| 555 | { |
| 556 | // get the first device from the list |
| 557 | CCECBusDevice *device = *devices.begin(); |
| 558 | |
| 559 | // and activate it |
| 560 | if (!m_processor->CECInitialised()) |
| 561 | device->MarkAsActiveSource(); |
| 562 | else if (device->HasValidPhysicalAddress()) |
| 563 | return device->ActivateSource(); |
| 564 | } |
| 565 | |
| 566 | return false; |
| 567 | } |
| 568 | |
| 569 | CCECPlaybackDevice *CCECClient::GetPlaybackDevice(void) |
| 570 | { |
no test coverage detected