Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9410d2ed authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "adtConversion"

* changes:
  Refactor for audio device type in conversion.
  Use AudioDeviceTypeAddr when setting device for effects.
  Add constructor with type and address for DeviceDescriptor.
parents 6a9d20ee aff2869b
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -42,6 +42,13 @@ const DeviceTypeSet& getAudioDeviceOutAllScoSet() {
    return audioDeviceOutAllScoSet;
}

const DeviceTypeSet& getAudioDeviceOutAllUsbSet() {
    static const DeviceTypeSet audioDeviceOutAllUsbSet = DeviceTypeSet(
            std::begin(AUDIO_DEVICE_OUT_ALL_USB_ARRAY),
            std::end(AUDIO_DEVICE_OUT_ALL_USB_ARRAY));
    return audioDeviceOutAllUsbSet;
}

const DeviceTypeSet& getAudioDeviceInAllSet() {
    static const DeviceTypeSet audioDeviceInAllSet = DeviceTypeSet(
            std::begin(AUDIO_DEVICE_IN_ALL_ARRAY),
@@ -49,6 +56,13 @@ const DeviceTypeSet& getAudioDeviceInAllSet() {
    return audioDeviceInAllSet;
}

const DeviceTypeSet& getAudioDeviceInAllUsbSet() {
    static const DeviceTypeSet audioDeviceInAllUsbSet = DeviceTypeSet(
            std::begin(AUDIO_DEVICE_IN_ALL_USB_ARRAY),
            std::end(AUDIO_DEVICE_IN_ALL_USB_ARRAY));
    return audioDeviceInAllUsbSet;
}

bool deviceTypesToString(const DeviceTypeSet &deviceTypes, std::string &str) {
    if (deviceTypes.empty()) {
        str = "Empty device types";
+15 −5
Original line number Diff line number Diff line
@@ -25,12 +25,22 @@
namespace android {

DeviceDescriptorBase::DeviceDescriptorBase(audio_devices_t type) :
        DeviceDescriptorBase(type, "")
{
}

DeviceDescriptorBase::DeviceDescriptorBase(audio_devices_t type, const std::string& address) :
        DeviceDescriptorBase(AudioDeviceTypeAddr(type, address))
{
}

DeviceDescriptorBase::DeviceDescriptorBase(const AudioDeviceTypeAddr &deviceTypeAddr) :
        AudioPort("", AUDIO_PORT_TYPE_DEVICE,
              audio_is_output_device(type) ? AUDIO_PORT_ROLE_SINK :
                                             AUDIO_PORT_ROLE_SOURCE)
                  audio_is_output_device(deviceTypeAddr.mType) ? AUDIO_PORT_ROLE_SINK :
                                         AUDIO_PORT_ROLE_SOURCE),
        mDeviceTypeAddr(deviceTypeAddr)
{
    mDeviceTypeAddr.mType = type;
    if (audio_is_remote_submix_device(type)) {
    if (mDeviceTypeAddr.mAddress.empty() && audio_is_remote_submix_device(mDeviceTypeAddr.mType)) {
        mDeviceTypeAddr.mAddress = "0";
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -37,7 +37,9 @@ using FormatVector = std::vector<audio_format_t>;
const DeviceTypeSet& getAudioDeviceOutAllSet();
const DeviceTypeSet& getAudioDeviceOutAllA2dpSet();
const DeviceTypeSet& getAudioDeviceOutAllScoSet();
const DeviceTypeSet& getAudioDeviceOutAllUsbSet();
const DeviceTypeSet& getAudioDeviceInAllSet();
const DeviceTypeSet& getAudioDeviceInAllUsbSet();

template<typename T>
static std::vector<T> Intersection(const std::set<T>& a, const std::set<T>& b) {
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ class DeviceDescriptorBase : public AudioPort, public AudioPortConfig
public:
     // Note that empty name refers by convention to a generic device.
    explicit DeviceDescriptorBase(audio_devices_t type);
    DeviceDescriptorBase(audio_devices_t type, const std::string& address);
    explicit DeviceDescriptorBase(const AudioDeviceTypeAddr& deviceTypeAddr);

    virtual ~DeviceDescriptorBase() {}

+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ cc_defaults {
        "android.hardware.audio.common-util",
        "android.hidl.allocator@1.0",
        "android.hidl.memory@1.0",
        "libaudiofoundation",
        "libaudiohal_deathhandler",
        "libaudioutils",
        "libbase",
Loading