IID_to_MPH.c revision 262059f71a68edc5e510427c63f5f1623d3672a8
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// This file is automagically generated by hashgen, do not edit 18 19/** \file IID_to_MPH.c Interface ID to MPH mapping */ 20 21#include "SLES/OpenSLES.h" 22#include "MPH.h" 23#include <assert.h> 24#include <string.h> 25 26extern const struct SLInterfaceID_ SL_IID_array[MPH_MAX]; 27 28/** \brief Map SLInterfaceID to its minimal perfect hash (MPH), or -1 if unknown */ 29 30int IID_to_MPH(const SLInterfaceID iid) 31{ 32#define MAX_HASH_VALUE 115 33 static const unsigned char asso_values[] = 34 { 35 5, 116, 116, 2, 116, 116, 7, 116, 116, 12, 36 116, 17, 116, 116, 116, 51, 116, 116, 116, 116, 37 116, 116, 2, 116, 116, 46, 116, 116, 116, 116, 38 116, 12, 25, 116, 116, 116, 116, 116, 116, 116, 39 116, 116, 51, 20, 46, 116, 31, 116, 116, 116, 40 116, 116, 116, 36, 116, 2, 116, 116, 116, 116, 41 116, 61, 116, 2, 55, 116, 116, 116, 116, 16, 42 116, 26, 116, 116, 116, 116, 116, 116, 116, 116, 43 16, 116, 116, 116, 116, 116, 26, 116, 116, 116, 44 11, 116, 116, 116, 116, 116, 40, 21, 116, 60, 45 116, 116, 116, 116, 116, 116, 16, 116, 116, 116, 46 116, 116, 1, 116, 116, 116, 116, 116, 116, 116, 47 116, 11, 55, 1, 116, 116, 116, 6, 45, 116, 48 116, 1, 116, 116, 116, 116, 116, 1, 116, 116, 49 116, 1, 116, 116, 116, 116, 116, 116, 116, 116, 50 116, 60, 116, 116, 116, 116, 116, 116, 116, 116, 51 10, 116, 116, 116, 116, 116, 116, 116, 116, 116, 52 50, 116, 116, 116, 45, 116, 116, 116, 55, 116, 53 45, 116, 116, 116, 116, 116, 116, 116, 116, 116, 54 116, 116, 20, 116, 35, 116, 45, 10, 116, 55, 55 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 56 116, 116, 45, 116, 116, 50, 116, 116, 116, 116, 57 116, 25, 116, 116, 15, 40, 116, 116, 15, 116, 58 116, 116, 116, 116, 116, 15, 0, 116, 116, 15, 59 35, 116, 116, 116, 116, 116, 55, 116, 116, 116, 60 116, 116, 116, 116, 0, 116 61 }; 62 static const signed char hash_to_MPH[] = { 63 MPH_NULL, 64 -1, 65 -1, 66 -1, 67 -1, 68 MPH_OUTPUTMIXEXT, 69 MPH_3DSOURCE, 70 MPH_VIRTUALIZER, 71 -1, 72 -1, 73 MPH_XAPLAY, 74 MPH_ENGINECAPABILITIES, 75 MPH_AUDIODECODERCAPABILITIES, 76 -1, 77 -1, 78 MPH_DYNAMICSOURCE, 79 MPH_ANDROIDCONFIGURATION, 80 MPH_MIDITEMPO, 81 -1, 82 -1, 83 MPH_RECORD, 84 MPH_ANDROIDEFFECTSEND, 85 MPH_EQUALIZER, 86 -1, 87 -1, 88 MPH_VISUALIZATION, 89 MPH_MUTESOLO, 90 MPH_VOLUME, 91 -1, 92 -1, 93 MPH_3DGROUPING, 94 MPH_EFFECTSEND, 95 MPH_BASSBOOST, 96 -1, 97 -1, 98 MPH_PLAY, 99 MPH_3DMACROSCOPIC, 100 -1, 101 -1, 102 -1, 103 MPH_BUFFERQUEUE, 104 MPH_ENGINE, 105 MPH_VIBRA, 106 -1, 107 -1, 108 MPH_3DLOCATION, 109 MPH_ANDROIDBUFFERQUEUE, 110 MPH_MIDIMUTESOLO, 111 -1, 112 -1, 113 MPH_MIDIMESSAGE, 114 MPH_OBJECT, 115 -1, 116 -1, 117 -1, 118 MPH_SEEK, 119 MPH_ANDROIDEFFECTCAPABILITIES, 120 -1, 121 -1, 122 -1, 123 MPH_PITCH, 124 MPH_RATEPITCH, 125 -1, 126 -1, 127 -1, 128 MPH_METADATATRAVERSAL, 129 MPH_PRESETREVERB, 130 -1, 131 -1, 132 -1, 133 MPH_ENVIRONMENTALREVERB, 134 MPH_XAENGINE, 135 -1, 136 -1, 137 -1, 138 MPH_AUDIOIODEVICECAPABILITIES, 139 MPH_MIDITIME, 140 -1, 141 -1, 142 -1, 143 MPH_DEVICEVOLUME, 144 MPH_3DCOMMIT, 145 -1, 146 -1, 147 -1, 148 MPH_ANDROIDEFFECT, 149 MPH_PLAYBACKRATE, 150 -1, 151 -1, 152 -1, 153 MPH_3DDOPPLER, 154 MPH_LED, 155 -1, 156 -1, 157 -1, 158 MPH_METADATAEXTRACTION, 159 MPH_PREFETCHSTATUS, 160 -1, 161 -1, 162 -1, 163 MPH_OUTPUTMIX, 164 MPH_ANDROIDSIMPLEBUFFERQUEUE, 165 -1, 166 -1, 167 -1, 168 MPH_AUDIOENCODER, 169 MPH_AUDIOENCODERCAPABILITIES, 170 -1, 171 -1, 172 -1, 173 MPH_THREADSYNC, 174 -1, 175 -1, 176 -1, 177 -1, 178 MPH_DYNAMICINTERFACEMANAGEMENT 179 }; 180 if (&SL_IID_array[0] <= iid && &SL_IID_array[MPH_MAX] > iid) 181 return iid - &SL_IID_array[0]; 182 if (NULL != iid) { 183 unsigned key = asso_values[((unsigned char *)iid)[3]] + 184 asso_values[((unsigned char *)iid)[0]]; 185 if (key <= MAX_HASH_VALUE) { 186 int MPH = hash_to_MPH[key]; 187 if (MPH >= 0) { 188 assert(MPH < MPH_MAX); 189 SLInterfaceID trial = &SL_IID_array[MPH]; 190 if (!memcmp(iid, trial, sizeof(struct SLInterfaceID_))) 191 return MPH; 192 } 193 } 194 } 195 return -1; 196} 197