1 /* 2 * Copyright (C) 2011 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 #include <SLES/OpenSLES.h> 18 #include <OMXAL/OpenMAXAL.h> 19 #include "attr.h" 20 #include "handlers.h" 21 22 /* The entries in this table are sorted first by object ID, and second 23 * by attribute mask. The holes in the table are deliberate to permit 24 * direct lookup. Don't cross streams! 25 */ 26 const AttributeHandler handlerTable[1 + XA_OBJECTID_CAMERADEVICE + 27 (SL_OBJECTID_METADATAEXTRACTOR - SL_OBJECTID_ENGINE) + 1][ATTR_INDEX_MAX] = { 28 29 // XA IDs map directly to table indices 30 31 [XA_OBJECTID_MEDIAPLAYER] = { 32 [ATTR_INDEX_GAIN] = handler_MediaPlayer_gain, 33 [ATTR_INDEX_TRANSPORT] = handler_MediaPlayer_transport, 34 [ATTR_INDEX_POSITION] = handler_MediaPlayer_position, 35 [ATTR_INDEX_ABQ_ENQUEUE] = handler_MediaPlayer_abq_enqueue, 36 [ATTR_INDEX_PLAY_STATE] = handler_MediaPlayer_play_state}, 37 38 // SL IDs need a little arithmetic to make them contiguous with XA IDs 39 #define _(id) ((id) - SL_OBJECTID_ENGINE + XA_OBJECTID_CAMERADEVICE + 1) 40 41 [_(SL_OBJECTID_AUDIOPLAYER)] = { 42 [ATTR_INDEX_GAIN] = handler_AudioPlayer_gain, 43 [ATTR_INDEX_TRANSPORT] = handler_AudioPlayer_transport, 44 [ATTR_INDEX_POSITION] = handler_AudioPlayer_position, 45 [ATTR_INDEX_BQ_ENQUEUE] = handler_AudioPlayer_bq_enqueue, 46 [ATTR_INDEX_ABQ_ENQUEUE] = handler_AudioPlayer_abq_enqueue, 47 [ATTR_INDEX_PLAY_STATE] = handler_AudioPlayer_play_state}, 48 49 [_(SL_OBJECTID_AUDIORECORDER)] = { 50 [ATTR_INDEX_TRANSPORT] = handler_AudioRecorder_transport}, 51 52 [_(SL_OBJECTID_MIDIPLAYER)] = { 53 [ATTR_INDEX_GAIN] = handler_MidiPlayer_gain, 54 [ATTR_INDEX_POSITION] = handler_MidiPlayer_position}, 55 56 [_(SL_OBJECTID_OUTPUTMIX)] = { 57 [ATTR_INDEX_GAIN] = handler_OutputMix_gain}, 58 59 }; 60