Home | History | Annotate | Download | only in src
      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 #ifndef __handlers_h
     18 #define __handlers_h
     19 
     20 #define IObject struct Object_interface
     21 IObject;
     22 
     23 #ifdef __cplusplus
     24 extern "C" {
     25 #endif
     26 
     27 extern unsigned handler_MediaPlayer_gain(IObject *thiz);
     28 #ifdef ANDROID
     29 extern unsigned handler_MediaPlayer_transport(IObject *thiz);
     30 extern unsigned handler_MediaPlayer_position(IObject *thiz);
     31 extern unsigned handler_MediaPlayer_abq_enqueue(IObject *thiz);
     32 extern unsigned handler_MediaPlayer_play_state(IObject *thiz);
     33 extern unsigned handler_AudioPlayer_gain(IObject *thiz);
     34 extern unsigned handler_AudioPlayer_transport(IObject *thiz);
     35 extern unsigned handler_AudioPlayer_position(IObject *thiz);
     36 extern unsigned handler_AudioPlayer_bq_enqueue(IObject *thiz);
     37 extern unsigned handler_AudioPlayer_abq_enqueue(IObject *thiz);
     38 extern unsigned handler_AudioPlayer_play_state(IObject *thiz);
     39 extern unsigned handler_AudioRecorder_transport(IObject *thiz);
     40 extern unsigned handler_MidiPlayer_gain(IObject *thiz);
     41 extern unsigned handler_MidiPlayer_position(IObject *thiz);
     42 extern unsigned handler_OutputMix_gain(IObject *thiz);
     43 #else
     44 #define handler_MediaPlayer_gain        NULL
     45 #define handler_MediaPlayer_transport   NULL
     46 #define handler_MediaPlayer_position    NULL
     47 #define handler_MediaPlayer_abq_enqueue NULL
     48 #define handler_MediaPlayer_play_state  NULL
     49 #define handler_AudioPlayer_transport   NULL
     50 #define handler_AudioPlayer_position    NULL
     51 #define handler_AudioPlayer_bq_enqueue  NULL
     52 #define handler_AudioPlayer_abq_enqueue NULL
     53 #define handler_AudioPlayer_play_state  NULL
     54 #define handler_AudioRecorder_transport NULL
     55 #define handler_MidiPlayer_gain         NULL
     56 #define handler_MidiPlayer_position     NULL
     57 #define handler_OutputMix_gain          NULL
     58 #endif
     59 
     60 #ifdef __cplusplus
     61 }
     62 #endif
     63 
     64 
     65 /* Table entry for an attribute update handler.
     66  *
     67  * If the Object ID table index matches the object's ID, and the attribute table index
     68  * match any of the updated attributes, then the specified handler
     69  * is called.  The handler is called with the object's mutex locked,
     70  * and should return with mutex locked.  The handler returns a bitmask of the attributes which
     71  * were actually handled.  This is normally the same as the attribute index,
     72  * but could be a subset (including 0) if the handler discovers that the
     73  * update is too complex to be handled synchronously and so must
     74  * be deferred to the sync thread.  Note that this direct lookup table organization
     75  * gives O(1) search.
     76  */
     77 
     78 typedef unsigned (*AttributeHandler)(IObject *thiz);
     79 
     80 extern const AttributeHandler handlerTable[][ATTR_INDEX_MAX];
     81 
     82 #undef IObject
     83 
     84 #endif // !defined(__handlers_h)
     85