OpenSLES_Android.h revision e9236d046fdb5cac0696c42e03443a2439188146
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#ifndef OPENSL_ES_ANDROID_H_ 18#define OPENSL_ES_ANDROID_H_ 19 20#ifdef __cplusplus 21extern "C" { 22#endif 23 24/*---------------------------------------------------------------------------*/ 25/* Android common types */ 26/*---------------------------------------------------------------------------*/ 27 28typedef sl_int64_t SLAint64; /* 64 bit signed integer */ 29 30typedef sl_uint64_t SLAuint64; /* 64 bit unsigned integer */ 31 32/*---------------------------------------------------------------------------*/ 33/* Android Effect interface */ 34/*---------------------------------------------------------------------------*/ 35 36extern SL_API const SLInterfaceID SL_IID_ANDROIDEFFECT; 37 38/** Android Effect interface methods */ 39 40struct SLAndroidEffectItf_; 41typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf; 42 43struct SLAndroidEffectItf_ { 44 45 SLresult (*CreateEffect) (SLAndroidEffectItf self, 46 SLInterfaceID effectImplementationId); 47 48 SLresult (*ReleaseEffect) (SLAndroidEffectItf self, 49 SLInterfaceID effectImplementationId); 50 51 SLresult (*SetEnabled) (SLAndroidEffectItf self, 52 SLInterfaceID effectImplementationId, 53 SLboolean enabled); 54 55 SLresult (*IsEnabled) (SLAndroidEffectItf self, 56 SLInterfaceID effectImplementationId, 57 SLboolean *pEnabled); 58 59 SLresult (*SendCommand) (SLAndroidEffectItf self, 60 SLInterfaceID effectImplementationId, 61 SLuint32 command, 62 SLuint32 commandSize, 63 void *pCommandData, 64 SLuint32 *replySize, 65 void *pReplyData); 66}; 67 68 69/*---------------------------------------------------------------------------*/ 70/* Android Effect Send interface */ 71/*---------------------------------------------------------------------------*/ 72 73extern SL_API const SLInterfaceID SL_IID_ANDROIDEFFECTSEND; 74 75/** Android Effect Send interface methods */ 76 77struct SLAndroidEffectSendItf_; 78typedef const struct SLAndroidEffectSendItf_ * const * SLAndroidEffectSendItf; 79 80struct SLAndroidEffectSendItf_ { 81 SLresult (*EnableEffectSend) ( 82 SLAndroidEffectSendItf self, 83 SLInterfaceID effectImplementationId, 84 SLboolean enable, 85 SLmillibel initialLevel 86 ); 87 SLresult (*IsEnabled) ( 88 SLAndroidEffectSendItf self, 89 SLInterfaceID effectImplementationId, 90 SLboolean *pEnable 91 ); 92 SLresult (*SetDirectLevel) ( 93 SLAndroidEffectSendItf self, 94 SLmillibel directLevel 95 ); 96 SLresult (*GetDirectLevel) ( 97 SLAndroidEffectSendItf self, 98 SLmillibel *pDirectLevel 99 ); 100 SLresult (*SetSendLevel) ( 101 SLAndroidEffectSendItf self, 102 SLInterfaceID effectImplementationId, 103 SLmillibel sendLevel 104 ); 105 SLresult (*GetSendLevel)( 106 SLAndroidEffectSendItf self, 107 SLInterfaceID effectImplementationId, 108 SLmillibel *pSendLevel 109 ); 110}; 111 112 113/*---------------------------------------------------------------------------*/ 114/* Android Effect Capabilities interface */ 115/*---------------------------------------------------------------------------*/ 116 117extern SL_API const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES; 118 119/** Android Effect Capabilities interface methods */ 120 121struct SLAndroidEffectCapabilitiesItf_; 122typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf; 123 124struct SLAndroidEffectCapabilitiesItf_ { 125 126 SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self, 127 SLuint32 *pNumSupportedEffects); 128 129 130 SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self, 131 SLuint32 index, 132 SLInterfaceID *pEffectType, 133 SLInterfaceID *pEffectImplementation, 134 SLchar *pName, 135 SLuint16 *pNameSize); 136}; 137 138 139/*---------------------------------------------------------------------------*/ 140/* Android Configuration interface */ 141/*---------------------------------------------------------------------------*/ 142extern SL_API const SLInterfaceID SL_IID_ANDROIDCONFIGURATION; 143 144/** Android Configuration interface methods */ 145 146struct SLAndroidConfigurationItf_; 147typedef const struct SLAndroidConfigurationItf_ * const * SLAndroidConfigurationItf; 148 149struct SLAndroidConfigurationItf_ { 150 151 SLresult (*SetConfiguration) (SLAndroidConfigurationItf self, 152 const SLchar *configKey, 153 const void *pConfigValue, 154 SLuint32 valueSize); 155 156 SLresult (*GetConfiguration) (SLAndroidConfigurationItf self, 157 const SLchar *configKey, 158 SLuint32 *pValueSize, 159 void *pConfigValue 160 ); 161}; 162 163 164/*---------------------------------------------------------------------------*/ 165/* Android Simple Buffer Queue Interface */ 166/*---------------------------------------------------------------------------*/ 167 168extern SL_API const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE; 169 170struct SLAndroidSimpleBufferQueueItf_; 171typedef const struct SLAndroidSimpleBufferQueueItf_ * const * SLAndroidSimpleBufferQueueItf; 172 173typedef void (SLAPIENTRY *slAndroidSimpleBufferQueueCallback)( 174 SLAndroidSimpleBufferQueueItf caller, 175 void *pContext 176); 177 178/** Android simple buffer queue state **/ 179 180typedef struct SLAndroidSimpleBufferQueueState_ { 181 SLuint32 count; 182 SLuint32 index; 183} SLAndroidSimpleBufferQueueState; 184 185 186struct SLAndroidSimpleBufferQueueItf_ { 187 SLresult (*Enqueue) ( 188 SLAndroidSimpleBufferQueueItf self, 189 const void *pBuffer, 190 SLuint32 size 191 ); 192 SLresult (*Clear) ( 193 SLAndroidSimpleBufferQueueItf self 194 ); 195 SLresult (*GetState) ( 196 SLAndroidSimpleBufferQueueItf self, 197 SLAndroidSimpleBufferQueueState *pState 198 ); 199 SLresult (*RegisterCallback) ( 200 SLAndroidSimpleBufferQueueItf self, 201 slAndroidSimpleBufferQueueCallback callback, 202 void* pContext 203 ); 204}; 205 206 207/*---------------------------------------------------------------------------*/ 208/* Android Buffer Queue Interface */ 209/*---------------------------------------------------------------------------*/ 210 211extern SL_API const SLInterfaceID SL_IID_ANDROIDBUFFERQUEUE; 212 213struct SLAndroidBufferQueueItf_; 214typedef const struct SLAndroidBufferQueueItf_ * const * SLAndroidBufferQueueItf; 215 216#define SL_ANDROID_ITEMKEY_NONE ((SLuint32) 0x00000000) 217#define SL_ANDROID_ITEMKEY_EOS ((SLuint32) 0x00000001) 218#define SL_ANDROID_ITEMKEY_DISCONTINUITY ((SLuint32) 0x00000002) 219#define SL_ANDROID_ITEMKEY_BUFFERQUEUEEVENT ((SLuint32) 0x00000003) 220 221#define SL_ANDROIDBUFFERQUEUEEVENT_NONE ((SLuint32) 0x00000000) 222#define SL_ANDROIDBUFFERQUEUEEVENT_PROCESSED ((SLuint32) 0x00000001) 223#define SL_ANDROIDBUFFERQUEUEEVENT_UNREALIZED ((SLuint32) 0x00000002) 224#define SL_ANDROIDBUFFERQUEUEEVENT_CLEARED ((SLuint32) 0x00000004) 225#define SL_ANDROIDBUFFERQUEUEEVENT_STOPPED ((SLuint32) 0x00000008) 226#define SL_ANDROIDBUFFERQUEUEEVENT_ERROR ((SLuint32) 0x00000010) 227#define SL_ANDROIDBUFFERQUEUEEVENT_CONTENT_END ((SLuint32) 0x00000020) 228 229typedef struct SLAndroidBufferItem_ { 230 SLuint32 itemKey; // identifies the item 231 SLuint32 itemSize; 232 SLuint8 itemData[0]; 233} SLAndroidBufferItem; 234 235typedef SLresult (SLAPIENTRY *slAndroidBufferQueueCallback)( 236 SLAndroidBufferQueueItf caller,/* input */ 237 void *pCallbackContext, /* input */ 238 void *pBufferContext, /* input */ 239 void *pBufferData, /* input */ 240 SLuint32 dataSize, /* input */ 241 SLuint32 dataUsed, /* input */ 242 const SLAndroidBufferItem *pItems,/* input */ 243 SLuint32 itemsLength /* input */ 244); 245 246typedef struct SLAndroidBufferQueueState_ { 247 SLuint32 count; 248 SLuint32 index; 249} SLAndroidBufferQueueState; 250 251struct SLAndroidBufferQueueItf_ { 252 SLresult (*RegisterCallback) ( 253 SLAndroidBufferQueueItf self, 254 slAndroidBufferQueueCallback callback, 255 void* pCallbackContext 256 ); 257 258 SLresult (*Clear) ( 259 SLAndroidBufferQueueItf self 260 ); 261 262 SLresult (*Enqueue) ( 263 SLAndroidBufferQueueItf self, 264 void *pBufferContext, 265 void *pData, 266 SLuint32 dataLength, 267 const SLAndroidBufferItem *pItems, 268 SLuint32 itemsLength 269 ); 270 271 SLresult (*GetState) ( 272 SLAndroidBufferQueueItf self, 273 SLAndroidBufferQueueState *pState 274 ); 275 276 SLresult (*SetCallbackEventsMask) ( 277 SLAndroidBufferQueueItf self, 278 SLuint32 eventFlags 279 ); 280 281 SLresult (*GetCallbackEventsMask) ( 282 SLAndroidBufferQueueItf self, 283 SLuint32 *pEventFlags 284 ); 285}; 286 287 288/*---------------------------------------------------------------------------*/ 289/* Android File Descriptor Data Locator */ 290/*---------------------------------------------------------------------------*/ 291 292/** Addendum to Data locator macros */ 293#define SL_DATALOCATOR_ANDROIDFD ((SLuint32) 0x800007BC) 294 295#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll) 296 297/** File Descriptor-based data locator definition, locatorType must be SL_DATALOCATOR_ANDROIDFD */ 298typedef struct SLDataLocator_AndroidFD_ { 299 SLuint32 locatorType; 300 SLint32 fd; 301 SLAint64 offset; 302 SLAint64 length; 303} SLDataLocator_AndroidFD; 304 305 306/*---------------------------------------------------------------------------*/ 307/* Android Android Simple Buffer Queue Data Locator */ 308/*---------------------------------------------------------------------------*/ 309 310/** Addendum to Data locator macros */ 311#define SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE ((SLuint32) 0x800007BD) 312 313/** BufferQueue-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE*/ 314typedef struct SLDataLocator_AndroidSimpleBufferQueue { 315 SLuint32 locatorType; 316 SLuint32 numBuffers; 317} SLDataLocator_AndroidSimpleBufferQueue; 318 319 320/*---------------------------------------------------------------------------*/ 321/* Android Buffer Queue Data Locator */ 322/*---------------------------------------------------------------------------*/ 323 324/** Addendum to Data locator macros */ 325#define SL_DATALOCATOR_ANDROIDBUFFERQUEUE ((SLuint32) 0x800007BE) 326 327/** Android Buffer Queue-based data locator definition, 328 * locatorType must be SL_DATALOCATOR_ANDROIDBUFFERQUEUE */ 329typedef struct SLDataLocator_AndroidBufferQueue_ { 330 SLuint32 locatorType; 331 SLuint32 numBuffers; 332} SLDataLocator_AndroidBufferQueue; 333 334#ifdef __cplusplus 335} 336#endif /* __cplusplus */ 337 338#endif /* OPENSL_ES_ANDROID_H_ */ 339