Add SAD to AudioPort and encapsulation type to AudioProfile.
Short audio descriptor(SAD) is defined in HDMI specification 1.4b
section 7 that is used to describe the audio capabilities over HDMI.
The encapsulation types represent the encapsulation formats that must be
used when sending the audio data with the format associated with the
AudioProfile to Android.
Bug: 131736540
Bug: 178619392
Test: atest AudioManagerTes
Change-Id: Ie9ab83c8147edfe211363d9676e9cb04dda5b489
diff --git a/media/libaudiofoundation/AudioProfile.cpp b/media/libaudiofoundation/AudioProfile.cpp
index 65f7388..8ac3f73 100644
--- a/media/libaudiofoundation/AudioProfile.cpp
+++ b/media/libaudiofoundation/AudioProfile.cpp
@@ -58,10 +58,18 @@
AudioProfile::AudioProfile(audio_format_t format,
const ChannelMaskSet &channelMasks,
const SampleRateSet &samplingRateCollection) :
+ AudioProfile(format, channelMasks, samplingRateCollection,
+ AUDIO_ENCAPSULATION_TYPE_NONE) {}
+
+AudioProfile::AudioProfile(audio_format_t format,
+ const ChannelMaskSet &channelMasks,
+ const SampleRateSet &samplingRateCollection,
+ audio_encapsulation_type_t encapsulationType) :
mName(""),
mFormat(format),
mChannelMasks(channelMasks),
- mSamplingRates(samplingRateCollection) {}
+ mSamplingRates(samplingRateCollection),
+ mEncapsulationType(encapsulationType) {}
void AudioProfile::setChannels(const ChannelMaskSet &channelMasks)
{
@@ -116,6 +124,9 @@
}
dst->append("\n");
}
+
+ dst->append(base::StringPrintf(
+ "%*s- encapsulation type: %#x\n", spaces, "", mEncapsulationType));
}
bool AudioProfile::equals(const sp<AudioProfile>& other) const
@@ -127,7 +138,8 @@
mSamplingRates == other->getSampleRates() &&
mIsDynamicFormat == other->isDynamicFormat() &&
mIsDynamicChannels == other->isDynamicChannels() &&
- mIsDynamicRate == other->isDynamicRate();
+ mIsDynamicRate == other->isDynamicRate() &&
+ mEncapsulationType == other->getEncapsulationType();
}
AudioProfile& AudioProfile::operator=(const AudioProfile& other) {
@@ -135,6 +147,7 @@
mFormat = other.mFormat;
mChannelMasks = other.mChannelMasks;
mSamplingRates = other.mSamplingRates;
+ mEncapsulationType = other.mEncapsulationType;
mIsDynamicFormat = other.mIsDynamicFormat;
mIsDynamicChannels = other.mIsDynamicChannels;
mIsDynamicRate = other.mIsDynamicRate;
@@ -160,6 +173,8 @@
parcelable.isDynamicFormat = mIsDynamicFormat;
parcelable.isDynamicChannels = mIsDynamicChannels;
parcelable.isDynamicRate = mIsDynamicRate;
+ parcelable.encapsulationType = VALUE_OR_RETURN(
+ legacy2aidl_audio_encapsulation_type_t_AudioEncapsulationType(mEncapsulationType));
return parcelable;
}
@@ -186,6 +201,9 @@
legacy->mIsDynamicFormat = parcelable.isDynamicFormat;
legacy->mIsDynamicChannels = parcelable.isDynamicChannels;
legacy->mIsDynamicRate = parcelable.isDynamicRate;
+ legacy->mEncapsulationType = VALUE_OR_RETURN(
+ aidl2legacy_AudioEncapsulationType_audio_encapsulation_type_t(
+ parcelable.encapsulationType));
return legacy;
}