17b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten/*
27b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * Copyright (C) 2011 The Android Open Source Project
37b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten *
47b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * Licensed under the Apache License, Version 2.0 (the "License");
57b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * you may not use this file except in compliance with the License.
67b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * You may obtain a copy of the License at
77b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten *
87b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten *      http://www.apache.org/licenses/LICENSE-2.0
97b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten *
107b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * Unless required by applicable law or agreed to in writing, software
117b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * distributed under the License is distributed on an "AS IS" BASIS,
127b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * See the License for the specific language governing permissions and
147b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * limitations under the License.
157b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten */
167b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
177b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#ifndef __handlers_h
187b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define __handlers_h
197b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
207b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define IObject struct Object_interface
217b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn KastenIObject;
227b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
237b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#ifdef __cplusplus
247b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern "C" {
257b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#endif
267b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
277b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_MediaPlayer_gain(IObject *thiz);
287b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#ifdef ANDROID
297b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_MediaPlayer_transport(IObject *thiz);
307b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_MediaPlayer_position(IObject *thiz);
317b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_MediaPlayer_abq_enqueue(IObject *thiz);
32bcfe680db1e392f3bb29382c2e15e89c3af783edGlenn Kastenextern unsigned handler_MediaPlayer_play_state(IObject *thiz);
337b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_AudioPlayer_gain(IObject *thiz);
347b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_AudioPlayer_transport(IObject *thiz);
357b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_AudioPlayer_position(IObject *thiz);
367b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_AudioPlayer_bq_enqueue(IObject *thiz);
377b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_AudioPlayer_abq_enqueue(IObject *thiz);
38f4647bf85968ab30eb07f9a80b99177d91068f94Glenn Kastenextern unsigned handler_AudioPlayer_play_state(IObject *thiz);
397b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_AudioRecorder_transport(IObject *thiz);
407b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_MidiPlayer_gain(IObject *thiz);
417b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_MidiPlayer_position(IObject *thiz);
427b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern unsigned handler_OutputMix_gain(IObject *thiz);
437b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#else
447b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_MediaPlayer_gain        NULL
457b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_MediaPlayer_transport   NULL
467b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_MediaPlayer_position    NULL
477b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_MediaPlayer_abq_enqueue NULL
48f4647bf85968ab30eb07f9a80b99177d91068f94Glenn Kasten#define handler_MediaPlayer_play_state  NULL
497b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_AudioPlayer_transport   NULL
507b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_AudioPlayer_position    NULL
517b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_AudioPlayer_bq_enqueue  NULL
527b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_AudioPlayer_abq_enqueue NULL
53f4647bf85968ab30eb07f9a80b99177d91068f94Glenn Kasten#define handler_AudioPlayer_play_state  NULL
547b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_AudioRecorder_transport NULL
557b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_MidiPlayer_gain         NULL
567b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_MidiPlayer_position     NULL
577b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#define handler_OutputMix_gain          NULL
587b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#endif
597b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
607b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#ifdef __cplusplus
617b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten}
627b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#endif
637b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
647b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
657b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten/* Table entry for an attribute update handler.
667b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten *
677b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * If the Object ID table index matches the object's ID, and the attribute table index
687b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * match any of the updated attributes, then the specified handler
697b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * is called.  The handler is called with the object's mutex locked,
707b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * and should return with mutex locked.  The handler returns a bitmask of the attributes which
717b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * were actually handled.  This is normally the same as the attribute index,
727b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * but could be a subset (including 0) if the handler discovers that the
737b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * update is too complex to be handled synchronously and so must
747b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * be deferred to the sync thread.  Note that this direct lookup table organization
757b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten * gives O(1) search.
767b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten */
777b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
787b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastentypedef unsigned (*AttributeHandler)(IObject *thiz);
797b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
807b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kastenextern const AttributeHandler handlerTable[][ATTR_INDEX_MAX];
817b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
827b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#undef IObject
837b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten
847b726bdcd996f1cab3a584c04ce1afc07bc8fbe7Glenn Kasten#endif // !defined(__handlers_h)
85