Merge "audio: Use the canonical direction port direction in ModuleUsb"
This commit is contained in:
commit
5a9edcec4c
2 changed files with 2 additions and 26 deletions
|
@ -111,30 +111,6 @@ constexpr bool isTelephonyDeviceType(
|
||||||
device == ::aidl::android::media::audio::common::AudioDeviceType::OUT_TELEPHONY_TX;
|
device == ::aidl::android::media::audio::common::AudioDeviceType::OUT_TELEPHONY_TX;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool isUsbInputDeviceType(::aidl::android::media::audio::common::AudioDeviceType type) {
|
|
||||||
switch (type) {
|
|
||||||
case ::aidl::android::media::audio::common::AudioDeviceType::IN_DOCK:
|
|
||||||
case ::aidl::android::media::audio::common::AudioDeviceType::IN_ACCESSORY:
|
|
||||||
case ::aidl::android::media::audio::common::AudioDeviceType::IN_DEVICE:
|
|
||||||
case ::aidl::android::media::audio::common::AudioDeviceType::IN_HEADSET:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isUsbOutputtDeviceType(::aidl::android::media::audio::common::AudioDeviceType type) {
|
|
||||||
switch (type) {
|
|
||||||
case ::aidl::android::media::audio::common::AudioDeviceType::OUT_DOCK:
|
|
||||||
case ::aidl::android::media::audio::common::AudioDeviceType::OUT_ACCESSORY:
|
|
||||||
case ::aidl::android::media::audio::common::AudioDeviceType::OUT_DEVICE:
|
|
||||||
case ::aidl::android::media::audio::common::AudioDeviceType::OUT_HEADSET:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isValidAudioMode(::aidl::android::media::audio::common::AudioMode mode) {
|
constexpr bool isValidAudioMode(::aidl::android::media::audio::common::AudioMode mode) {
|
||||||
return std::find(kValidAudioModes.begin(), kValidAudioModes.end(), mode) !=
|
return std::find(kValidAudioModes.begin(), kValidAudioModes.end(), mode) !=
|
||||||
kValidAudioModes.end();
|
kValidAudioModes.end();
|
||||||
|
|
|
@ -30,13 +30,13 @@ extern "C" {
|
||||||
#include "alsa_device_profile.h"
|
#include "alsa_device_profile.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
using aidl::android::hardware::audio::common::isUsbInputDeviceType;
|
|
||||||
using aidl::android::media::audio::common::AudioChannelLayout;
|
using aidl::android::media::audio::common::AudioChannelLayout;
|
||||||
using aidl::android::media::audio::common::AudioDeviceAddress;
|
using aidl::android::media::audio::common::AudioDeviceAddress;
|
||||||
using aidl::android::media::audio::common::AudioDeviceDescription;
|
using aidl::android::media::audio::common::AudioDeviceDescription;
|
||||||
using aidl::android::media::audio::common::AudioDeviceType;
|
using aidl::android::media::audio::common::AudioDeviceType;
|
||||||
using aidl::android::media::audio::common::AudioFormatDescription;
|
using aidl::android::media::audio::common::AudioFormatDescription;
|
||||||
using aidl::android::media::audio::common::AudioFormatType;
|
using aidl::android::media::audio::common::AudioFormatType;
|
||||||
|
using aidl::android::media::audio::common::AudioIoFlags;
|
||||||
using aidl::android::media::audio::common::AudioPort;
|
using aidl::android::media::audio::common::AudioPort;
|
||||||
using aidl::android::media::audio::common::AudioPortConfig;
|
using aidl::android::media::audio::common::AudioPortConfig;
|
||||||
using aidl::android::media::audio::common::AudioPortExt;
|
using aidl::android::media::audio::common::AudioPortExt;
|
||||||
|
@ -117,7 +117,7 @@ ndk::ScopedAStatus ModuleUsb::populateConnectedDevicePort(AudioPort* audioPort)
|
||||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool isInput = isUsbInputDeviceType(devicePort.device.type.type);
|
const bool isInput = audioPort->flags.getTag() == AudioIoFlags::input;
|
||||||
alsa_device_profile profile;
|
alsa_device_profile profile;
|
||||||
profile_init(&profile, isInput ? PCM_IN : PCM_OUT);
|
profile_init(&profile, isInput ? PCM_IN : PCM_OUT);
|
||||||
profile.card = alsaAddress[0];
|
profile.card = alsaAddress[0];
|
||||||
|
|
Loading…
Reference in a new issue