huangcm
2025-02-28 c32b2f9505927d6bf06b1d06d5ddd3cd1d245faf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
#include <SLES/OpenSLES.h>
#include <OMXAL/OpenMAXAL.h>
#include "attr.h"
#include "handlers.h"
 
#define NULL 0
 
/* The entries in this table are sorted first by object ID, and second
 * by attribute mask. The holes in the table are deliberate to permit
 * direct lookup. Don't cross streams!
 */
const AttributeHandler handlerTable[1 + XA_OBJECTID_CAMERADEVICE +
        (SL_OBJECTID_METADATAEXTRACTOR - SL_OBJECTID_ENGINE) + 1][ATTR_INDEX_MAX] = {
 
// XA IDs map directly to table indices
 
    [XA_OBJECTID_MEDIAPLAYER] = {
        [ATTR_INDEX_GAIN]        = handler_MediaPlayer_gain,
        [ATTR_INDEX_TRANSPORT]   = handler_MediaPlayer_transport,
        [ATTR_INDEX_POSITION]    = handler_MediaPlayer_position,
        [ATTR_INDEX_ABQ_ENQUEUE] = handler_MediaPlayer_abq_enqueue,
        [ATTR_INDEX_PLAY_STATE]  = handler_MediaPlayer_play_state},
 
// SL IDs need a little arithmetic to make them contiguous with XA IDs
#define _(id) ((id) - SL_OBJECTID_ENGINE + XA_OBJECTID_CAMERADEVICE + 1)
 
    [_(SL_OBJECTID_AUDIOPLAYER)] = {
#ifdef ANDROID
        [ATTR_INDEX_GAIN]        = handler_AudioPlayer_gain,
#endif
        [ATTR_INDEX_TRANSPORT]   = handler_AudioPlayer_transport,
        [ATTR_INDEX_POSITION]    = handler_AudioPlayer_position,
        [ATTR_INDEX_BQ_ENQUEUE]  = handler_AudioPlayer_bq_enqueue,
        [ATTR_INDEX_ABQ_ENQUEUE] = handler_AudioPlayer_abq_enqueue,
        [ATTR_INDEX_PLAY_STATE]  = handler_AudioPlayer_play_state},
 
    [_(SL_OBJECTID_AUDIORECORDER)] = {
        [ATTR_INDEX_TRANSPORT]   = handler_AudioRecorder_transport},
 
    [_(SL_OBJECTID_MIDIPLAYER)] = {
        [ATTR_INDEX_GAIN]        = handler_MidiPlayer_gain,
        [ATTR_INDEX_POSITION]    = handler_MidiPlayer_position},
 
    [_(SL_OBJECTID_OUTPUTMIX)] = {
        [ATTR_INDEX_GAIN]        = handler_OutputMix_gain},
 
};