• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <map>
20 
21 #include <utils/RefBase.h>
22 
23 #include "AudioRoute.h"
24 #include "HwModule.h"
25 #include "IOProfile.h"
26 
27 namespace android {
28 
29 class PreferredMixerAttributesInfo : public RefBase {
30 public:
PreferredMixerAttributesInfo(uid_t uid,audio_port_handle_t devicePortId,const sp<IOProfile> & profile,audio_output_flags_t flags,const audio_mixer_attributes_t & mixerAttributes)31     PreferredMixerAttributesInfo(uid_t uid, audio_port_handle_t devicePortId,
32                                  const sp<IOProfile>& profile, audio_output_flags_t flags,
33                                  const audio_mixer_attributes_t& mixerAttributes)
34         : mDevicePortId(devicePortId), mUid(uid), mProfile(profile),
35           mOutputFlags(flags), mMixerAttributes(mixerAttributes) { }
36 
getDeviceId()37     audio_port_handle_t getDeviceId() const { return mDevicePortId; }
getConfigBase()38     const audio_config_base_t& getConfigBase() const { return mMixerAttributes.config; }
getUid()39     uid_t getUid() const { return mUid; }
getActiveClientCount()40     int getActiveClientCount() const { return mActiveClientsCount; }
getProfile()41     const sp<IOProfile> getProfile() const { return mProfile; };
getFlags()42     audio_output_flags_t getFlags() const { return mOutputFlags; }
getMixerAttributes()43     const audio_mixer_attributes_t& getMixerAttributes() const { return mMixerAttributes; }
44 
increaseActiveClient()45     void increaseActiveClient() { mActiveClientsCount++; }
decreaseActiveClient()46     void decreaseActiveClient() { mActiveClientsCount--; }
47 
48     void dump(String8 *dst);
49 
50 private:
51     const audio_port_handle_t mDevicePortId;
52     const uid_t mUid;
53     const sp<IOProfile> mProfile;
54     const audio_output_flags_t mOutputFlags;
55     const audio_mixer_attributes_t mMixerAttributes;
56     int mActiveClientsCount = 0;
57 };
58 
59 } // namespace android