OpenSLES_Android.h revision e945a85a903cfb83a8965a3246c9e1718023a897
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 SLuint32 SLAbufferQueueEvent; 31 32 33/*---------------------------------------------------------------------------*/ 34/* Android Effect interface */ 35/*---------------------------------------------------------------------------*/ 36 37extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECT; 38 39/** Android Effect interface methods */ 40 41struct SLAndroidEffectItf_; 42typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf; 43 44struct SLAndroidEffectItf_ { 45 46 SLresult (*CreateEffect) (SLAndroidEffectItf self, 47 SLInterfaceID effectImplementationId); 48 49 SLresult (*ReleaseEffect) (SLAndroidEffectItf self, 50 SLInterfaceID effectImplementationId); 51 52 SLresult (*SetEnabled) (SLAndroidEffectItf self, 53 SLInterfaceID effectImplementationId, 54 SLboolean enabled); 55 56 SLresult (*IsEnabled) (SLAndroidEffectItf self, 57 SLInterfaceID effectImplementationId, 58 SLboolean *pEnabled); 59 60 SLresult (*SendCommand) (SLAndroidEffectItf self, 61 SLInterfaceID effectImplementationId, 62 SLuint32 command, 63 SLuint32 commandSize, 64 void *pCommandData, 65 SLuint32 *replySize, 66 void *pReplyData); 67}; 68 69 70/*---------------------------------------------------------------------------*/ 71/* Android Effect Send interface */ 72/*---------------------------------------------------------------------------*/ 73 74extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTSEND; 75 76/** Android Effect Send interface methods */ 77 78struct SLAndroidEffectSendItf_; 79typedef const struct SLAndroidEffectSendItf_ * const * SLAndroidEffectSendItf; 80 81struct SLAndroidEffectSendItf_ { 82 SLresult (*EnableEffectSend) ( 83 SLAndroidEffectSendItf self, 84 SLInterfaceID effectImplementationId, 85 SLboolean enable, 86 SLmillibel initialLevel 87 ); 88 SLresult (*IsEnabled) ( 89 SLAndroidEffectSendItf self, 90 SLInterfaceID effectImplementationId, 91 SLboolean *pEnable 92 ); 93 SLresult (*SetDirectLevel) ( 94 SLAndroidEffectSendItf self, 95 SLmillibel directLevel 96 ); 97 SLresult (*GetDirectLevel) ( 98 SLAndroidEffectSendItf self, 99 SLmillibel *pDirectLevel 100 ); 101 SLresult (*SetSendLevel) ( 102 SLAndroidEffectSendItf self, 103 SLInterfaceID effectImplementationId, 104 SLmillibel sendLevel 105 ); 106 SLresult (*GetSendLevel)( 107 SLAndroidEffectSendItf self, 108 SLInterfaceID effectImplementationId, 109 SLmillibel *pSendLevel 110 ); 111}; 112 113 114/*---------------------------------------------------------------------------*/ 115/* Android Effect Capabilities interface */ 116/*---------------------------------------------------------------------------*/ 117 118extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES; 119 120/** Android Effect Capabilities interface methods */ 121 122struct SLAndroidEffectCapabilitiesItf_; 123typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf; 124 125struct SLAndroidEffectCapabilitiesItf_ { 126 127 SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self, 128 SLuint32 *pNumSupportedEffects); 129 130 131 SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self, 132 SLuint32 index, 133 SLInterfaceID *pEffectType, 134 SLInterfaceID *pEffectImplementation, 135 SLchar *pName, 136 SLuint16 *pNameSize); 137}; 138 139 140/*---------------------------------------------------------------------------*/ 141/* Android Configuration interface */ 142/*---------------------------------------------------------------------------*/ 143extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDCONFIGURATION; 144 145/** Android Configuration interface methods */ 146 147struct SLAndroidConfigurationItf_; 148typedef const struct SLAndroidConfigurationItf_ * const * SLAndroidConfigurationItf; 149 150struct SLAndroidConfigurationItf_ { 151 152 SLresult (*SetConfiguration) (SLAndroidConfigurationItf self, 153 const SLchar *configKey, 154 const void *pConfigValue, 155 SLuint32 valueSize); 156 157 SLresult (*GetConfiguration) (SLAndroidConfigurationItf self, 158 const SLchar *configKey, 159 SLuint32 *pValueSize, 160 void *pConfigValue 161 ); 162}; 163 164 165/*---------------------------------------------------------------------------*/ 166/* Android Simple Buffer Queue Interface */ 167/*---------------------------------------------------------------------------*/ 168 169extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE; 170 171struct SLAndroidSimpleBufferQueueItf_; 172typedef const struct SLAndroidSimpleBufferQueueItf_ * const * SLAndroidSimpleBufferQueueItf; 173 174typedef void (/*SLAPIENTRY*/ *slAndroidSimpleBufferQueueCallback)( 175 SLAndroidSimpleBufferQueueItf caller, 176 void *pContext 177); 178 179/** Android simple buffer queue state **/ 180 181typedef struct SLAndroidSimpleBufferQueueState_ { 182 SLuint32 count; 183 SLuint32 index; 184} SLAndroidSimpleBufferQueueState; 185 186 187struct SLAndroidSimpleBufferQueueItf_ { 188 SLresult (*Enqueue) ( 189 SLAndroidSimpleBufferQueueItf self, 190 const void *pBuffer, 191 SLuint32 size 192 ); 193 SLresult (*Clear) ( 194 SLAndroidSimpleBufferQueueItf self 195 ); 196 SLresult (*GetState) ( 197 SLAndroidSimpleBufferQueueItf self, 198 SLAndroidSimpleBufferQueueState *pState 199 ); 200 SLresult (*RegisterCallback) ( 201 SLAndroidSimpleBufferQueueItf self, 202 slAndroidSimpleBufferQueueCallback callback, 203 void* pContext 204 ); 205}; 206 207 208/*---------------------------------------------------------------------------*/ 209/* Android Buffer Qeueue Interface */ 210/*---------------------------------------------------------------------------*/ 211 212extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDBUFFERQUEUE; 213 214struct SLAndroidBufferQueueItf_; 215typedef const struct SLAndroidBufferQueueItf_ * const * SLAndroidBufferQueueItf; 216 217#define SL_ANDROIDBUFFERQUEUE_EVENT_NONE ((SLuint32) 0x00000000) 218#define SL_ANDROIDBUFFERQUEUE_EVENT_EOS ((SLuint32) 0x00000001) 219#define SL_ANDROIDBUFFERQUEUE_EVENT_DISCONTINUITY ((SLuint32) 0x00000002) 220 221typedef SLresult (/*SLAPIENTRY*/ *slAndroidBufferQueueCallback)( 222 SLAndroidBufferQueueItf caller,/* input */ 223 void *pContext, /* input */ 224 SLuint32 bufferId, /* input */ 225 SLAint64 bufferLength, /* input */ 226 void *pBufferDataLocation /* input */ 227); 228 229struct SLAndroidBufferQueueItf_ { 230 SLresult (*RegisterCallback) ( 231 SLAndroidBufferQueueItf self, 232 slAndroidBufferQueueCallback callback, 233 void* pContext 234 ); 235 236 SLresult (*Clear) ( 237 SLAndroidBufferQueueItf self 238 ); 239 240 SLresult (*Enqueue) ( 241 SLAndroidBufferQueueItf self, 242 SLuint32 bufferId, 243 SLuint32 length, 244 SLAbufferQueueEvent event, 245 void *pData 246 ); 247 248 // FIXME TBD if needed 249 /* 250 SLResult (*SetCallbackEventMask) ( 251 SLAndroidBufferQueueItf self, 252 SLuint32 eventMask 253 ); 254 SLResult (*GetCallbackEventMask) ( 255 SLAndroidBufferQueueItf self, 256 SLuint32 *pEventMask 257 ); 258 */ 259}; 260 261 262/*---------------------------------------------------------------------------*/ 263/* Android File Descriptor Data Locator */ 264/*---------------------------------------------------------------------------*/ 265 266/** Addendum to Data locator macros */ 267#define SL_DATALOCATOR_ANDROIDFD ((SLuint32) 0x800007BC) 268 269#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll) 270 271/** File Descriptor-based data locator definition, locatorType must be SL_DATALOCATOR_ANDROIDFD */ 272typedef struct SLDataLocator_AndroidFD_ { 273 SLuint32 locatorType; 274 SLint32 fd; 275 SLAint64 offset; 276 SLAint64 length; 277} SLDataLocator_AndroidFD; 278 279 280/*---------------------------------------------------------------------------*/ 281/* Android Android Simple Buffer Queue Data Locator */ 282/*---------------------------------------------------------------------------*/ 283 284/** Addendum to Data locator macros */ 285#define SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE ((SLuint32) 0x800007BD) 286 287/** BufferQueue-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE*/ 288typedef struct SLDataLocator_AndroidSimpleBufferQueue { 289 SLuint32 locatorType; 290 SLuint32 numBuffers; 291} SLDataLocator_AndroidSimpleBufferQueue; 292 293 294/*---------------------------------------------------------------------------*/ 295/* Android Buffer Queue Data Locator */ 296/*---------------------------------------------------------------------------*/ 297 298/** Addendum to Data locator macros */ 299#define SL_DATALOCATOR_ANDROIDBUFFERQUEUE ((SLuint32) 0x800007BE) 300 301/** Android Buffer Queue-based data locator definition, 302 * locatorType must be SL_DATALOCATOR_ANDROIDBUFFERQUEUE */ 303typedef struct SLDataLocator_AndroidBufferQueue_ { 304 SLuint32 locatorType; 305 SLuint32 numBuffers; 306 SLuint32 queueSize; // FIXME use optional queue size for shared memory size? 307} SLDataLocator_AndroidBufferQueue; 308 309#ifdef __cplusplus 310} 311#endif /* __cplusplus */ 312 313#endif /* OPENSL_ES_ANDROID_H_ */ 314