基于Android11简单分析audio_policy_configuration.xml

 开篇先贴上一个高通的例子,后续基于此文件做具体分析。

1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved
3      Not a Contribution.
4 -->
5 <!-- Copyright (C) 2015 The Android Open Source Project
6 
7      Licensed under the Apache License, Version 2.0 (the "License");
8      you may not use this file except in compliance with the License.
9      You may obtain a copy of the License at
10 
11           http://www.apache.org/licenses/LICENSE-2.0
12 
13      Unless required by applicable law or agreed to in writing, software
14      distributed under the License is distributed on an "AS IS" BASIS,
15      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16      See the License for the specific language governing permissions and
17      limitations under the License.
18 -->
19 
20 <audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
21     <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->
22 
23     <!-- Global configuration Decalaration -->
24     <globalConfiguration speaker_drc_enabled="true"/>
25 
26     <!-- Modules section:
27         There is one section per audio HW module present on the platform.
28         Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.
29         The module names are the same as in current .conf file:
30                 “primary”, “A2DP”, “remote_submix”, “USB”
31         Each module will contain the following sections:
32         “devicePorts”: a list of device descriptors for all input and output devices accessible via this
33         module.
34         This contains both permanently attached devices and removable devices.
35             "gain": constraints applied to the millibel values:
36                 - maxValueMB >= minValueMB
37                 - defaultValueMB >= minValueMB && defaultValueMB <= maxValueMB
38                 - (maxValueMB - minValueMB) % stepValueMB == 0
39                 - (defaultValueMB - minValueMB) % stepValueMB == 0
40         “mixPorts”: listing all output and input streams exposed by the audio HAL
41         “routes”: list of possible connections between input and output devices or between stream and
42         devices.
43             "route": is defined by an attribute:
44                 -"type": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)
45                 -"sink": the sink involved in this route
46                 -"sources": all the sources than can be connected to the sink via vis route
47         “attachedDevices”: permanently attached devices.
48         The attachedDevices section is a list of devices names. The names correspond to device names
49         defined in <devicePorts> section.
50         “defaultOutputDevice”: device to be used by default when no policy rule applies
51     -->
52     <modules>
53         <!-- Primary Audio HAL -->
54         <module name="primary" halVersion="3.0">
55             <attachedDevices>
56                 <item>Media Bus</item>
57                 <item>Sys Notification Bus</item>
58                 <item>Nav Guidance Bus</item>
59                 <item>Phone Bus</item>
60                 <item>Tts Bus</item>
61                 <item>Vr Tts Bus</item>
62                 <item>Boot Music Bus</item>
63                 <item>Chime Tts Bus</item>
64                 <item>BT Codriver Bus</item>
65                 <item>Projection Vr Tts Bus</item>
66                 <item>Ringtone Bus</item>
67                 <item>Built-In Mic</item>
68                 <item>Built-In Back Mic</item>
69                 <item>FM Tuner</item>
70                 <item>Speaker</item>
71                 <item>Projection Vr Bus In</item>
72                 <item>Projection Phone Bus In</item>
73                 <item>Local Vr Bus In</item>
74                 <item>Projection Esiri Bus In</item>
75             </attachedDevices>
76             <defaultOutputDevice>Media Bus</defaultOutputDevice>
77             <mixPorts>
78                 <mixPort name="media" role="source"
79                          flags="AUDIO_OUTPUT_FLAG_PRIMARY">
80                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
81                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
82                 </mixPort>
83                 <mixPort name="sys_notification" role="source">
84                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
85                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
86                 </mixPort>
87                 <mixPort name="nav_guidance" role="source">
88                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
89                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
90                 </mixPort>
91                 <mixPort name="phone" role="source">
92                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
93                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
94                 </mixPort>
95                 <mixPort name="tts" role="source">
96                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
97                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
98                 </mixPort>
99                 <mixPort name="vr_tts" role="source">
100                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
101                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
102                 </mixPort>
103                 <mixPort name="boot_music" role="source">
104                     <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
105                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
106                 </mixPort>
107                 <mixPort name="chime_tts" role="source">
108                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
109                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
110                 </mixPort>
111                 <mixPort name="bt_codriver" role="source"
112                          flags="AUDIO_OUTPUT_FLAG_RIGHT_ZONE">
113                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
114                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
115                 </mixPort>
116                 <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY">
117                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
118                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
119                 </mixPort>
120                 <mixPort name="raw" role="source"
121                         flags="AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_RAW">
122                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
123                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
124                 </mixPort>
125                 <mixPort name="deep_buffer" role="source"
126                         flags="AUDIO_OUTPUT_FLAG_DEEP_BUFFER">
127                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
128                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
129                 </mixPort>
130                 <mixPort name="mmap_no_irq_out" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_MMAP_NOIRQ">
131                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
132                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
133                 </mixPort>
134                 <mixPort name="hifi_playback" role="source" />
135                 <mixPort name="compress_passthrough" role="source"
136                         flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
137                     <profile name="" format="dynamic"
138                              samplingRates="dynamic" channelMasks="dynamic"/>
139                 </mixPort>
140                 <mixPort name="direct_pcm" role="source"
141                         flags="AUDIO_OUTPUT_FLAG_DIRECT">
142                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
143                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
144                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
145                     <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
146                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
147                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
148                     <profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
149                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
150                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
151                   <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
152                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
153                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
154                 </mixPort>
155 
156                 <mixPort name="bt_codriver_direct_pcm" role="source"
157                          flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_RIGHT_ZONE">
158                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
159                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
160                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
161                     <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
162                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
163                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
164                     <profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
165                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
166                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
167                   <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
168                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
169                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
170                 </mixPort
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值