|
|
@ -114,7 +114,7 @@ Return<void> Stream::getSupportedSampleRates(AudioFormat format, |
|
|
|
SampleRateSet halSampleRates; |
|
|
|
SampleRateSet halSampleRates; |
|
|
|
if (result == Result::OK) { |
|
|
|
if (result == Result::OK) { |
|
|
|
halSampleRates = |
|
|
|
halSampleRates = |
|
|
|
samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator); |
|
|
|
samplingRatesFromString(halListValue.c_str(), AudioParameter::valueListSeparator); |
|
|
|
sampleRates = hidl_vec<uint32_t>(halSampleRates.begin(), halSampleRates.end()); |
|
|
|
sampleRates = hidl_vec<uint32_t>(halSampleRates.begin(), halSampleRates.end()); |
|
|
|
// Legacy get_parameter does not return a status_t, thus can not advertise of failure.
|
|
|
|
// Legacy get_parameter does not return a status_t, thus can not advertise of failure.
|
|
|
|
// Note that this method must succeed (non empty list) if the format is supported.
|
|
|
|
// Note that this method must succeed (non empty list) if the format is supported.
|
|
|
@ -140,7 +140,7 @@ Return<void> Stream::getSupportedChannelMasks(AudioFormat format, |
|
|
|
ChannelMaskSet halChannelMasks; |
|
|
|
ChannelMaskSet halChannelMasks; |
|
|
|
if (result == Result::OK) { |
|
|
|
if (result == Result::OK) { |
|
|
|
halChannelMasks = |
|
|
|
halChannelMasks = |
|
|
|
channelMasksFromString(halListValue.string(), AudioParameter::valueListSeparator); |
|
|
|
channelMasksFromString(halListValue.c_str(), AudioParameter::valueListSeparator); |
|
|
|
channelMasks.resize(halChannelMasks.size()); |
|
|
|
channelMasks.resize(halChannelMasks.size()); |
|
|
|
size_t i = 0; |
|
|
|
size_t i = 0; |
|
|
|
for (auto channelMask : halChannelMasks) { |
|
|
|
for (auto channelMask : halChannelMasks) { |
|
|
@ -182,7 +182,7 @@ Return<void> Stream::getSupportedFormats(getSupportedFormats_cb _hidl_cb) { |
|
|
|
hidl_vec<AudioFormat> formats; |
|
|
|
hidl_vec<AudioFormat> formats; |
|
|
|
FormatVector halFormats; |
|
|
|
FormatVector halFormats; |
|
|
|
if (result == Result::OK) { |
|
|
|
if (result == Result::OK) { |
|
|
|
halFormats = formatsFromString(halListValue.string(), AudioParameter::valueListSeparator); |
|
|
|
halFormats = formatsFromString(halListValue.c_str(), AudioParameter::valueListSeparator); |
|
|
|
formats.resize(halFormats.size()); |
|
|
|
formats.resize(halFormats.size()); |
|
|
|
for (size_t i = 0; i < halFormats.size(); ++i) { |
|
|
|
for (size_t i = 0; i < halFormats.size(); ++i) { |
|
|
|
formats[i] = AudioFormat(halFormats[i]); |
|
|
|
formats[i] = AudioFormat(halFormats[i]); |
|
|
@ -226,7 +226,7 @@ Return<void> Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { |
|
|
|
// Ensure that the separator is one character, despite that it's defined as a C string.
|
|
|
|
// Ensure that the separator is one character, despite that it's defined as a C string.
|
|
|
|
static_assert(sizeof(AUDIO_PARAMETER_VALUE_LIST_SEPARATOR) == 2); |
|
|
|
static_assert(sizeof(AUDIO_PARAMETER_VALUE_LIST_SEPARATOR) == 2); |
|
|
|
std::vector<std::string> halFormats = |
|
|
|
std::vector<std::string> halFormats = |
|
|
|
splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); |
|
|
|
splitString(halListValue.c_str(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); |
|
|
|
hidl_vec<AudioFormat> formats; |
|
|
|
hidl_vec<AudioFormat> formats; |
|
|
|
(void)HidlUtils::audioFormatsFromHal(halFormats, &formats); |
|
|
|
(void)HidlUtils::audioFormatsFromHal(halFormats, &formats); |
|
|
|
std::vector<AudioProfile> tempProfiles; |
|
|
|
std::vector<AudioProfile> tempProfiles; |
|
|
@ -241,7 +241,7 @@ Return<void> Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { |
|
|
|
result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue, context); |
|
|
|
result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue, context); |
|
|
|
if (result != Result::OK) break; |
|
|
|
if (result != Result::OK) break; |
|
|
|
std::vector<std::string> halSampleRates = |
|
|
|
std::vector<std::string> halSampleRates = |
|
|
|
splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); |
|
|
|
splitString(halListValue.c_str(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); |
|
|
|
hidl_vec<uint32_t> sampleRates; |
|
|
|
hidl_vec<uint32_t> sampleRates; |
|
|
|
sampleRates.resize(halSampleRates.size()); |
|
|
|
sampleRates.resize(halSampleRates.size()); |
|
|
|
for (size_t i = 0; i < sampleRates.size(); ++i) { |
|
|
|
for (size_t i = 0; i < sampleRates.size(); ++i) { |
|
|
@ -251,7 +251,7 @@ Return<void> Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { |
|
|
|
result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue, context); |
|
|
|
result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue, context); |
|
|
|
if (result != Result::OK) break; |
|
|
|
if (result != Result::OK) break; |
|
|
|
std::vector<std::string> halChannelMasks = |
|
|
|
std::vector<std::string> halChannelMasks = |
|
|
|
splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); |
|
|
|
splitString(halListValue.c_str(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); |
|
|
|
hidl_vec<AudioChannelMask> channelMasks; |
|
|
|
hidl_vec<AudioChannelMask> channelMasks; |
|
|
|
(void)HidlUtils::audioChannelMasksFromHal(halChannelMasks, &channelMasks); |
|
|
|
(void)HidlUtils::audioChannelMasksFromHal(halChannelMasks, &channelMasks); |
|
|
|
// Create a profile.
|
|
|
|
// Create a profile.
|
|
|
|