android_defs.h revision 262059f71a68edc5e510427c63f5f1623d3672a8
1/* 2 * Copyright (C) 2010 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 18/** 19 * Used to define the mapping from an OpenSL ES audio player to an Android 20 * media framework object 21 */ 22enum AndroidObject_type { 23 INVALID_TYPE =-1, 24 A_PLR_URI_FD = 0, // audio player, compressed data, URI or FD data source 25 A_PLR_PCM_BQ = 1, // audio player, PCM, buffer queue data source 26 A_PLR_TS_ABQ = 2, // audio player, transport stream, Android buffer queue data source 27 AV_PLR_TS_ABQ = 3, // audio video player, transport stream, Android buffer queue data source 28 AV_PLR_URI_FD = 4, // audio video player, compressed data, URI or FD data source 29 NUM_AUDIOPLAYER_MAP_TYPES 30}; 31 32 33/** 34 * Used to define the states of the OpenSL ES / OpenMAX AL object initialization and preparation 35 * with regards to the Android-side of the data 36 */ 37enum AndroidObject_state { 38 ANDROID_UNINITIALIZED = -1, 39 ANDROID_PREPARING, 40 ANDROID_READY, 41 NUM_ANDROID_STATES 42}; 43 44 45#define ANDROID_DEFAULT_OUTPUT_STREAM_TYPE android::AudioSystem::MUSIC 46 47#define PLAYER_SUCCESS 1 48 49#define PLAYER_FD_FIND_FILE_SIZE ((int64_t)0xFFFFFFFFFFFFFFFFll) 50 51 52/* 53 * Structure to maintain the set of audio levels about a player 54 */ 55typedef struct AndroidAudioLevels_struct { 56/** send level to aux effect, there's a single aux bus, so there's a single level */ 57 SLmillibel mAuxSendLevel; 58 /** 59 * Amplification (can be attenuation) factor derived for the VolumeLevel 60 */ 61 float mAmplFromVolLevel; 62 /** 63 * Left/right amplification (can be attenuations) factors derived for the StereoPosition 64 */ 65 float mAmplFromStereoPos[STEREO_CHANNELS]; 66 /** 67 * Attenuation factor derived from direct level 68 */ 69 float mAmplFromDirectLevel; 70} AndroidAudioLevels; 71 72 73typedef void (*notif_client_t)(int event, const int data1, void* notifUser); 74 75 76/** 77 * events sent to mNotifyClient during prepare, prefetch, and playback 78 */ 79#define PLAYEREVENT_PREPARED "prep" 80#define PLAYEREVENT_PREFETCHSTATUSCHANGE "prsc" 81#define PLAYEREVENT_PREFETCHFILLLEVELUPDATE "pflu" 82#define PLAYEREVENT_ENDOFSTREAM "eos" 83#define PLAYEREVENT_NEW_AUDIOTRACK "nwat" 84 85 86namespace android { 87 88enum { 89 kDataLocatorNone = 'none', 90 kDataLocatorUri = 'uri', 91 kDataLocatorFd = 'fd', 92 }; 93 94struct FdInfo { 95 int fd; 96 int64_t offset; 97 int64_t length; 98}; 99 100union DataLocator { 101 char* uri; 102 FdInfo fdi; 103}; 104 105} // namespace android 106