• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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 // Map minimal perfect hash of an interface ID to its class index.
18 
19 #include "MPH.h"
20 
21 // If defined, then compile with C99 such as GNU C, not GNU C++ or non-GNU C.
22 //#define USE_DESIGNATED_INITIALIZERS
23 
24 // It is critical that all entries are populated with either a specific index
25 // or -1. Do not let the compiler use a default initializer of zero, because
26 // that actually maps to the IObject index. For non-USE_DESIGNATED_INITIALIZERS
27 // builds, we use the automagically-generated MPH_to_*.h files for this reason.
28 
29 // A good test is to use the GNU C compiler with -S option (for assembler output),
30 // and compile both with and without USE_DESIGNATED_INITIALIZERS.  The resulting .s
31 // files should be identical for both compilations.
32 
33 // Important note: if you add any interfaces here, be sure to also
34 // update the #define for the corresponding INTERFACES_<Class>.
35 
36 // IObject is the first interface in a class, so the index for MPH_OBJECT must be zero.
37 // Don't cross streams, otherwise bad things happen.
38 
39 
40 const signed char MPH_to_3DGroup[MPH_MAX] = {
41 #ifdef USE_DESIGNATED_INITIALIZERS
42     [0 ... MPH_MAX-1] = -1,
43     [MPH_OBJECT] = 0,
44     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
45     [MPH_3DLOCATION] = 2,
46     [MPH_3DDOPPLER] = 3,
47     [MPH_3DSOURCE] = 4,
48     [MPH_3DMACROSCOPIC] = 5
49 #else
50 #include "MPH_to_3DGroup.h"
51 #endif
52 };
53 
54 const signed char MPH_to_AudioPlayer[MPH_MAX] = {
55 #ifdef USE_DESIGNATED_INITIALIZERS
56     [0 ... MPH_MAX-1] = -1,
57     [MPH_OBJECT] = 0,
58     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
59     [MPH_PLAY] = 2,
60     [MPH_3DDOPPLER] = 3,
61     [MPH_3DGROUPING] = 4,
62     [MPH_3DLOCATION] = 5,
63     [MPH_3DSOURCE] = 6,
64     [MPH_BUFFERQUEUE] = 7,
65     [MPH_EFFECTSEND] = 8,
66     [MPH_MUTESOLO] = 9,
67     [MPH_METADATAEXTRACTION] = 10,
68     [MPH_METADATATRAVERSAL] = 11,
69     [MPH_PREFETCHSTATUS] = 12,
70     [MPH_RATEPITCH] = 13,
71     [MPH_SEEK] = 14,
72     [MPH_VOLUME] = 15,
73     [MPH_3DMACROSCOPIC] = 16,
74     [MPH_BASSBOOST] = 17,
75     [MPH_DYNAMICSOURCE] = 18,
76     [MPH_ENVIRONMENTALREVERB] = 19,
77     [MPH_EQUALIZER] = 20,
78     [MPH_PITCH] = 21,
79     [MPH_PRESETREVERB] = 22,
80     [MPH_PLAYBACKRATE] = 23,
81     [MPH_VIRTUALIZER] = 24,
82     [MPH_VISUALIZATION] = 25,
83 #ifdef ANDROID
84     [MPH_ANDROIDEFFECT] = 26,
85     [MPH_ANDROIDEFFECTSEND] = 27,
86     [MPH_ANDROIDCONFIGURATION] = 28,
87     [MPH_ANDROIDSIMPLEBUFFERQUEUE] = 7,  // alias for [MPH_BUFFERQUEUE]
88     [MPH_ANDROIDBUFFERQUEUESOURCE] = 29
89 #endif
90 #else
91 #include "MPH_to_AudioPlayer.h"
92 #endif
93 };
94 
95 const signed char MPH_to_AudioRecorder[MPH_MAX] = {
96 #ifdef USE_DESIGNATED_INITIALIZERS
97     [0 ... MPH_MAX-1] = -1,
98     [MPH_OBJECT] = 0,
99     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
100     [MPH_RECORD] = 2,
101     [MPH_AUDIOENCODER] = 3,
102     [MPH_BASSBOOST] = 4,
103     [MPH_DYNAMICSOURCE] = 5,
104     [MPH_EQUALIZER] = 6,
105     [MPH_VISUALIZATION] = 7,
106     [MPH_VOLUME] = 8,
107 #ifdef ANDROID
108     [MPH_ANDROIDSIMPLEBUFFERQUEUE] = 9, // this is not an alias
109     [MPH_ANDROIDCONFIGURATION] = 10
110 #endif
111 #else
112 #include "MPH_to_AudioRecorder.h"
113 #endif
114 };
115 
116 const signed char MPH_to_Engine[MPH_MAX] = {
117 #ifdef USE_DESIGNATED_INITIALIZERS
118     [0 ... MPH_MAX-1] = -1,
119     [MPH_OBJECT] = 0,
120     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
121     [MPH_ENGINE] = 2,
122     [MPH_ENGINECAPABILITIES] = 3,
123     [MPH_THREADSYNC] = 4,
124     [MPH_AUDIOIODEVICECAPABILITIES] = 5,
125     [MPH_AUDIODECODERCAPABILITIES] = 6,
126     [MPH_AUDIOENCODERCAPABILITIES] = 7,
127     [MPH_3DCOMMIT] = 8,
128     [MPH_DEVICEVOLUME] = 9,
129     [MPH_XAENGINE] = 10,
130 #ifdef ANDROID
131     [MPH_ANDROIDEFFECTCAPABILITIES] = 11,
132 #endif
133     [MPH_XAVIDEODECODERCAPABILITIES] = 12
134 #else
135 #include "MPH_to_Engine.h"
136 #endif
137 };
138 
139 const signed char MPH_to_LEDDevice[MPH_MAX] = {
140 #ifdef USE_DESIGNATED_INITIALIZERS
141     [0 ... MPH_MAX-1] = -1,
142     [MPH_OBJECT] = 0,
143     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
144     [MPH_LED] = 2
145 #else
146 #include "MPH_to_LEDDevice.h"
147 #endif
148 };
149 
150 const signed char MPH_to_Listener[MPH_MAX] = {
151 #ifdef USE_DESIGNATED_INITIALIZERS
152     [0 ... MPH_MAX-1] = -1,
153     [MPH_OBJECT] = 0,
154     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
155     [MPH_3DDOPPLER] = 2,
156     [MPH_3DLOCATION] = 3
157 #else
158 #include "MPH_to_Listener.h"
159 #endif
160 };
161 
162 const signed char MPH_to_MetadataExtractor[MPH_MAX] = {
163 #ifdef USE_DESIGNATED_INITIALIZERS
164     [0 ... MPH_MAX-1] = -1,
165     [MPH_OBJECT] = 0,
166     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
167     [MPH_DYNAMICSOURCE] = 2,
168     [MPH_METADATAEXTRACTION] = 3,
169     [MPH_METADATATRAVERSAL] = 4
170 #else
171 #include "MPH_to_MetadataExtractor.h"
172 #endif
173 };
174 
175 const signed char MPH_to_MidiPlayer[MPH_MAX] = {
176 #ifdef USE_DESIGNATED_INITIALIZERS
177     [0 ... MPH_MAX-1] = -1,
178     [MPH_OBJECT] = 0,
179     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
180     [MPH_PLAY] = 2,
181     [MPH_3DDOPPLER] = 3,
182     [MPH_3DGROUPING] = 4,
183     [MPH_3DLOCATION] = 5,
184     [MPH_3DSOURCE] = 6,
185     [MPH_BUFFERQUEUE] = 7,
186     [MPH_EFFECTSEND] = 8,
187     [MPH_MUTESOLO] = 9,
188     [MPH_METADATAEXTRACTION] = 10,
189     [MPH_METADATATRAVERSAL] = 11,
190     [MPH_MIDIMESSAGE] = 12,
191     [MPH_MIDITIME] = 13,
192     [MPH_MIDITEMPO] = 14,
193     [MPH_MIDIMUTESOLO] = 15,
194     [MPH_PREFETCHSTATUS] = 16,
195     [MPH_SEEK] = 17,
196     [MPH_VOLUME] = 18,
197     [MPH_3DMACROSCOPIC] = 19,
198     [MPH_BASSBOOST] = 20,
199     [MPH_DYNAMICSOURCE] = 21,
200     [MPH_ENVIRONMENTALREVERB] = 22,
201     [MPH_EQUALIZER] = 23,
202     [MPH_PITCH] = 24,
203     [MPH_PRESETREVERB] = 25,
204     [MPH_PLAYBACKRATE] = 26,
205     [MPH_VIRTUALIZER] = 27,
206     [MPH_VISUALIZATION] = 28,
207 #else
208 #include "MPH_to_MidiPlayer.h"
209 #endif
210 };
211 
212 const signed char MPH_to_OutputMix[MPH_MAX] = {
213 #ifdef USE_DESIGNATED_INITIALIZERS
214     [0 ... MPH_MAX-1] = -1,
215     [MPH_OBJECT] = 0,
216     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
217     [MPH_OUTPUTMIX] = 2,
218 #ifdef USE_OUTPUTMIXEXT
219     [MPH_OUTPUTMIXEXT] = 3,
220 #endif
221     [MPH_ENVIRONMENTALREVERB] = 4,
222     [MPH_EQUALIZER] = 5,
223     [MPH_PRESETREVERB] = 6,
224     [MPH_VIRTUALIZER] = 7,
225     [MPH_VOLUME] = 8,
226     [MPH_BASSBOOST] = 9,
227     [MPH_VISUALIZATION] = 10,
228 #ifdef ANDROID
229     [MPH_ANDROIDEFFECT] = 11
230 #endif
231 #else
232 #include "MPH_to_OutputMix.h"
233 #endif
234 };
235 
236 const signed char MPH_to_Vibra[MPH_MAX] = {
237 #ifdef USE_DESIGNATED_INITIALIZERS
238     [0 ... MPH_MAX-1] = -1,
239     [MPH_OBJECT] = 0,
240     [MPH_DYNAMICINTERFACEMANAGEMENT] = 1,
241     [MPH_VIBRA] = 2
242 #else
243 #include "MPH_to_Vibra.h"
244 #endif
245 };
246 
247 const signed char MPH_to_MediaPlayer[MPH_MAX] = {
248 #ifdef USE_DESIGNATED_INITIALIZERS
249     [0 ... MPH_MAX-1] = -1,
250     [MPH_XAOBJECT] = 0,
251     [MPH_XADYNAMICINTERFACEMANAGEMENT] = 1,
252     [MPH_XAPLAY] = 2,
253     [MPH_XASTREAMINFORMATION] = 3,
254     [MPH_XAVOLUME] = 4,
255     [MPH_XASEEK] = 5,
256     [MPH_XAPREFETCHSTATUS] = 6,
257 #ifdef ANDROID
258     [MPH_ANDROIDBUFFERQUEUESOURCE] = 7,
259 #endif
260 #else
261 #include "MPH_to_MediaPlayer.h"
262 #endif
263 };
264