Home | History | Annotate | Download | only in autogen
      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 
     26 extern const struct SLInterfaceID_ SL_IID_array[MPH_MAX];
     27 
     28 /** \brief Map SLInterfaceID to its minimal perfect hash (MPH), or -1 if unknown */
     29 
     30 int IID_to_MPH(const SLInterfaceID iid)
     31 {
     32 #define MAX_HASH_VALUE 180
     33   static const unsigned char asso_values[] =
     34     {
     35        35,  20,  54,  84, 181, 181,  59, 181, 181, 181,
     36       181, 181, 181, 181,  69, 181,  64,  44, 181, 181,
     37       181, 181,  39, 181,  54,  14, 181, 181,  14, 181,
     38       181, 125,   5, 181, 181, 181, 181, 181, 181, 181,
     39       127, 181, 181, 181,   9, 181, 112, 181, 181, 181,
     40       181, 181, 122, 181, 181, 181, 181, 181,  14, 100,
     41       181,   9,  24, 181,  50, 181, 181, 181, 181, 117,
     42       181, 181,  97,  85, 181, 181, 181, 181, 181, 181,
     43       181, 181, 181, 181, 181, 181, 117, 181,  19, 181,
     44       181, 181,   9, 181, 181, 181,  25, 181,  14, 102,
     45       181, 181, 181, 181, 181, 181, 181,   4, 181,  97,
     46       181, 181,   0, 181,   4,  92, 117, 181,  67,  45,
     47       181, 181, 110, 181, 181, 181,  72, 181,  40, 181,
     48       181, 181, 181, 181, 181, 102,  52, 181, 181, 181,
     49       181, 181,  57,  67, 181,  62, 181, 125, 181, 181,
     50       181, 181, 181,  82, 181, 181,  72, 181, 181,  65,
     51         5, 181,  32, 181, 181,  67, 120, 181, 181,  37,
     52       181,  57,  55, 181, 181,  47, 181,  45, 181, 181,
     53       181, 181,   7, 181,  17,  30, 181, 181, 181, 181,
     54       181, 181,   0, 181, 181, 181, 105,  32, 181, 181,
     55       181, 181, 181, 181, 181, 181, 115, 181, 181, 181,
     56        95,  32, 181, 181, 181,  22, 181, 181,   2, 181,
     57       181, 181, 181,  12,  10, 181, 181,  12, 181, 181,
     58       181, 181, 181, 181,   2, 181,  70, 181, 181, 181,
     59        10,   2, 181, 181,  70, 181, 120, 115, 181, 181,
     60       181,  80, 105, 100, 181, 181
     61     };
     62     static const signed char hash_to_MPH[] = {
     63         MPH_ANDROIDEFFECTSEND,
     64         -1,
     65         MPH_XADYNAMICINTERFACEMANAGEMENT,
     66         -1,
     67         MPH_XAAUDIODECODERCAPABILITIES,
     68         MPH_XALED,
     69         -1,
     70         MPH_XATHREADSYNC,
     71         -1,
     72         MPH_XAOUTPUTMIX,
     73         MPH_MIDITIME,
     74         -1,
     75         MPH_XAIMAGECONTROLS,
     76         -1,
     77         MPH_AUDIOIODEVICECAPABILITIES,
     78         MPH_MUTESOLO,
     79         -1,
     80         MPH_XAVOLUME,
     81         -1,
     82         MPH_ANDROIDCONFIGURATION,
     83         MPH_XASNAPSHOT,
     84         -1,
     85         MPH_XAPLAY,
     86         -1,
     87         MPH_SEEK,
     88         MPH_3DLOCATION,
     89         -1,
     90         MPH_XACONFIGEXTENSION,
     91         -1,
     92         MPH_XAIMAGEDECODERCAPABILITIES,
     93         MPH_XACAMERACAPABILITIES,
     94         -1,
     95         MPH_3DMACROSCOPIC,
     96         -1,
     97         MPH_VIBRA,
     98         MPH_XAIMAGEEFFECTS,
     99         -1,
    100         MPH_XAMETADATAEXTRACTION,
    101         -1,
    102         MPH_PRESETREVERB,
    103         MPH_XAOBJECT,
    104         -1,
    105         MPH_RATEPITCH,
    106         -1,
    107         MPH_PITCH,
    108         MPH_XAVIBRA,
    109         -1,
    110         MPH_XARADIO,
    111         -1,
    112         MPH_OUTPUTMIXEXT,
    113         MPH_ENGINECAPABILITIES,
    114         -1,
    115         MPH_XAVIDEOPOSTPROCESSING,
    116         -1,
    117         MPH_3DCOMMIT,
    118         MPH_XAVIDEODECODERCAPABILITIES,
    119         -1,
    120         MPH_METADATATRAVERSAL,
    121         -1,
    122         MPH_XASEEK,
    123         MPH_AUDIODECODERCAPABILITIES,
    124         -1,
    125         MPH_DEVICEVOLUME,
    126         -1,
    127         MPH_OBJECT,
    128         MPH_ENVIRONMENTALREVERB,
    129         -1,
    130         MPH_XARDS,
    131         -1,
    132         MPH_XAVIDEOENCODER,
    133         MPH_OUTPUTMIX,
    134         -1,
    135         MPH_XADYNAMICSOURCE,
    136         -1,
    137         MPH_3DGROUPING,
    138         MPH_XASTREAMINFORMATION,
    139         -1,
    140         MPH_XAPREFETCHSTATUS,
    141         -1,
    142         MPH_XAMETADATATRAVERSAL,
    143         MPH_VIRTUALIZER,
    144         -1,
    145         MPH_BUFFERQUEUE,
    146         -1,
    147         MPH_ANDROIDBUFFERQUEUESOURCE,
    148         MPH_PLAY,
    149         -1,
    150         MPH_XAMETADATAINSERTION,
    151         -1,
    152         MPH_XADEVICEVOLUME,
    153         MPH_XAVIDEOENCODERCAPABILITIES,
    154         -1,
    155         MPH_ENGINE,
    156         -1,
    157         MPH_MIDIMUTESOLO,
    158         MPH_XAEQUALIZER,
    159         -1,
    160         MPH_METADATAEXTRACTION,
    161         -1,
    162         -1,
    163         MPH_XARECORD,
    164         -1,
    165         MPH_XAIMAGEENCODER,
    166         -1,
    167         -1,
    168         MPH_VISUALIZATION,
    169         -1,
    170         MPH_XACAMERA,
    171         -1,
    172         -1,
    173         MPH_BASSBOOST,
    174         -1,
    175         MPH_LED,
    176         -1,
    177         -1,
    178         MPH_EFFECTSEND,
    179         -1,
    180         MPH_XAENGINE,
    181         -1,
    182         -1,
    183         MPH_RECORD,
    184         -1,
    185         MPH_MIDIMESSAGE,
    186         -1,
    187         -1,
    188         MPH_ANDROIDEFFECTCAPABILITIES,
    189         -1,
    190         MPH_3DSOURCE,
    191         -1,
    192         -1,
    193         MPH_VOLUME,
    194         -1,
    195         MPH_XAAUDIOENCODERCAPABILITIES,
    196         -1,
    197         -1,
    198         MPH_PLAYBACKRATE,
    199         -1,
    200         MPH_XAAUDIOIODEVICECAPABILITIES,
    201         -1,
    202         -1,
    203         MPH_NULL,
    204         -1,
    205         MPH_ANDROIDEFFECT,
    206         -1,
    207         -1,
    208         MPH_XAIMAGEENCODERCAPABILITIES,
    209         -1,
    210         MPH_XAPLAYBACKRATE,
    211         -1,
    212         -1,
    213         MPH_MIDITEMPO,
    214         -1,
    215         MPH_DYNAMICSOURCE,
    216         -1,
    217         -1,
    218         MPH_DYNAMICINTERFACEMANAGEMENT,
    219         -1,
    220         MPH_EQUALIZER,
    221         -1,
    222         -1,
    223         MPH_XAAUDIOENCODER,
    224         -1,
    225         MPH_THREADSYNC,
    226         -1,
    227         -1,
    228         MPH_PREFETCHSTATUS,
    229         -1,
    230         MPH_3DDOPPLER,
    231         -1,
    232         -1,
    233         MPH_ANDROIDSIMPLEBUFFERQUEUE,
    234         -1,
    235         -1,
    236         -1,
    237         -1,
    238         MPH_AUDIOENCODERCAPABILITIES,
    239         -1,
    240         -1,
    241         -1,
    242         -1,
    243         MPH_AUDIOENCODER
    244     };
    245     if (&SL_IID_array[0] <= iid && &SL_IID_array[MPH_MAX] > iid)
    246         return iid - &SL_IID_array[0];
    247     if (NULL != iid) {
    248         unsigned key = asso_values[((unsigned char *)iid)[8]] +
    249             asso_values[((unsigned char *)iid)[0]];
    250         if (key <= MAX_HASH_VALUE) {
    251             int MPH = hash_to_MPH[key];
    252             if (MPH >= 0) {
    253                 assert(MPH < MPH_MAX);
    254                 SLInterfaceID trial = &SL_IID_array[MPH];
    255                 if (!memcmp(iid, trial, sizeof(struct SLInterfaceID_)))
    256                     return MPH;
    257             }
    258         }
    259     }
    260     return -1;
    261 }
    262