handlers.c revision 7b726bdcd996f1cab3a584c04ce1afc07bc8fbe7
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 */ 26const 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 37// SL IDs need a little arithmetic to make them contiguous with XA IDs 38#define _(id) ((id) - SL_OBJECTID_ENGINE + XA_OBJECTID_CAMERADEVICE + 1) 39 40 [_(SL_OBJECTID_AUDIOPLAYER)] = { 41 [ATTR_INDEX_GAIN] = handler_AudioPlayer_gain, 42 [ATTR_INDEX_TRANSPORT] = handler_AudioPlayer_transport, 43 [ATTR_INDEX_POSITION] = handler_AudioPlayer_position, 44 [ATTR_INDEX_BQ_ENQUEUE] = handler_AudioPlayer_bq_enqueue, 45 [ATTR_INDEX_ABQ_ENQUEUE] = handler_AudioPlayer_abq_enqueue}, 46 47 [_(SL_OBJECTID_AUDIORECORDER)] = { 48 [ATTR_INDEX_TRANSPORT] = handler_AudioRecorder_transport}, 49 50 [_(SL_OBJECTID_MIDIPLAYER)] = { 51 [ATTR_INDEX_GAIN] = handler_MidiPlayer_gain, 52 [ATTR_INDEX_POSITION] = handler_MidiPlayer_position}, 53 54 [_(SL_OBJECTID_OUTPUTMIX)] = { 55 [ATTR_INDEX_GAIN] = handler_OutputMix_gain}, 56 57}; 58