Loading services/audiopolicy/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ LOCAL_C_INCLUDES := \ $(call include-path-for, audio-utils) \ $(TOPDIR)frameworks/av/services/audiopolicy/common/include \ $(TOPDIR)frameworks/av/services/audiopolicy/engine/interface \ $(TOPDIR)frameworks/av/services/audiopolicy/utilities \ LOCAL_SHARED_LIBRARIES := \ libcutils \ Loading Loading @@ -84,6 +85,7 @@ endif LOCAL_C_INCLUDES += \ $(TOPDIR)frameworks/av/services/audiopolicy/common/include \ $(TOPDIR)frameworks/av/services/audiopolicy/engine/interface \ $(TOPDIR)frameworks/av/services/audiopolicy/utilities \ LOCAL_STATIC_LIBRARIES := \ libmedia_helper \ Loading services/audiopolicy/common/managerdefinitions/Android.mk +4 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ LOCAL_SRC_FILES:= \ src/ConfigParsingUtils.cpp \ src/SoundTriggerSession.cpp \ src/SessionRoute.cpp \ src/AudioSourceDescriptor.cpp src/AudioSourceDescriptor.cpp \ src/TypeConverter.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ Loading @@ -27,7 +28,8 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/include \ $(TOPDIR)frameworks/av/services/audiopolicy/common/include \ $(TOPDIR)frameworks/av/services/audiopolicy $(TOPDIR)frameworks/av/services/audiopolicy \ $(TOPDIR)frameworks/av/services/audiopolicy/utilities \ LOCAL_EXPORT_C_INCLUDE_DIRS := \ $(LOCAL_PATH)/include Loading services/audiopolicy/common/managerdefinitions/include/AudioGain.h +29 −0 Original line number Diff line number Diff line Loading @@ -28,10 +28,39 @@ public: AudioGain(int index, bool useInChannelMask); virtual ~AudioGain() {} void setMode(audio_gain_mode_t mode) { mGain.mode = mode; } const audio_gain_mode_t &getMode() const { return mGain.mode; } void setChannelMask(audio_channel_mask_t mask) { mGain.channel_mask = mask; } const audio_channel_mask_t &getChannelMask() const { return mGain.channel_mask; } void setMinValueInMb(int minValue) { mGain.min_value = minValue; } int getMinValueInMb() const { return mGain.min_value; } void setMaxValueInMb(int maxValue) { mGain.max_value = maxValue; } int getMaxValueInMb() const { return mGain.max_value; } void setDefaultValueInMb(int defaultValue) { mGain.default_value = defaultValue; } int getDefaultValueInMb() const { return mGain.default_value; } void setStepValueInMb(uint32_t stepValue) { mGain.step_value = stepValue; } int getStepValueInMb() const { return mGain.step_value; } void setMinRampInMs(uint32_t minRamp) { mGain.min_ramp_ms = minRamp; } int getMinRampInMs() const { return mGain.min_ramp_ms; } void setMaxRampInMs(uint32_t maxRamp) { mGain.max_ramp_ms = maxRamp; } int getMaxRampInMs() const { return mGain.max_ramp_ms; } // TODO: remove dump from here (split serialization) void dump(int fd, int spaces, int index) const; void getDefaultConfig(struct audio_gain_config *config); status_t checkConfig(const struct audio_gain_config *config); const struct audio_gain &getGain() const { return mGain; } private: int mIndex; struct audio_gain mGain; bool mUseInChannelMask; Loading services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h 0 → 100644 +130 −0 Original line number Diff line number Diff line /* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <AudioGain.h> #include <AudioPort.h> #include <AudioPatch.h> #include <DeviceDescriptor.h> #include <IOProfile.h> #include <HwModule.h> #include <AudioInputDescriptor.h> #include <AudioOutputDescriptor.h> #include <AudioPolicyMix.h> #include <EffectDescriptor.h> #include <SoundTriggerSession.h> #include <StreamDescriptor.h> #include <SessionRoute.h> namespace android { class AudioPolicyConfig { public: AudioPolicyConfig(HwModuleCollection &hwModules, DeviceVector &availableOutputDevices, DeviceVector &availableInputDevices, sp<DeviceDescriptor> &defaultOutputDevices, bool &isSpeakerDrcEnabled) : mHwModules(hwModules), mAvailableOutputDevices(availableOutputDevices), mAvailableInputDevices(availableInputDevices), mDefaultOutputDevices(defaultOutputDevices), mIsSpeakerDrcEnabled(isSpeakerDrcEnabled) {} void setHwModules(const HwModuleCollection &hwModules) { mHwModules = hwModules; } void addAvailableInputDevices(const DeviceVector &availableInputDevices) { mAvailableInputDevices.add(availableInputDevices); } void addAvailableOutputDevices(const DeviceVector &availableOutputDevices) { mAvailableOutputDevices.add(availableOutputDevices); } void setSpeakerDrcEnabled(bool isSpeakerDrcEnabled) { mIsSpeakerDrcEnabled = isSpeakerDrcEnabled; } const HwModuleCollection getHwModules() const { return mHwModules; } const DeviceVector &getAvailableInputDevices() const { return mAvailableInputDevices; } const DeviceVector &getAvailableOutputDevices() const { return mAvailableOutputDevices; } void setDefaultOutputDevice(const sp<DeviceDescriptor> &defaultDevice) { mDefaultOutputDevices = defaultDevice; } const sp<DeviceDescriptor> &getDefaultOutputDevice() const { return mDefaultOutputDevices; } void setDefault(void) { mDefaultOutputDevices = new DeviceDescriptor(AUDIO_DEVICE_OUT_SPEAKER); sp<HwModule> module; sp<DeviceDescriptor> defaultInputDevice = new DeviceDescriptor(AUDIO_DEVICE_IN_BUILTIN_MIC); mAvailableOutputDevices.add(mDefaultOutputDevices); mAvailableInputDevices.add(defaultInputDevice); module = new HwModule("primary"); sp<OutputProfile> outProfile; outProfile = new OutputProfile(String8("primary")); outProfile->attach(module); outProfile->mSamplingRates.add(44100); outProfile->mFormats.add(AUDIO_FORMAT_PCM_16_BIT); outProfile->mChannelMasks.add(AUDIO_CHANNEL_OUT_STEREO); outProfile->addSupportedDevice(mDefaultOutputDevices); outProfile->setFlags(AUDIO_OUTPUT_FLAG_PRIMARY); module->mOutputProfiles.add(outProfile); sp<InputProfile> inProfile; inProfile = new InputProfile(String8("primary")); inProfile->attach(module); inProfile->mSamplingRates.add(8000); inProfile->mFormats.add(AUDIO_FORMAT_PCM_16_BIT); inProfile->mChannelMasks.add(AUDIO_CHANNEL_IN_MONO); inProfile->addSupportedDevice(defaultInputDevice); module->mInputProfiles.add(inProfile); mHwModules.add(module); } private: HwModuleCollection &mHwModules; /**< Collection of Module, with Profiles, i.e. Mix Ports. */ DeviceVector &mAvailableOutputDevices; DeviceVector &mAvailableInputDevices; sp<DeviceDescriptor> &mDefaultOutputDevices; bool &mIsSpeakerDrcEnabled; }; }; // namespace android services/audiopolicy/common/managerdefinitions/include/AudioPort.h +34 −16 Original line number Diff line number Diff line Loading @@ -27,14 +27,27 @@ namespace android { class HwModule; class AudioGain; typedef Vector<sp<AudioGain> > AudioGainCollection; class AudioPort : public virtual RefBase { public: AudioPort(const String8& name, audio_port_type_t type, audio_port_role_t role); AudioPort(const String8& name, audio_port_type_t type, audio_port_role_t role) : mName(name), mType(type), mRole(role), mFlags(AUDIO_OUTPUT_FLAG_NONE) {} virtual ~AudioPort() {} const String8 &getName() const { return mName; } audio_port_type_t getType() const { return mType; } audio_port_role_t getRole() const { return mRole; } void setGains(const AudioGainCollection &gains) { mGains = gains; } const AudioGainCollection &getGains() const { return mGains; } void setFlags(uint32_t flags) { mFlags = flags; } uint32_t getFlags() const { return mFlags; } virtual void attach(const sp<HwModule>& module); bool isAttached() { return mModule != 0; } Loading @@ -45,14 +58,15 @@ public: virtual void importAudioPort(const sp<AudioPort> port); void clearCapabilities(); void loadSamplingRates(char *name); void loadFormats(char *name); void loadOutChannels(char *name); void loadInChannels(char *name); audio_gain_mode_t loadGainMode(char *name); void loadGain(cnode *root, int index); virtual void loadGains(cnode *root); void setSupportedFormats(const Vector <audio_format_t> &formats); void setSupportedSamplingRates(const Vector <uint32_t> &sampleRates) { mSamplingRates = sampleRates; } void setSupportedChannelMasks(const Vector <audio_channel_mask_t> &channelMasks) { mChannelMasks = channelMasks; } // searches for an exact match status_t checkExactSamplingRate(uint32_t samplingRate) const; Loading Loading @@ -84,25 +98,29 @@ public: uint32_t getModuleVersion() const; const char *getModuleName() const; bool useInputChannelMask() const { return ((mType == AUDIO_PORT_TYPE_DEVICE) && (mRole == AUDIO_PORT_ROLE_SOURCE)) || ((mType == AUDIO_PORT_TYPE_MIX) && (mRole == AUDIO_PORT_ROLE_SINK)); } void dump(int fd, int spaces) const; void log(const char* indent) const; String8 mName; audio_port_type_t mType; audio_port_role_t mRole; bool mUseInChannelMask; // by convention, "0' in the first entry in mSamplingRates, mChannelMasks or mFormats // indicates the supported parameters should be read from the output stream // after it is opened for the first time Vector <uint32_t> mSamplingRates; // supported sampling rates Vector <audio_channel_mask_t> mChannelMasks; // supported channel masks Vector <audio_format_t> mFormats; // supported audio formats Vector < sp<AudioGain> > mGains; // gain controllers AudioGainCollection mGains; // gain controllers sp<HwModule> mModule; // audio HW module exposing this I/O stream uint32_t mFlags; // attribute flags (e.g primary output, // direct output...). private: audio_port_type_t mType; audio_port_role_t mRole; uint32_t mFlags; // attribute flags mask (e.g primary output, direct output...). static volatile int32_t mNextUniqueId; }; Loading Loading
services/audiopolicy/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ LOCAL_C_INCLUDES := \ $(call include-path-for, audio-utils) \ $(TOPDIR)frameworks/av/services/audiopolicy/common/include \ $(TOPDIR)frameworks/av/services/audiopolicy/engine/interface \ $(TOPDIR)frameworks/av/services/audiopolicy/utilities \ LOCAL_SHARED_LIBRARIES := \ libcutils \ Loading Loading @@ -84,6 +85,7 @@ endif LOCAL_C_INCLUDES += \ $(TOPDIR)frameworks/av/services/audiopolicy/common/include \ $(TOPDIR)frameworks/av/services/audiopolicy/engine/interface \ $(TOPDIR)frameworks/av/services/audiopolicy/utilities \ LOCAL_STATIC_LIBRARIES := \ libmedia_helper \ Loading
services/audiopolicy/common/managerdefinitions/Android.mk +4 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ LOCAL_SRC_FILES:= \ src/ConfigParsingUtils.cpp \ src/SoundTriggerSession.cpp \ src/SessionRoute.cpp \ src/AudioSourceDescriptor.cpp src/AudioSourceDescriptor.cpp \ src/TypeConverter.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ Loading @@ -27,7 +28,8 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/include \ $(TOPDIR)frameworks/av/services/audiopolicy/common/include \ $(TOPDIR)frameworks/av/services/audiopolicy $(TOPDIR)frameworks/av/services/audiopolicy \ $(TOPDIR)frameworks/av/services/audiopolicy/utilities \ LOCAL_EXPORT_C_INCLUDE_DIRS := \ $(LOCAL_PATH)/include Loading
services/audiopolicy/common/managerdefinitions/include/AudioGain.h +29 −0 Original line number Diff line number Diff line Loading @@ -28,10 +28,39 @@ public: AudioGain(int index, bool useInChannelMask); virtual ~AudioGain() {} void setMode(audio_gain_mode_t mode) { mGain.mode = mode; } const audio_gain_mode_t &getMode() const { return mGain.mode; } void setChannelMask(audio_channel_mask_t mask) { mGain.channel_mask = mask; } const audio_channel_mask_t &getChannelMask() const { return mGain.channel_mask; } void setMinValueInMb(int minValue) { mGain.min_value = minValue; } int getMinValueInMb() const { return mGain.min_value; } void setMaxValueInMb(int maxValue) { mGain.max_value = maxValue; } int getMaxValueInMb() const { return mGain.max_value; } void setDefaultValueInMb(int defaultValue) { mGain.default_value = defaultValue; } int getDefaultValueInMb() const { return mGain.default_value; } void setStepValueInMb(uint32_t stepValue) { mGain.step_value = stepValue; } int getStepValueInMb() const { return mGain.step_value; } void setMinRampInMs(uint32_t minRamp) { mGain.min_ramp_ms = minRamp; } int getMinRampInMs() const { return mGain.min_ramp_ms; } void setMaxRampInMs(uint32_t maxRamp) { mGain.max_ramp_ms = maxRamp; } int getMaxRampInMs() const { return mGain.max_ramp_ms; } // TODO: remove dump from here (split serialization) void dump(int fd, int spaces, int index) const; void getDefaultConfig(struct audio_gain_config *config); status_t checkConfig(const struct audio_gain_config *config); const struct audio_gain &getGain() const { return mGain; } private: int mIndex; struct audio_gain mGain; bool mUseInChannelMask; Loading
services/audiopolicy/common/managerdefinitions/include/AudioPolicyConfig.h 0 → 100644 +130 −0 Original line number Diff line number Diff line /* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <AudioGain.h> #include <AudioPort.h> #include <AudioPatch.h> #include <DeviceDescriptor.h> #include <IOProfile.h> #include <HwModule.h> #include <AudioInputDescriptor.h> #include <AudioOutputDescriptor.h> #include <AudioPolicyMix.h> #include <EffectDescriptor.h> #include <SoundTriggerSession.h> #include <StreamDescriptor.h> #include <SessionRoute.h> namespace android { class AudioPolicyConfig { public: AudioPolicyConfig(HwModuleCollection &hwModules, DeviceVector &availableOutputDevices, DeviceVector &availableInputDevices, sp<DeviceDescriptor> &defaultOutputDevices, bool &isSpeakerDrcEnabled) : mHwModules(hwModules), mAvailableOutputDevices(availableOutputDevices), mAvailableInputDevices(availableInputDevices), mDefaultOutputDevices(defaultOutputDevices), mIsSpeakerDrcEnabled(isSpeakerDrcEnabled) {} void setHwModules(const HwModuleCollection &hwModules) { mHwModules = hwModules; } void addAvailableInputDevices(const DeviceVector &availableInputDevices) { mAvailableInputDevices.add(availableInputDevices); } void addAvailableOutputDevices(const DeviceVector &availableOutputDevices) { mAvailableOutputDevices.add(availableOutputDevices); } void setSpeakerDrcEnabled(bool isSpeakerDrcEnabled) { mIsSpeakerDrcEnabled = isSpeakerDrcEnabled; } const HwModuleCollection getHwModules() const { return mHwModules; } const DeviceVector &getAvailableInputDevices() const { return mAvailableInputDevices; } const DeviceVector &getAvailableOutputDevices() const { return mAvailableOutputDevices; } void setDefaultOutputDevice(const sp<DeviceDescriptor> &defaultDevice) { mDefaultOutputDevices = defaultDevice; } const sp<DeviceDescriptor> &getDefaultOutputDevice() const { return mDefaultOutputDevices; } void setDefault(void) { mDefaultOutputDevices = new DeviceDescriptor(AUDIO_DEVICE_OUT_SPEAKER); sp<HwModule> module; sp<DeviceDescriptor> defaultInputDevice = new DeviceDescriptor(AUDIO_DEVICE_IN_BUILTIN_MIC); mAvailableOutputDevices.add(mDefaultOutputDevices); mAvailableInputDevices.add(defaultInputDevice); module = new HwModule("primary"); sp<OutputProfile> outProfile; outProfile = new OutputProfile(String8("primary")); outProfile->attach(module); outProfile->mSamplingRates.add(44100); outProfile->mFormats.add(AUDIO_FORMAT_PCM_16_BIT); outProfile->mChannelMasks.add(AUDIO_CHANNEL_OUT_STEREO); outProfile->addSupportedDevice(mDefaultOutputDevices); outProfile->setFlags(AUDIO_OUTPUT_FLAG_PRIMARY); module->mOutputProfiles.add(outProfile); sp<InputProfile> inProfile; inProfile = new InputProfile(String8("primary")); inProfile->attach(module); inProfile->mSamplingRates.add(8000); inProfile->mFormats.add(AUDIO_FORMAT_PCM_16_BIT); inProfile->mChannelMasks.add(AUDIO_CHANNEL_IN_MONO); inProfile->addSupportedDevice(defaultInputDevice); module->mInputProfiles.add(inProfile); mHwModules.add(module); } private: HwModuleCollection &mHwModules; /**< Collection of Module, with Profiles, i.e. Mix Ports. */ DeviceVector &mAvailableOutputDevices; DeviceVector &mAvailableInputDevices; sp<DeviceDescriptor> &mDefaultOutputDevices; bool &mIsSpeakerDrcEnabled; }; }; // namespace android
services/audiopolicy/common/managerdefinitions/include/AudioPort.h +34 −16 Original line number Diff line number Diff line Loading @@ -27,14 +27,27 @@ namespace android { class HwModule; class AudioGain; typedef Vector<sp<AudioGain> > AudioGainCollection; class AudioPort : public virtual RefBase { public: AudioPort(const String8& name, audio_port_type_t type, audio_port_role_t role); AudioPort(const String8& name, audio_port_type_t type, audio_port_role_t role) : mName(name), mType(type), mRole(role), mFlags(AUDIO_OUTPUT_FLAG_NONE) {} virtual ~AudioPort() {} const String8 &getName() const { return mName; } audio_port_type_t getType() const { return mType; } audio_port_role_t getRole() const { return mRole; } void setGains(const AudioGainCollection &gains) { mGains = gains; } const AudioGainCollection &getGains() const { return mGains; } void setFlags(uint32_t flags) { mFlags = flags; } uint32_t getFlags() const { return mFlags; } virtual void attach(const sp<HwModule>& module); bool isAttached() { return mModule != 0; } Loading @@ -45,14 +58,15 @@ public: virtual void importAudioPort(const sp<AudioPort> port); void clearCapabilities(); void loadSamplingRates(char *name); void loadFormats(char *name); void loadOutChannels(char *name); void loadInChannels(char *name); audio_gain_mode_t loadGainMode(char *name); void loadGain(cnode *root, int index); virtual void loadGains(cnode *root); void setSupportedFormats(const Vector <audio_format_t> &formats); void setSupportedSamplingRates(const Vector <uint32_t> &sampleRates) { mSamplingRates = sampleRates; } void setSupportedChannelMasks(const Vector <audio_channel_mask_t> &channelMasks) { mChannelMasks = channelMasks; } // searches for an exact match status_t checkExactSamplingRate(uint32_t samplingRate) const; Loading Loading @@ -84,25 +98,29 @@ public: uint32_t getModuleVersion() const; const char *getModuleName() const; bool useInputChannelMask() const { return ((mType == AUDIO_PORT_TYPE_DEVICE) && (mRole == AUDIO_PORT_ROLE_SOURCE)) || ((mType == AUDIO_PORT_TYPE_MIX) && (mRole == AUDIO_PORT_ROLE_SINK)); } void dump(int fd, int spaces) const; void log(const char* indent) const; String8 mName; audio_port_type_t mType; audio_port_role_t mRole; bool mUseInChannelMask; // by convention, "0' in the first entry in mSamplingRates, mChannelMasks or mFormats // indicates the supported parameters should be read from the output stream // after it is opened for the first time Vector <uint32_t> mSamplingRates; // supported sampling rates Vector <audio_channel_mask_t> mChannelMasks; // supported channel masks Vector <audio_format_t> mFormats; // supported audio formats Vector < sp<AudioGain> > mGains; // gain controllers AudioGainCollection mGains; // gain controllers sp<HwModule> mModule; // audio HW module exposing this I/O stream uint32_t mFlags; // attribute flags (e.g primary output, // direct output...). private: audio_port_type_t mType; audio_port_role_t mRole; uint32_t mFlags; // attribute flags mask (e.g primary output, direct output...). static volatile int32_t mNextUniqueId; }; Loading