Loading services/audiopolicy/common/managerdefinitions/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -10,10 +10,12 @@ LOCAL_SRC_FILES:= \ src/IOProfile.cpp \ src/AudioPort.cpp \ src/AudioProfile.cpp \ src/AudioRoute.cpp \ src/AudioPolicyMix.cpp \ src/AudioPatch.cpp \ src/AudioInputDescriptor.cpp \ src/AudioOutputDescriptor.cpp \ src/AudioCollections.cpp \ src/EffectDescriptor.cpp \ src/ConfigParsingUtils.cpp \ src/SoundTriggerSession.cpp \ Loading services/audiopolicy/common/managerdefinitions/include/AudioCollections.h 0 → 100644 +44 −0 Original line number Diff line number Diff line /* * Copyright (C) 2015 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 <utils/String8.h> #include <utils/Vector.h> #include <utils/RefBase.h> #include <utils/Errors.h> #include <system/audio.h> #include <cutils/config_utils.h> namespace android { class AudioPort; class AudioRoute; class AudioPortVector : public Vector<sp<AudioPort> > { public: sp<AudioPort> findByTagName(const String8 &tagName) const; }; class AudioRouteVector : public Vector<sp<AudioRoute> > { public: status_t dump(int fd) const; }; }; // namespace android services/audiopolicy/common/managerdefinitions/include/AudioPort.h +9 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #include "AudioCollections.h" #include "AudioProfile.h" #include <utils/String8.h> #include <utils/Vector.h> Loading @@ -28,6 +29,7 @@ namespace android { class HwModule; class AudioGain; class AudioRoute; typedef Vector<sp<AudioGain> > AudioGainCollection; class AudioPort : public virtual RefBase Loading @@ -44,6 +46,8 @@ public: audio_port_type_t getType() const { return mType; } audio_port_role_t getRole() const { return mRole; } virtual const String8 getTagName() const = 0; void setGains(const AudioGainCollection &gains) { mGains = gains; } const AudioGainCollection &getGains() const { return mGains; } Loading Loading @@ -114,6 +118,9 @@ public: (mFlags & (AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)); } void addRoute(const sp<AudioRoute> &route) { mRoutes.add(route); } const AudioRouteVector &getRoutes() const { return mRoutes; } void dump(int fd, int spaces, bool verbose = true) const; void log(const char* indent) const; Loading @@ -129,6 +136,7 @@ private: audio_port_role_t mRole; uint32_t mFlags; // attribute flags mask (e.g primary output, direct output...). AudioProfileVector mProfiles; // AudioProfiles supported by this port (format, Rates, Channels) AudioRouteVector mRoutes; // Routes involving this port static volatile int32_t mNextUniqueId; }; Loading services/audiopolicy/common/managerdefinitions/include/AudioRoute.h 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2015 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 "AudioCollections.h" #include <utils/String8.h> #include <utils/Vector.h> #include <utils/RefBase.h> #include <utils/Errors.h> namespace android { class AudioPort; class DeviceDescriptor; typedef enum { AUDIO_ROUTE_MUX = 0, AUDIO_ROUTE_MIX = 1 } audio_route_type_t; class AudioRoute : public virtual RefBase { public: AudioRoute(audio_route_type_t type) : mType(type) {} void setSources(const AudioPortVector &sources) { mSources = sources; } const AudioPortVector &getSources() const { return mSources; } void setSink(const sp<AudioPort> &sink) { mSink = sink; } const sp<AudioPort> &getSink() const { return mSink; } audio_route_type_t getType() const { return mType; } void dump(int fd, int spaces) const; private: AudioPortVector mSources; sp<AudioPort> mSink; audio_route_type_t mType; }; }; // namespace android services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h +3 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,9 @@ public: virtual ~DeviceDescriptor() {} virtual const String8 getTagName() const { return mTagName; } audio_devices_t type() const { return mDeviceType; } const String8 getTagName() const { return mTagName; } bool equals(const sp<DeviceDescriptor>& other) const; Loading @@ -56,7 +57,7 @@ public: String8 mAddress; private: String8 mTagName; String8 mTagName; // Unique human readable identifier for a device port found in conf file. audio_devices_t mDeviceType; audio_port_handle_t mId; Loading Loading
services/audiopolicy/common/managerdefinitions/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -10,10 +10,12 @@ LOCAL_SRC_FILES:= \ src/IOProfile.cpp \ src/AudioPort.cpp \ src/AudioProfile.cpp \ src/AudioRoute.cpp \ src/AudioPolicyMix.cpp \ src/AudioPatch.cpp \ src/AudioInputDescriptor.cpp \ src/AudioOutputDescriptor.cpp \ src/AudioCollections.cpp \ src/EffectDescriptor.cpp \ src/ConfigParsingUtils.cpp \ src/SoundTriggerSession.cpp \ Loading
services/audiopolicy/common/managerdefinitions/include/AudioCollections.h 0 → 100644 +44 −0 Original line number Diff line number Diff line /* * Copyright (C) 2015 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 <utils/String8.h> #include <utils/Vector.h> #include <utils/RefBase.h> #include <utils/Errors.h> #include <system/audio.h> #include <cutils/config_utils.h> namespace android { class AudioPort; class AudioRoute; class AudioPortVector : public Vector<sp<AudioPort> > { public: sp<AudioPort> findByTagName(const String8 &tagName) const; }; class AudioRouteVector : public Vector<sp<AudioRoute> > { public: status_t dump(int fd) const; }; }; // namespace android
services/audiopolicy/common/managerdefinitions/include/AudioPort.h +9 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #include "AudioCollections.h" #include "AudioProfile.h" #include <utils/String8.h> #include <utils/Vector.h> Loading @@ -28,6 +29,7 @@ namespace android { class HwModule; class AudioGain; class AudioRoute; typedef Vector<sp<AudioGain> > AudioGainCollection; class AudioPort : public virtual RefBase Loading @@ -44,6 +46,8 @@ public: audio_port_type_t getType() const { return mType; } audio_port_role_t getRole() const { return mRole; } virtual const String8 getTagName() const = 0; void setGains(const AudioGainCollection &gains) { mGains = gains; } const AudioGainCollection &getGains() const { return mGains; } Loading Loading @@ -114,6 +118,9 @@ public: (mFlags & (AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)); } void addRoute(const sp<AudioRoute> &route) { mRoutes.add(route); } const AudioRouteVector &getRoutes() const { return mRoutes; } void dump(int fd, int spaces, bool verbose = true) const; void log(const char* indent) const; Loading @@ -129,6 +136,7 @@ private: audio_port_role_t mRole; uint32_t mFlags; // attribute flags mask (e.g primary output, direct output...). AudioProfileVector mProfiles; // AudioProfiles supported by this port (format, Rates, Channels) AudioRouteVector mRoutes; // Routes involving this port static volatile int32_t mNextUniqueId; }; Loading
services/audiopolicy/common/managerdefinitions/include/AudioRoute.h 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2015 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 "AudioCollections.h" #include <utils/String8.h> #include <utils/Vector.h> #include <utils/RefBase.h> #include <utils/Errors.h> namespace android { class AudioPort; class DeviceDescriptor; typedef enum { AUDIO_ROUTE_MUX = 0, AUDIO_ROUTE_MIX = 1 } audio_route_type_t; class AudioRoute : public virtual RefBase { public: AudioRoute(audio_route_type_t type) : mType(type) {} void setSources(const AudioPortVector &sources) { mSources = sources; } const AudioPortVector &getSources() const { return mSources; } void setSink(const sp<AudioPort> &sink) { mSink = sink; } const sp<AudioPort> &getSink() const { return mSink; } audio_route_type_t getType() const { return mType; } void dump(int fd, int spaces) const; private: AudioPortVector mSources; sp<AudioPort> mSink; audio_route_type_t mType; }; }; // namespace android
services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h +3 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,9 @@ public: virtual ~DeviceDescriptor() {} virtual const String8 getTagName() const { return mTagName; } audio_devices_t type() const { return mDeviceType; } const String8 getTagName() const { return mTagName; } bool equals(const sp<DeviceDescriptor>& other) const; Loading @@ -56,7 +57,7 @@ public: String8 mAddress; private: String8 mTagName; String8 mTagName; // Unique human readable identifier for a device port found in conf file. audio_devices_t mDeviceType; audio_port_handle_t mId; Loading