mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "audio: Allow Module subclasses to customize Configuration" into main am: 00a7a24e0a am: 9767286509 am: 4125bf3bcf am: 12bbfe0526
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2656082 Change-Id: Ia6c89e8607921de16d80caa86f314c973d926d32 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -286,22 +286,28 @@ std::set<int32_t> Module::portIdsFromPortConfigIds(C portConfigIds) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<internal::Configuration> Module::initializeConfig() {
|
||||
std::unique_ptr<internal::Configuration> config;
|
||||
switch (getType()) {
|
||||
case Type::DEFAULT:
|
||||
config = std::move(internal::getPrimaryConfiguration());
|
||||
break;
|
||||
case Type::R_SUBMIX:
|
||||
config = std::move(internal::getRSubmixConfiguration());
|
||||
break;
|
||||
case Type::STUB:
|
||||
config = std::move(internal::getStubConfiguration());
|
||||
break;
|
||||
case Type::USB:
|
||||
config = std::move(internal::getUsbConfiguration());
|
||||
break;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
internal::Configuration& Module::getConfig() {
|
||||
if (!mConfig) {
|
||||
switch (mType) {
|
||||
case Type::DEFAULT:
|
||||
mConfig = std::move(internal::getPrimaryConfiguration());
|
||||
break;
|
||||
case Type::R_SUBMIX:
|
||||
mConfig = std::move(internal::getRSubmixConfiguration());
|
||||
break;
|
||||
case Type::STUB:
|
||||
mConfig = std::move(internal::getStubConfiguration());
|
||||
break;
|
||||
case Type::USB:
|
||||
mConfig = std::move(internal::getUsbConfiguration());
|
||||
break;
|
||||
}
|
||||
mConfig = std::move(initializeConfig());
|
||||
}
|
||||
return *mConfig;
|
||||
}
|
||||
|
||||
@@ -182,6 +182,7 @@ class Module : public BnModule {
|
||||
const ::aidl::android::media::audio::common::AudioPort& audioPort, bool connected);
|
||||
virtual ndk::ScopedAStatus onMasterMuteChanged(bool mute);
|
||||
virtual ndk::ScopedAStatus onMasterVolumeChanged(float volume);
|
||||
virtual std::unique_ptr<internal::Configuration> initializeConfig();
|
||||
|
||||
// Utility and helper functions accessible to subclasses.
|
||||
void cleanUpPatch(int32_t patchId);
|
||||
@@ -202,6 +203,7 @@ class Module : public BnModule {
|
||||
bool getMicMute() const { return mMicMute; }
|
||||
const Patches& getPatches() const { return mPatches; }
|
||||
const Streams& getStreams() const { return mStreams; }
|
||||
Type getType() const { return mType; }
|
||||
bool isMmapSupported();
|
||||
template <typename C>
|
||||
std::set<int32_t> portIdsFromPortConfigIds(C portConfigIds);
|
||||
|
||||
Reference in New Issue
Block a user