[go: nahoru, domu]

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#include "Configuration.h"
18#ifdef ANDROID
19#include <jni.h>
20
21#include "media/AudioEffect.h"
22#include "hardware/audio_effect.h"
23#endif
24
25/* Interface structures */
26
27typedef struct Object_interface {
28    const struct SLObjectItf_ *mItf;    // const
29    // field mThis would be redundant within an IObject, so we substitute mEngine
30    CEngine *mEngine;               // const
31    const ClassTable *mClass;       // const
32    SLuint32 mInstanceID;           // const for debugger and for RPC, 0 means unpublished
33    slObjectCallback mCallback;
34    void *mContext;
35    unsigned mGottenMask;           ///< bit-mask of interfaces exposed or added, then gotten
36    unsigned mLossOfControlMask;    // interfaces with loss of control enabled
37    unsigned mAttributesMask;       // attributes which have changed since last sync
38#if USE_PROFILES & USE_PROFILES_BASE
39    SLint32 mPriority;
40#endif
41    pthread_mutex_t mMutex;
42#ifdef USE_DEBUG
43    // Only keep the pthread_t, not the kernel tid, because pthread_self() is very fast
44    // (typically just arithmetic on the stack pointer). But a gettid() is a kernel call
45    // and so too slow to do every time a mutex is acquired. However, we can determine
46    // the kernel tid from the pthread_t.
47    pthread_t mOwner;
48    const char *mFile;
49    int mLine;
50    volatile int32_t mGeneration;   // read without a lock, incremented with a lock
51#endif
52    pthread_cond_t mCond;
53    SLuint8 mState;                 // really SLuint32, but SLuint8 to save space
54#if USE_PROFILES & USE_PROFILES_BASE
55    SLuint8 mPreemptable;           // really SLboolean, but SLuint8 to save space
56#else
57    SLuint8 mPadding;
58#endif
59    SLuint8 mStrongRefCount;        // number of strong references to this object
60    // (object cannot be destroyed as long as > 0, and referrers _prefer_ it stay in Realized state)
61    // for best alignment, do not add any fields here
62#define INTERFACES_Default 1
63    SLuint8 mInterfaceStates[INTERFACES_Default];    // state of each of interface
64    // do not add any fields here
65} IObject;
66
67#include "locks.h"
68
69typedef struct {
70    const struct SL3DCommitItf_ *mItf;
71    IObject *mThis;
72    SLboolean mDeferred;
73    SLuint32 mGeneration;   // incremented each master clock cycle
74    SLuint32 mWaiting;      // number of threads waiting in Commit
75} I3DCommit;
76
77enum CartesianSphericalActive {
78    CARTESIAN_COMPUTED_SPHERICAL_SET,
79    CARTESIAN_REQUESTED_SPHERICAL_SET,
80    CARTESIAN_UNKNOWN_SPHERICAL_SET,
81    CARTESIAN_SET_SPHERICAL_COMPUTED,   // not in 1.0.1
82    CARTESIAN_SET_SPHERICAL_REQUESTED,  // not in 1.0.1
83    CARTESIAN_SET_SPHERICAL_UNKNOWN
84};
85
86typedef struct {
87    const struct SL3DDopplerItf_ *mItf;
88    IObject *mThis;
89    // The API allows client to specify either Cartesian and spherical velocities.
90    // But an implementation will likely prefer one or the other. So for
91    // maximum portablity, we maintain both units and an indication of which
92    // unit was set most recently. In addition, we keep a flag saying whether
93    // the other unit has been derived yet. It can take significant time
94    // to compute the other unit, so this may be deferred to another thread.
95    // For this reason we also keep an indication of whether the secondary
96    // has been computed yet, and its accuracy.
97    // Though only one unit is primary at a time, a union is inappropriate:
98    // the application might read in both units (not in 1.0.1),
99    // and due to multi-threading concerns.
100    SLVec3D mVelocityCartesian;
101    struct {
102        SLmillidegree mAzimuth;
103        SLmillidegree mElevation;
104        SLmillidegree mSpeed;
105    } mVelocitySpherical;
106    enum CartesianSphericalActive mVelocityActive;
107    SLpermille mDopplerFactor;
108} I3DDoppler;
109
110typedef struct {
111    const struct SL3DGroupingItf_ *mItf;
112    IObject *mThis;
113    C3DGroup *mGroup;   // strong reference to associated group or NULL
114} I3DGrouping;
115
116enum AnglesVectorsActive {
117    ANGLES_COMPUTED_VECTORS_SET,    // not in 1.0.1
118    ANGLES_REQUESTED_VECTORS_SET,   // not in 1.0.1
119    ANGLES_UNKNOWN_VECTORS_SET,
120    ANGLES_SET_VECTORS_COMPUTED,
121    ANGLES_SET_VECTORS_REQUESTED,
122    ANGLES_SET_VECTORS_UNKNOWN
123};
124
125typedef struct {
126    const struct SL3DLocationItf_ *mItf;
127    IObject *mThis;
128    SLVec3D mLocationCartesian;
129    struct {
130        SLmillidegree mAzimuth;
131        SLmillidegree mElevation;
132        SLmillimeter mDistance;
133    } mLocationSpherical;
134    enum CartesianSphericalActive mLocationActive;
135    struct {
136        SLmillidegree mHeading;
137        SLmillidegree mPitch;
138        SLmillidegree mRoll;
139    } mOrientationAngles;
140    struct {
141        SLVec3D mFront;
142        SLVec3D mAbove;
143        SLVec3D mUp;
144    } mOrientationVectors;
145    enum AnglesVectorsActive mOrientationActive;
146    // Rotations can be slow, so are deferred.
147    SLmillidegree mTheta;
148    SLVec3D mAxis;
149    SLboolean mRotatePending;
150} I3DLocation;
151
152typedef struct {
153    const struct SL3DMacroscopicItf_ *mItf;
154    IObject *mThis;
155    struct {
156        SLmillimeter mWidth;
157        SLmillimeter mHeight;
158        SLmillimeter mDepth;
159    } mSize;
160    struct {
161        SLmillimeter mHeading;
162        SLmillimeter mPitch;
163        SLmillimeter mRoll;
164    } mOrientationAngles;
165    struct {
166        SLVec3D mFront;
167        SLVec3D mAbove;
168        SLVec3D mUp;
169    } mOrientationVectors;
170    enum AnglesVectorsActive mOrientationActive;
171    // Rotations can be slow, so are deferred.
172    SLmillidegree mTheta;
173    SLVec3D mAxis;
174    SLboolean mRotatePending;
175} I3DMacroscopic;
176
177typedef struct {
178    const struct SL3DSourceItf_ *mItf;
179    IObject *mThis;
180    SLboolean mHeadRelative;
181    SLboolean mRolloffMaxDistanceMute;
182    SLmillimeter mMaxDistance;
183    SLmillimeter mMinDistance;
184    SLmillidegree mConeInnerAngle;
185    SLmillidegree mConeOuterAngle;
186    SLmillibel mConeOuterLevel;
187    SLpermille mRolloffFactor;
188    SLpermille mRoomRolloffFactor;
189    SLuint8 mDistanceModel;
190} I3DSource;
191
192typedef struct {
193    const struct SLAudioDecoderCapabilitiesItf_ *mItf;
194    IObject *mThis;
195} IAudioDecoderCapabilities;
196
197typedef struct {
198    const struct SLAudioEncoderItf_ *mItf;
199    IObject *mThis;
200    SLAudioEncoderSettings mSettings;
201} IAudioEncoder;
202
203typedef struct {
204    const struct SLAudioEncoderCapabilitiesItf_ *mItf;
205    IObject *mThis;
206} IAudioEncoderCapabilities;
207
208typedef struct {
209    const struct SLAudioIODeviceCapabilitiesItf_ *mItf;
210    IObject *mThis;
211    slAvailableAudioInputsChangedCallback mAvailableAudioInputsChangedCallback;
212    void *mAvailableAudioInputsChangedContext;
213    slAvailableAudioOutputsChangedCallback mAvailableAudioOutputsChangedCallback;
214    void *mAvailableAudioOutputsChangedContext;
215    slDefaultDeviceIDMapChangedCallback mDefaultDeviceIDMapChangedCallback;
216    void *mDefaultDeviceIDMapChangedContext;
217} IAudioIODeviceCapabilities;
218
219typedef struct {
220    const struct SLBassBoostItf_ *mItf;
221    IObject *mThis;
222    SLboolean mEnabled;
223    SLpermille mStrength;
224#if defined(ANDROID)
225    effect_descriptor_t mBassBoostDescriptor;
226    android::sp<android::AudioEffect> mBassBoostEffect;
227#endif
228} IBassBoost;
229
230typedef struct BufferQueue_interface {
231    const struct SLBufferQueueItf_ *mItf;
232    IObject *mThis;
233    SLBufferQueueState mState;
234    slBufferQueueCallback mCallback;
235    void *mContext;
236    // originally SLuint32, but range-checked down to SLuint16
237    SLuint16 mNumBuffers;
238    /*SLboolean*/ SLuint16 mClearRequested;
239    BufferHeader *mArray;
240    BufferHeader *mFront, *mRear;
241#ifdef ANDROID
242    SLuint32 mSizeConsumed;
243    bool mCallbackPending;
244#endif
245    // saves a malloc in the typical case
246#define BUFFER_HEADER_TYPICAL 4
247    BufferHeader mTypical[BUFFER_HEADER_TYPICAL+1];
248} IBufferQueue;
249
250#define MAX_DEVICE 2    // hard-coded array size for default in/out
251
252typedef struct {
253    const struct SLDeviceVolumeItf_ *mItf;
254    IObject *mThis;
255    SLint32 mVolume[MAX_DEVICE];
256} IDeviceVolume;
257
258typedef struct {
259    const struct SLDynamicInterfaceManagementItf_ *mItf;
260    IObject *mThis;
261    slDynamicInterfaceManagementCallback mCallback;
262    void *mContext;
263} IDynamicInterfaceManagement;
264
265typedef struct {
266    const struct SLDynamicSourceItf_ *mItf;
267    IObject *mThis;
268    SLDataSource *mDataSource;
269} IDynamicSource;
270
271// private
272
273struct EnableLevel {
274    SLboolean mEnable;
275    SLmillibel mSendLevel;
276};
277
278// indexes into IEffectSend.mEnableLevels
279
280#define AUX_ENVIRONMENTALREVERB 0
281#define AUX_PRESETREVERB        1
282#define AUX_MAX                 2
283
284typedef struct {
285    const struct SLEffectSendItf_ *mItf;
286    IObject *mThis;
287    struct EnableLevel mEnableLevels[AUX_MAX];  // wet enable and volume per effect type
288} IEffectSend;
289
290typedef struct Engine_interface {
291    const struct SLEngineItf_ *mItf;
292    IObject *mThis;
293    SLboolean mLossOfControlGlobal;
294#ifdef USE_SDL
295    COutputMix *mOutputMix; // SDL pulls PCM from an arbitrary IOutputMixExt
296#endif
297    // Each engine is its own universe.
298    SLuint32 mInstanceCount;
299    unsigned mInstanceMask; // 1 bit per active object
300    unsigned mChangedMask;  // objects which have changed since last sync
301#define MAX_INSTANCE 32     // maximum active objects per engine, see mInstanceMask
302    IObject *mInstances[MAX_INSTANCE];
303    SLboolean mShutdown;
304    SLboolean mShutdownAck;
305    // SLuint32 mVersion;      // 0xXXYYZZ where XX=major, YY=minor, ZZ=step
306    SLuint32 mNativeEndianness; // one of SL_BYTEORDER_LITTLEENDIAN or SL_BYTEORDER_BIGENDIAN
307} IEngine;
308
309typedef struct {
310    const struct SLEngineCapabilitiesItf_ *mItf;
311    IObject *mThis;
312    SLboolean mThreadSafe;
313    // const
314    SLuint32 mMaxIndexLED;
315    SLuint32 mMaxIndexVibra;
316} IEngineCapabilities;
317
318typedef struct {
319    const struct SLEnvironmentalReverbItf_ *mItf;
320    IObject *mThis;
321    SLEnvironmentalReverbSettings mProperties;
322#if defined(ANDROID)
323    effect_descriptor_t mEnvironmentalReverbDescriptor;
324    android::sp<android::AudioEffect> mEnvironmentalReverbEffect;
325#endif
326} IEnvironmentalReverb;
327
328struct EqualizerBand {
329    SLmilliHertz mMin;
330    SLmilliHertz mCenter;
331    SLmilliHertz mMax;
332};
333
334#if defined(ANDROID)
335#define MAX_EQ_BANDS 0
336#else
337#define MAX_EQ_BANDS 4  // compile-time limit, runtime limit may be smaller
338#endif
339
340typedef struct {
341    const struct SLEqualizerItf_ *mItf;
342    IObject *mThis;
343    SLboolean mEnabled;
344    SLuint16 mPreset;
345#if 0 < MAX_EQ_BANDS
346    SLmillibel mLevels[MAX_EQ_BANDS];
347#endif
348    // const to end of struct
349    SLuint16 mNumPresets;
350    SLuint16 mNumBands;
351#if !defined(ANDROID)
352    const struct EqualizerBand *mBands;
353    const struct EqualizerPreset *mPresets;
354#endif
355    SLmillibel mBandLevelRangeMin;
356    SLmillibel mBandLevelRangeMax;
357#if defined(ANDROID)
358    effect_descriptor_t mEqDescriptor;
359    android::sp<android::AudioEffect> mEqEffect;
360#endif
361} IEqualizer;
362
363#define MAX_LED_COUNT 32
364
365typedef struct {
366    const struct SLLEDArrayItf_ *mItf;
367    IObject *mThis;
368    SLuint32 mLightMask;
369    SLHSL mColors[MAX_LED_COUNT];
370    // const
371    SLuint8 mCount;
372} ILEDArray;
373
374typedef struct {
375    const struct SLMetadataExtractionItf_ *mItf;
376    IObject *mThis;
377    SLuint32 mKeySize;
378    const void *mKey;
379    SLuint32 mKeyEncoding;
380    const SLchar *mValueLangCountry;
381    SLuint32 mValueEncoding;
382    SLuint8 mFilterMask;
383    int mKeyFilter;
384} IMetadataExtraction;
385
386typedef struct {
387    const struct SLMetadataTraversalItf_ *mItf;
388    IObject *mThis;
389    SLuint32 mIndex;
390    SLuint32 mMode;
391    SLuint32 mCount;
392    SLuint32 mSize;
393} IMetadataTraversal;
394
395typedef struct {
396    const struct SLMIDIMessageItf_ *mItf;
397    IObject *mThis;
398    slMetaEventCallback mMetaEventCallback;
399    void *mMetaEventContext;
400    slMIDIMessageCallback mMessageCallback;
401    void *mMessageContext;
402    SLuint8 mMessageTypes;
403} IMIDIMessage;
404
405typedef struct {
406    const struct SLMIDIMuteSoloItf_ *mItf;
407    IObject *mThis;
408    SLuint16 mChannelMuteMask;
409    SLuint16 mChannelSoloMask;
410    SLuint32 mTrackMuteMask;
411    SLuint32 mTrackSoloMask;
412    // const
413    SLuint16 mTrackCount;
414} IMIDIMuteSolo;
415
416typedef struct {
417    const struct SLMIDITempoItf_ *mItf;
418    IObject *mThis;
419    SLuint32 mTicksPerQuarterNote;
420    SLuint32 mMicrosecondsPerQuarterNote;
421} IMIDITempo;
422
423typedef struct {
424    const struct SLMIDITimeItf_ *mItf;
425    IObject *mThis;
426    SLuint32 mDuration;
427    SLuint32 mPosition;
428    SLuint32 mStartTick;
429    SLuint32 mNumTicks;
430} IMIDITime;
431
432typedef struct {
433    const struct SLMuteSoloItf_ *mItf;
434    IObject *mThis;
435    // fields that were formerly here are now at CAudioPlayer
436} IMuteSolo;
437
438#define MAX_TRACK 32        // see mActiveMask
439
440typedef struct {
441    const struct SLOutputMixItf_ *mItf;
442    IObject *mThis;
443    slMixDeviceChangeCallback mCallback;
444    void *mContext;
445} IOutputMix;
446
447#ifdef USE_OUTPUTMIXEXT
448typedef struct {
449    const struct SLOutputMixExtItf_ *mItf;
450    IObject *mThis;
451    unsigned mActiveMask;   // 1 bit per active track
452    Track mTracks[MAX_TRACK];
453    SLboolean mDestroyRequested;    ///< Mixer to acknowledge application's call to Object::Destroy
454} IOutputMixExt;
455#endif
456
457typedef struct {
458    const struct SLPitchItf_ *mItf;
459    IObject *mThis;
460    SLpermille mPitch;
461    // const
462    SLpermille mMinPitch;
463    SLpermille mMaxPitch;
464} IPitch;
465
466typedef struct Play_interface {
467    const struct SLPlayItf_ *mItf;
468    IObject *mThis;
469    SLuint32 mState;
470    // next 2 fields are read-only to application
471    SLmillisecond mDuration;
472    SLmillisecond mPosition;
473    slPlayCallback mCallback;
474    void *mContext;
475    SLuint32 mEventFlags;
476    // the ISeek trick of using a distinct value doesn't work here because it's readable by app
477    SLmillisecond mMarkerPosition;
478    SLmillisecond mPositionUpdatePeriod; // Zero means do not do position updates (FIXME ~0)
479#ifdef USE_OUTPUTMIXEXT
480    SLuint32 mFrameUpdatePeriod;         // mPositionUpdatePeriod in frame units
481    SLmillisecond mLastSeekPosition;     // Last known accurate position, set at Seek
482    SLuint32 mFramesSinceLastSeek;       // Frames mixed since last known accurate position
483    SLuint32 mFramesSincePositionUpdate; // Frames mixed since last position update callback
484#endif
485} IPlay;
486
487typedef struct {
488    const struct SLPlaybackRateItf_ *mItf;
489    IObject *mThis;
490    SLpermille mRate;
491    SLuint32 mProperties;
492    // const after initialization
493    SLpermille mMinRate;
494    SLpermille mMaxRate;
495    SLpermille mStepSize;
496    SLuint32 mCapabilities;
497} IPlaybackRate;
498
499typedef struct {
500    const struct SLPrefetchStatusItf_ *mItf;
501    IObject *mThis;
502    SLuint32 mStatus;
503    SLpermille mLevel;
504    slPrefetchCallback mCallback;
505    void *mContext;
506    SLuint32 mCallbackEventsMask;
507    SLpermille mFillUpdatePeriod;
508#ifdef ANDROID
509    /** FIXME used to call PrefetchStatus callback with object unlocked prior to return from API */
510    slPrefetchCallback mDeferredPrefetchCallback;
511    void *mDeferredPrefetchContext;
512    SLuint32 mDeferredPrefetchEvents;
513#endif
514} IPrefetchStatus;
515
516typedef struct {
517    const struct SLPresetReverbItf_ *mItf;
518    IObject *mThis;
519    SLuint16 mPreset;
520#if defined(ANDROID)
521    effect_descriptor_t mPresetReverbDescriptor;
522    android::sp<android::AudioEffect> mPresetReverbEffect;
523#endif
524} IPresetReverb;
525
526typedef struct {
527    const struct SLRatePitchItf_ *mItf;
528    IObject *mThis;
529    SLpermille mRate;
530    // const
531    SLpermille mMinRate;
532    SLpermille mMaxRate;
533} IRatePitch;
534
535typedef struct {
536    const struct SLRecordItf_ *mItf;
537    IObject *mThis;
538    SLuint32 mState;
539    SLmillisecond mDurationLimit;
540    SLmillisecond mPosition;
541    slRecordCallback mCallback;
542    void *mContext;
543    SLuint32 mCallbackEventsMask;
544    SLmillisecond mMarkerPosition;
545    SLmillisecond mPositionUpdatePeriod;
546} IRecord;
547
548typedef struct {
549    const struct SLSeekItf_ *mItf;
550    IObject *mThis;
551    SLmillisecond mPos;     // mPos != SL_TIME_UNKNOWN means pending seek request
552    SLboolean mLoopEnabled;
553    SLmillisecond mStartPos;
554    SLmillisecond mEndPos;
555} ISeek;
556
557typedef struct {
558    const struct SLThreadSyncItf_ *mItf;
559    IObject *mThis;
560    SLboolean mInCriticalSection;
561    SLuint32 mWaiting;  // number of threads waiting
562    pthread_t mOwner;
563} IThreadSync;
564
565typedef struct {
566    const struct SLVibraItf_ *mItf;
567    IObject *mThis;
568    SLboolean mVibrate;
569    SLmilliHertz mFrequency;
570    SLpermille mIntensity;
571} IVibra;
572
573typedef struct {
574    const struct SLVirtualizerItf_ *mItf;
575    IObject *mThis;
576    SLboolean mEnabled;
577    SLpermille mStrength;
578#if defined(ANDROID)
579    effect_descriptor_t mVirtualizerDescriptor;
580    android::sp<android::AudioEffect> mVirtualizerEffect;
581#endif
582} IVirtualizer;
583
584typedef struct {
585    const struct SLVisualizationItf_ *mItf;
586    IObject *mThis;
587    slVisualizationCallback mCallback;
588    void *mContext;
589    SLmilliHertz mRate;
590} IVisualization;
591
592typedef struct /*Volume_interface*/ {
593    const struct SLVolumeItf_ *mItf;
594    IObject *mThis;
595    // Values as specified by the application
596    SLmillibel mLevel;
597    SLpermille mStereoPosition;
598    SLuint8 /*SLboolean*/ mMute;
599    SLuint8 /*SLboolean*/ mEnableStereoPosition;
600} IVolume;
601
602typedef struct {
603    const struct XAEngineItf_ *mItf;
604    IObject *mThis;
605} IXAEngine;
606
607#define NB_SUPPORTED_STREAMS 1 // only one (video) stream supported in this implementation
608typedef struct {
609    const struct XAStreamInformationItf_ *mItf;
610    IObject *mThis;
611    xaStreamEventChangeCallback mCallback;
612    void *mContext;
613    XAboolean mActiveStreams[NB_SUPPORTED_STREAMS];
614#ifdef ANDROID
615    android::Vector<StreamInfo> mStreamInfoTable;
616#endif
617} IStreamInformation;
618
619typedef struct {
620    const struct XAVideoDecoderCapabilitiesItf_ *mItf;
621    IObject *mThis;
622} IVideoDecoderCapabilities;
623
624/* Class structures */
625
626/*typedef*/ struct C3DGroup_struct {
627    IObject mObject;
628#define INTERFACES_3DGroup 6 // see MPH_to_3DGroup in MPH_to.c for list of interfaces
629    SLuint8 mInterfaceStates2[INTERFACES_3DGroup - INTERFACES_Default];
630    IDynamicInterfaceManagement mDynamicInterfaceManagement;
631    I3DLocation m3DLocation;
632    I3DDoppler m3DDoppler;
633    I3DSource m3DSource;
634    I3DMacroscopic m3DMacroscopic;
635    // remaining are per-instance private fields not associated with an interface
636    unsigned mMemberMask;   // set of member objects
637} /*C3DGroup*/;
638
639#ifdef ANDROID
640
641// FIXME Move these into the I... section above
642
643typedef struct {
644    const struct SLAndroidEffectItf_ *mItf;
645    IObject *mThis;
646    android::KeyedVector<SLuint32, android::sp<android::AudioEffect> > *mEffects;
647} IAndroidEffect;
648
649typedef struct {
650    const struct SLAndroidEffectCapabilitiesItf_ *mItf;
651    IObject *mThis;
652    SLuint32 mNumFx;
653    effect_descriptor_t* mFxDescriptors;
654} IAndroidEffectCapabilities;
655
656typedef struct {
657    const struct SLAndroidEffectSendItf_ *mItf;
658    IObject *mThis;
659    // only one send per interface for now (1 bus)
660    SLboolean mEnabled;
661    SLmillibel mSendLevel; //android::KeyedVector<SLuint32, SLmillibel> mSendLevels;
662} IAndroidEffectSend;
663
664typedef struct {
665    const struct SLAndroidConfigurationItf_ *mItf;
666    IObject *mThis;
667    // only 1 each. When we support other Proxy types, we will need to get more clever about this.
668    jobject mRoutingProxy;
669} IAndroidConfiguration;
670
671typedef struct {
672    const struct SLAndroidBufferQueueItf_ *mItf;
673    IObject *mThis;
674    SLAndroidBufferQueueState mState;
675    slAndroidBufferQueueCallback mCallback;
676    SLuint32 mCallbackEventsMask;
677    void *mContext;
678    SLuint16 mNumBuffers;
679    AndroidBufferType_type mBufferType;
680    AdvancedBufferHeader *mBufferArray;
681    AdvancedBufferHeader *mFront, *mRear;
682    bool mEOS;  // whether EOS has been enqueued; never reset
683} IAndroidBufferQueue;
684
685typedef struct {
686    const struct SLAndroidAcousticEchoCancellationItf_ *mItf;
687    IObject *mThis;
688    SLboolean mEnabled;
689    effect_descriptor_t mAECDescriptor;
690    android::sp<android::AudioEffect> mAECEffect;
691} IAndroidAcousticEchoCancellation;
692
693typedef struct {
694    const struct SLAndroidAutomaticGainControlItf_ *mItf;
695    IObject *mThis;
696    SLboolean mEnabled;
697     effect_descriptor_t mAGCDescriptor;
698     android::sp<android::AudioEffect> mAGCEffect;
699} IAndroidAutomaticGainControl;
700
701typedef struct {
702    const struct SLAndroidNoiseSuppressionItf_ *mItf;
703    IObject *mThis;
704    SLboolean mEnabled;
705    effect_descriptor_t mNSDescriptor;
706    android::sp<android::AudioEffect> mNSEffect;
707} IAndroidNoiseSuppression;
708
709#endif
710