Commit d2a7f0d6 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Add note about bug in IMuteSolo channel count.

Change-Id: Iccb78019bbbffaa98eaa8877258d88a77c979e48

Remove spurious NDEBUG, init in same order as .h.

Change-Id: Ia30b30ce4dbc8f074632c275583b7ef6069141dc

Implement asynchronous Object.Realize

Added ThreadPool mechanism for asynchronous operations.
Fixed off-by-one bug in BufferQueue that didn't use the last buffer.
Added engine hooks for Realize and Destroy.
Realize hook and callback are now called with mutex unlocked.
Added new Object states realizing 1 and realizing 2, mapped to unrealized.
Asynchronous realize on an engine is forced to be synchronous.
Engine initialization now done at Realize, not during CreateEngine.

Change-Id: I9c11461dbeab97aec04f8266f268cfd16086b5a7

Port to Android.

Change-Id: I0fff9f32e4d374230ab940e00fe6b8429b143ed3

Shutdown the sync thread when engine is destroyed.

Change-Id: I197267e5eaa4a49cacb34bc6e6f9c6fa92b381b5

Mutex unlocked during the initialization phase of DynamicInterfaceManagement.AddInterface.

Change-Id: I16000a2c4f1f9e93075f08ac2eaad6a8f12ba9da

Dynamic interface removal is done with mutex unlocked.

Change-Id: I5317d859dee680ca1c96e803388f2475f7795099

Normalize SLboolean input parameters.

Store non-zero boolean value as SL_BOOLEAN_TRUE rather than original value.
Line length 100.

Change-Id: I867ae8dd328b1427be98dfd148e32fcba38ce409

More input parameter checks.

Line length 100.
Fix a few build warnings.

Change-Id: I78fb1415fed649e05a370cf60e015a7fe13ffe8c

Address code review comments.

Change-Id: Ic7f2c70ded42f3d0e5e92f173cf80e084e54fc89
parent 85da61df
......@@ -20,7 +20,10 @@ LOCAL_SRC_FILES:= \
locks.c \
sles.c \
sles_to_android.cpp \
sync.c \
ThreadPool.c \
CAudioPlayer.c \
CEngine.c \
I3DCommit.c \
I3DDoppler.c \
I3DGrouping.c \
......
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Engine class */
#include "sles_allinclusive.h"
// IObject hooks
SLresult CEngine_Realize(void *self, SLboolean async)
{
CEngine *this = (CEngine *) self;
SLresult result;
result = err_to_result(pthread_create(&this->mSyncThread, (const pthread_attr_t *) NULL, sync_start, this));
if (SL_RESULT_SUCCESS != result)
return result;
// FIXME Use platform thread pool if available (e.g. on Android)
// FIXME Use platform-specific engine configuration options here.
result = ThreadPool_init(&this->mEngine.mThreadPool, 0, 0);
if (SL_RESULT_SUCCESS != result) {
// FIXME Wrong
this->mEngine.mShutdown = SL_BOOLEAN_TRUE;
(void) pthread_join(this->mSyncThread, (void **) NULL);
return result;
}
#ifdef USE_SDL
SDL_start(&this->mEngine);
#endif
return SL_RESULT_SUCCESS;
}
void CEngine_Destroy(void *self)
{
CEngine *this = (CEngine *) self;
// FIXME Cancel pending operations
// FIXME Verify no extant objects
// FIXME This is the wrong way to kill the sync thread
this->mEngine.mShutdown = SL_BOOLEAN_TRUE;
(void) pthread_join(this->mSyncThread, (void **) NULL);
ThreadPool_deinit(&this->mEngine.mThreadPool);
}
......@@ -38,7 +38,7 @@ static SLresult I3DCommit_SetDeferred(SL3DCommitItf self, SLboolean deferred)
I3DCommit *this = (I3DCommit *) self;
IObject *thisObject = this->mThis;
object_lock_exclusive(thisObject);
this->mDeferred = deferred;
this->mDeferred = SL_BOOLEAN_FALSE != deferred; // normalize
object_unlock_exclusive(thisObject);
return SL_RESULT_SUCCESS;
}
......@@ -52,8 +52,6 @@ void I3DCommit_init(void *self)
{
I3DCommit *this = (I3DCommit *) self;
this->mItf = &I3DCommit_Itf;
#ifndef NDEBUG
this->mDeferred = SL_BOOLEAN_FALSE;
this->mGeneration = 0;
#endif
}
......@@ -18,8 +18,7 @@
#include "sles_allinclusive.h"
static SLresult I3DDoppler_SetVelocityCartesian(SL3DDopplerItf self,
const SLVec3D *pVelocity)
static SLresult I3DDoppler_SetVelocityCartesian(SL3DDopplerItf self, const SLVec3D *pVelocity)
{
if (NULL == pVelocity)
return SL_RESULT_PARAMETER_INVALID;
......@@ -45,8 +44,7 @@ static SLresult I3DDoppler_SetVelocitySpherical(SL3DDopplerItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DDoppler_GetVelocityCartesian(SL3DDopplerItf self,
SLVec3D *pVelocity)
static SLresult I3DDoppler_GetVelocityCartesian(SL3DDopplerItf self, SLVec3D *pVelocity)
{
if (NULL == pVelocity)
return SL_RESULT_PARAMETER_INVALID;
......@@ -84,8 +82,7 @@ static SLresult I3DDoppler_GetVelocityCartesian(SL3DDopplerItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DDoppler_SetDopplerFactor(SL3DDopplerItf self,
SLpermille dopplerFactor)
static SLresult I3DDoppler_SetDopplerFactor(SL3DDopplerItf self, SLpermille dopplerFactor)
{
I3DDoppler *this = (I3DDoppler *) self;
interface_lock_poke(this);
......@@ -94,8 +91,7 @@ static SLresult I3DDoppler_SetDopplerFactor(SL3DDopplerItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DDoppler_GetDopplerFactor(SL3DDopplerItf self,
SLpermille *pDopplerFactor)
static SLresult I3DDoppler_GetDopplerFactor(SL3DDopplerItf self, SLpermille *pDopplerFactor)
{
if (NULL == pDopplerFactor)
return SL_RESULT_PARAMETER_INVALID;
......@@ -119,12 +115,10 @@ void I3DDoppler_init(void *self)
{
I3DDoppler *this = (I3DDoppler *) self;
this->mItf = &I3DDoppler_Itf;
#ifndef NDEBUG
this->mVelocityCartesian.x = 0;
this->mVelocityCartesian.y = 0;
this->mVelocityCartesian.z = 0;
memset(&this->mVelocitySpherical, 0x55, sizeof(this->mVelocitySpherical));
#endif
this->mVelocityActive = CARTESIAN_SET_SPHERICAL_UNKNOWN;
this->mDopplerFactor = 1000;
}
......@@ -36,8 +36,7 @@ static SLresult I3DGrouping_Set3DGroup(SL3DGroupingItf self, SLObjectItf group)
return SL_RESULT_SUCCESS;
}
static SLresult I3DGrouping_Get3DGroup(SL3DGroupingItf self,
SLObjectItf *pGroup)
static SLresult I3DGrouping_Get3DGroup(SL3DGroupingItf self, SLObjectItf *pGroup)
{
if (NULL == pGroup)
return SL_RESULT_PARAMETER_INVALID;
......@@ -57,8 +56,6 @@ void I3DGrouping_init(void *self)
{
I3DGrouping *this = (I3DGrouping *) self;
this->mItf = &I3DGrouping_Itf;
#ifndef NDEBUG
this->mGroup = NULL;
#endif
// FIXME initialize the set here
}
......@@ -18,8 +18,7 @@
#include "sles_allinclusive.h"
static SLresult I3DLocation_SetLocationCartesian(SL3DLocationItf self,
const SLVec3D *pLocation)
static SLresult I3DLocation_SetLocationCartesian(SL3DLocationItf self, const SLVec3D *pLocation)
{
if (NULL == pLocation)
return SL_RESULT_PARAMETER_INVALID;
......@@ -35,6 +34,10 @@ static SLresult I3DLocation_SetLocationCartesian(SL3DLocationItf self,
static SLresult I3DLocation_SetLocationSpherical(SL3DLocationItf self,
SLmillidegree azimuth, SLmillidegree elevation, SLmillimeter distance)
{
if (!((-360000 <= azimuth) && (azimuth <= 360000) &&
(-90000 <= elevation) && (elevation <= 90000) &&
(0 <= distance) && (distance <= SL_MILLIMETER_MAX)))
return SL_RESULT_PARAMETER_INVALID;
I3DLocation *this = (I3DLocation *) self;
interface_lock_exclusive(this);
this->mLocationSpherical.mAzimuth = azimuth;
......@@ -81,8 +84,7 @@ static SLresult I3DLocation_Move(SL3DLocationItf self, const SLVec3D *pMovement)
return SL_RESULT_SUCCESS;
}
static SLresult I3DLocation_GetLocationCartesian(SL3DLocationItf self,
SLVec3D *pLocation)
static SLresult I3DLocation_GetLocationCartesian(SL3DLocationItf self, SLVec3D *pLocation)
{
if (NULL == pLocation)
return SL_RESULT_PARAMETER_INVALID;
......@@ -127,6 +129,7 @@ static SLresult I3DLocation_SetOrientationVectors(SL3DLocationItf self,
return SL_RESULT_PARAMETER_INVALID;
SLVec3D front = *pFront;
SLVec3D above = *pAbove;
// FIXME Check for vectors close to zero or close to parallel
I3DLocation *this = (I3DLocation *) self;
interface_lock_exclusive(this);
this->mOrientationVectors.mFront = front;
......@@ -140,6 +143,10 @@ static SLresult I3DLocation_SetOrientationVectors(SL3DLocationItf self,
static SLresult I3DLocation_SetOrientationAngles(SL3DLocationItf self,
SLmillidegree heading, SLmillidegree pitch, SLmillidegree roll)
{
if (!((-360000 <= heading) && (heading <= 360000) &&
(-90000 <= pitch) && (pitch <= 90000) &&
(-360000 <= roll) && (roll <= 360000)))
return SL_RESULT_PARAMETER_INVALID;
I3DLocation *this = (I3DLocation *) self;
interface_lock_exclusive(this);
this->mOrientationAngles.mHeading = heading;
......@@ -151,12 +158,15 @@ static SLresult I3DLocation_SetOrientationAngles(SL3DLocationItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DLocation_Rotate(SL3DLocationItf self, SLmillidegree theta,
const SLVec3D *pAxis)
static SLresult I3DLocation_Rotate(SL3DLocationItf self, SLmillidegree theta, const SLVec3D *pAxis)
{
// FIXME spec does not specify a range on theta
if (!((-360000 <= theta) && (theta <= 360000)))
return SL_RESULT_PARAMETER_INVALID;
if (NULL == pAxis)
return SL_RESULT_PARAMETER_INVALID;
SLVec3D axis = *pAxis;
// FIXME Check that axis is not (close to) zero vector, length does not matter
I3DLocation *this = (I3DLocation *) self;
interface_lock_exclusive(this);
while (this->mRotatePending)
......@@ -174,6 +184,7 @@ static SLresult I3DLocation_GetOrientationVectors(SL3DLocationItf self,
if (NULL == pFront || NULL == pUp)
return SL_RESULT_PARAMETER_INVALID;
I3DLocation *this = (I3DLocation *) self;
// FIXME Should wait for a pending rotate to complete, or orientation angles to be converted
interface_lock_shared(this);
SLVec3D front = this->mOrientationVectors.mFront;
SLVec3D up = this->mOrientationVectors.mUp;
......@@ -198,29 +209,19 @@ void I3DLocation_init(void *self)
{
I3DLocation *this = (I3DLocation *) self;
this->mItf = &I3DLocation_Itf;
#ifndef NDEBUG
this->mLocationCartesian.x = 0;
this->mLocationCartesian.y = 0;
this->mLocationCartesian.z = 0;
memset(&this->mLocationSpherical, 0x55, sizeof(this->mLocationSpherical));
this->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN;
this->mOrientationAngles.mHeading = 0;
this->mOrientationAngles.mPitch = 0;
this->mOrientationAngles.mRoll = 0;
this->mOrientationVectors.mFront.x = 0;
this->mOrientationVectors.mFront.y = 0;
this->mOrientationVectors.mAbove.x = 0;
this->mOrientationVectors.mAbove.y = 0;
this->mOrientationVectors.mUp.x = 0;
this->mOrientationVectors.mUp.z = 0;
memset(&this->mOrientationVectors, 0x55, sizeof(this->mOrientationVectors));
this->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN;
this->mTheta = 0x55555555;
this->mAxis.x = 0x55555555;
this->mAxis.y = 0x55555555;
this->mAxis.z = 0x55555555;
this->mRotatePending = SL_BOOLEAN_FALSE;
#endif
this->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN;
this->mOrientationVectors.mFront.z = -1000;
this->mOrientationVectors.mUp.y = 1000;
this->mOrientationVectors.mAbove.z = -1000;
this->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN;
}
......@@ -21,6 +21,10 @@
static SLresult I3DMacroscopic_SetSize(SL3DMacroscopicItf self,
SLmillimeter width, SLmillimeter height, SLmillimeter depth)
{
if (!((0 <= width) && (width <= SL_MILLIMETER_MAX) &&
(0 <= height) && (height <= SL_MILLIMETER_MAX) &&
(0 <= depth) && (depth <= SL_MILLIMETER_MAX)))
return SL_RESULT_PARAMETER_INVALID;
I3DMacroscopic *this = (I3DMacroscopic *) self;
interface_lock_exclusive(this);
this->mSize.mWidth = width;
......@@ -50,6 +54,10 @@ static SLresult I3DMacroscopic_GetSize(SL3DMacroscopicItf self,
static SLresult I3DMacroscopic_SetOrientationAngles(SL3DMacroscopicItf self,
SLmillidegree heading, SLmillidegree pitch, SLmillidegree roll)
{
if (!((-360000 <= heading) && (heading <= 360000) &&
(-90000 <= pitch) && (pitch <= 90000) &&
(-360000 <= roll) && (roll <= 360000)))
return SL_RESULT_PARAMETER_INVALID;
I3DMacroscopic *this = (I3DMacroscopic *) self;
interface_lock_exclusive(this);
this->mOrientationAngles.mHeading = heading;
......@@ -70,6 +78,7 @@ static SLresult I3DMacroscopic_SetOrientationVectors(SL3DMacroscopicItf self,
I3DMacroscopic *this = (I3DMacroscopic *) self;
SLVec3D front = *pFront;
SLVec3D above = *pAbove;
// FIXME Check for vectors close to zero or close to parallel
interface_lock_exclusive(this);
this->mOrientationVectors.mFront = front;
this->mOrientationVectors.mUp = above;
......@@ -82,9 +91,13 @@ static SLresult I3DMacroscopic_SetOrientationVectors(SL3DMacroscopicItf self,
static SLresult I3DMacroscopic_Rotate(SL3DMacroscopicItf self,
SLmillidegree theta, const SLVec3D *pAxis)
{
// FIXME spec does not specify a range on theta
if (!((-360000 <= theta) && (theta <= 360000)))
return SL_RESULT_PARAMETER_INVALID;
if (NULL == pAxis)
return SL_RESULT_PARAMETER_INVALID;
SLVec3D axis = *pAxis;
// FIXME Check that axis is not (close to) zero vector, length does not matter
I3DMacroscopic *this = (I3DMacroscopic *) self;
// FIXME Do the rotate here:
// interface_lock_shared(this);
......@@ -162,25 +175,17 @@ void I3DMacroscopic_init(void *self)
{
I3DMacroscopic *this = (I3DMacroscopic *) self;
this->mItf = &I3DMacroscopic_Itf;
#ifndef NDEBUG
this->mSize.mWidth = 0;
this->mSize.mHeight = 0;
this->mSize.mDepth = 0;
this->mOrientationAngles.mHeading = 0;
this->mOrientationAngles.mPitch = 0;
this->mOrientationAngles.mRoll = 0;
this->mOrientationVectors.mFront.x = 0;
this->mOrientationVectors.mFront.y = 0;
this->mOrientationVectors.mUp.x = 0;
this->mOrientationVectors.mUp.z = 0;
// this->mGeneration = 0;
memset(&this->mOrientationVectors, 0x55, sizeof(this->mOrientationVectors));
this->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN;
this->mTheta = 0x55555555;
this->mAxis.x = 0x55555555;
this->mAxis.y = 0x55555555;
this->mAxis.z = 0x55555555;
this->mRotatePending = SL_BOOLEAN_FALSE;
#endif
this->mOrientationVectors.mFront.z = -1000;
this->mOrientationVectors.mUp.y = 1000;
this->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN;
}
......@@ -18,18 +18,16 @@
#include "sles_allinclusive.h"
static SLresult I3DSource_SetHeadRelative(SL3DSourceItf self,
SLboolean headRelative)
static SLresult I3DSource_SetHeadRelative(SL3DSourceItf self, SLboolean headRelative)
{
I3DSource *this = (I3DSource *) self;
interface_lock_poke(this);
this->mHeadRelative = headRelative;
this->mHeadRelative = SL_BOOLEAN_FALSE != headRelative; // normalize
interface_unlock_poke(this);
return SL_RESULT_SUCCESS;
}
static SLresult I3DSource_GetHeadRelative(SL3DSourceItf self,
SLboolean *pHeadRelative)
static SLresult I3DSource_GetHeadRelative(SL3DSourceItf self, SLboolean *pHeadRelative)
{
if (NULL == pHeadRelative)
return SL_RESULT_PARAMETER_INVALID;
......@@ -44,6 +42,9 @@ static SLresult I3DSource_GetHeadRelative(SL3DSourceItf self,
static SLresult I3DSource_SetRolloffDistances(SL3DSourceItf self,
SLmillimeter minDistance, SLmillimeter maxDistance)
{
if (!((0 < minDistance) && (minDistance <= SL_MILLIMETER_MAX) &&
(minDistance <= maxDistance) && (maxDistance <= SL_MILLIMETER_MAX)))
return SL_RESULT_PARAMETER_INVALID;
I3DSource *this = (I3DSource *) self;
interface_lock_exclusive(this);
this->mMinDistance = minDistance;
......@@ -67,18 +68,16 @@ static SLresult I3DSource_GetRolloffDistances(SL3DSourceItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DSource_SetRolloffMaxDistanceMute(SL3DSourceItf self,
SLboolean mute)
static SLresult I3DSource_SetRolloffMaxDistanceMute(SL3DSourceItf self, SLboolean mute)
{
I3DSource *this = (I3DSource *) self;
interface_lock_poke(this);
this->mRolloffMaxDistanceMute = mute;
this->mRolloffMaxDistanceMute = SL_BOOLEAN_FALSE != mute; // normalize
interface_unlock_poke(this);
return SL_RESULT_SUCCESS;
}
static SLresult I3DSource_GetRolloffMaxDistanceMute(SL3DSourceItf self,
SLboolean *pMute)
static SLresult I3DSource_GetRolloffMaxDistanceMute(SL3DSourceItf self, SLboolean *pMute)
{
if (NULL == pMute)
return SL_RESULT_PARAMETER_INVALID;
......@@ -90,9 +89,10 @@ static SLresult I3DSource_GetRolloffMaxDistanceMute(SL3DSourceItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DSource_SetRolloffFactor(SL3DSourceItf self,
SLpermille rolloffFactor)
static SLresult I3DSource_SetRolloffFactor(SL3DSourceItf self, SLpermille rolloffFactor)
{
if (!((0 <= rolloffFactor) && (rolloffFactor <= 10000)))
return SL_RESULT_PARAMETER_INVALID;
I3DSource *this = (I3DSource *) self;
interface_lock_poke(this);
this->mRolloffFactor = rolloffFactor;
......@@ -100,8 +100,7 @@ static SLresult I3DSource_SetRolloffFactor(SL3DSourceItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DSource_GetRolloffFactor(SL3DSourceItf self,
SLpermille *pRolloffFactor)
static SLresult I3DSource_GetRolloffFactor(SL3DSourceItf self, SLpermille *pRolloffFactor)
{
I3DSource *this = (I3DSource *) self;
interface_lock_peek(this);
......@@ -111,9 +110,10 @@ static SLresult I3DSource_GetRolloffFactor(SL3DSourceItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DSource_SetRoomRolloffFactor(SL3DSourceItf self,
SLpermille roomRolloffFactor)
static SLresult I3DSource_SetRoomRolloffFactor(SL3DSourceItf self, SLpermille roomRolloffFactor)
{
if (!((0 <= roomRolloffFactor) && (roomRolloffFactor <= 10000)))
return SL_RESULT_PARAMETER_INVALID;
I3DSource *this = (I3DSource *) self;
interface_lock_poke(this);
this->mRoomRolloffFactor = roomRolloffFactor;
......@@ -121,8 +121,7 @@ static SLresult I3DSource_SetRoomRolloffFactor(SL3DSourceItf self,
return SL_RESULT_SUCCESS;
}
static SLresult I3DSource_GetRoomRolloffFactor(SL3DSourceItf self,
SLpermille *pRoomRolloffFactor)
static SLresult I3DSource_GetRoomRolloffFactor(SL3DSourceItf self, SLpermille *pRoomRolloffFactor)
{
I3DSource *this = (I3DSource *) self;
interface_lock_peek(this);
......@@ -134,6 +133,13 @@ static SLresult I3DSource_GetRoomRolloffFactor(SL3DSourceItf self,
static SLresult I3DSource_SetRolloffModel(SL3DSourceItf self, SLuint8 model)
{
switch (model) {
case SL_ROLLOFFMODEL_LINEAR:
case SL_ROLLOFFMODEL_EXPONENTIAL:
break;
default:
return SL_RESULT_PARAMETER_INVALID;
}
I3DSource *this = (I3DSource *) self;
interface_lock_poke(this);
this->mDistanceModel = model;
......@@ -154,6 +160,11 @@ static SLresult I3DSource_GetRolloffModel(SL3DSourceItf self, SLuint8 *pModel)
static SLresult I3DSource_SetCone(SL3DSourceItf self, SLmillidegree innerAngle,
SLmillidegree outerAngle, SLmillibel outerLevel)
{
// FIXME spec does not say anything about relationship between innerAngle and outerAngle
if (!((0 <= innerAngle) && (innerAngle <= 360000) &&
(0 <= outerAngle) && (outerAngle <= 360000) &&
(SL_MILLIBEL_MIN <= outerLevel) && (outerLevel <= 0)))
return SL_RESULT_PARAMETER_INVALID;
I3DSource *this = (I3DSource *) self;
interface_lock_exclusive(this);
this->mConeInnerAngle = innerAngle;
......@@ -163,9 +174,8 @@ static SLresult I3DSource_SetCone(SL3DSourceItf self, SLmillidegree innerAngle,
return SL_RESULT_SUCCESS;
}
static SLresult I3DSource_GetCone(SL3DSourceItf self,
SLmillidegree *pInnerAngle, SLmillidegree *pOuterAngle,
SLmillibel *pOuterLevel)
static SLresult I3DSource_GetCone(SL3DSourceItf self, SLmillidegree *pInnerAngle,
SLmillidegree *pOuterAngle, SLmillibel *pOuterLevel)
{
if (NULL == pInnerAngle || NULL == pOuterAngle || NULL == pOuterLevel)
return SL_RESULT_PARAMETER_INVALID;
......@@ -202,16 +212,14 @@ void I3DSource_init(void *self)
{
I3DSource *this = (I3DSource *) self;
this->mItf = &I3DSource_Itf;
#ifndef NDEBUG
this->mHeadRelative = SL_BOOLEAN_FALSE;
this->mRolloffMaxDistanceMute = SL_BOOLEAN_FALSE;
this->mConeOuterLevel = 0;
this->mRoomRolloffFactor = 0;
#endif
this->mMaxDistance = SL_MILLIMETER_MAX;
this->mMinDistance = 1000;
this->mConeInnerAngle = 360000;
this->mConeOuterAngle = 360000;
this->mConeOuterLevel = 0;
this->mRolloffFactor = 1000;
this->mRoomRolloffFactor = 0;
this->mDistanceModel = SL_ROLLOFFMODEL_EXPONENTIAL;
}
......@@ -18,9 +18,8 @@
#include "sles_allinclusive.h"
static SLresult IAudioDecoderCapabilities_GetAudioDecoders(
SLAudioDecoderCapabilitiesItf self, SLuint32 *pNumDecoders,
SLuint32 *pDecoderIds)
static SLresult IAudioDecoderCapabilities_GetAudioDecoders( SLAudioDecoderCapabilitiesItf self,
SLuint32 *pNumDecoders, SLuint32 *pDecoderIds)
{
if (NULL == pNumDecoders)
return SL_RESULT_PARAMETER_INVALID;
......
......@@ -23,9 +23,9 @@ static SLresult IAudioEncoder_SetEncoderSettings(SLAudioEncoderItf self,
{
if (NULL == pSettings)
return SL_RESULT_PARAMETER_INVALID;
IAudioEncoder *this =
(IAudioEncoder *) self;
IAudioEncoder *this = (IAudioEncoder *) self;
SLAudioEncoderSettings settings = *pSettings;
// FIXME Validate the settings
interface_lock_exclusive(this);
this->mSettings = settings;
interface_unlock_exclusive(this);
......@@ -37,8 +37,7 @@ static SLresult IAudioEncoder_GetEncoderSettings(SLAudioEncoderItf self,
{
if (NULL == pSettings)
return SL_RESULT_PARAMETER_INVALID;
IAudioEncoder *this =
(IAudioEncoder *) self;
IAudioEncoder *this = (IAudioEncoder *) self;
interface_lock_shared(this);
SLAudioEncoderSettings settings = this->mSettings;
interface_unlock_shared(this);
......@@ -55,7 +54,5 @@ void IAudioEncoder_init(void *self)
{
IAudioEncoder *this = (IAudioEncoder *) self;
this->mItf = &IAudioEncoder_Itf;
#ifndef NDEBUG
memset(&this->mSettings, 0, sizeof(SLAudioEncoderSettings));
#endif
}
......@@ -18,9 +18,8 @@
#include "sles_allinclusive.h"
static SLresult IAudioEncoderCapabilities_GetAudioEncoders(
SLAudioEncoderCapabilitiesItf self, SLuint32 *pNumEncoders,
SLuint32 *pEncoderIds)
static SLresult IAudioEncoderCapabilities_GetAudioEncoders(SLAudioEncoderCapabilitiesItf self,
SLuint32 *pNumEncoders, SLuint32 *pEncoderIds)
{
if (NULL == pNumEncoders)
return SL_RESULT_PARAMETER_INVALID;
......
......@@ -19,8 +19,7 @@
/* AudioIODeviceCapabilities implementation */
static SLresult IAudioIODeviceCapabilities_GetAvailableAudioInputs(
SLAudioIODeviceCapabilitiesItf self, SLint32 *pNumInputs,
SLuint32 *pInputDeviceIDs)
SLAudioIODeviceCapabilitiesItf self, SLint32 *pNumInputs, SLuint32 *pInputDeviceIDs)
{
if (NULL == pNumInputs)
return SL_RESULT_PARAMETER_INVALID;
......@@ -35,8 +34,7 @@ static SLresult IAudioIODeviceCapabilities_GetAvailableAudioInputs(
}
static SLresult IAudioIODeviceCapabilities_QueryAudioInputCapabilities(
SLAudioIODeviceCapabilitiesItf self, SLuint32 deviceID,
SLAudioInputDescriptor *pDescriptor)
SLAudioIODeviceCapabilitiesItf self, SLuint32 deviceID, SLAudioInputDescriptor *pDescriptor)
{
if (NULL == pDescriptor)
return SL_RESULT_PARAMETER_INVALID;
......@@ -51,13 +49,11 @@ static SLresult IAudioIODeviceCapabilities_QueryAudioInputCapabilities(
return SL_RESULT_SUCCESS;
}
static SLresult
IAudioIODeviceCapabilities_RegisterAvailableAudioInputsChangedCallback(
SLAudioIODeviceCapabilitiesItf self,
slAvailableAudioInputsChangedCallback callback, void *pContext)
static SLresult IAudioIODeviceCapabilities_RegisterAvailableAudioInputsChangedCallback(
SLAudioIODeviceCapabilitiesItf self, slAvailableAudioInputsChangedCallback callback,
void *pContext)
{
IAudioIODeviceCapabilities * this =
(IAudioIODeviceCapabilities *) self;
IAudioIODeviceCapabilities * this = (IAudioIODeviceCapabilities *) self;
interface_lock_exclusive(this);
this->mAvailableAudioInputsChangedCallback = callback;
this->mAvailableAudioInputsChangedContext = pContext;
......@@ -66,8 +62,7 @@ static SLresult
}
static SLresult IAudioIODeviceCapabilities_GetAvailableAudioOutputs(
SLAudioIODeviceCapabilitiesItf self, SLint32 *pNumOutputs,
SLuint32 *pOutputDeviceIDs)
SLAudioIODeviceCapabilitiesItf self, SLint32 *pNumOutputs, SLuint32 *pOutputDeviceIDs)
{
if (NULL == pNumOutputs)
return SL_RESULT_PARAMETER_INVALID;
......@@ -77,14 +72,14 @@ static SLresult IAudioIODeviceCapabilities_GetAvailableAudioOutputs(
return SL_RESULT_BUFFER_INSUFFICIENT;
pOutputDeviceIDs[0] = DEVICE_ID_HEADSET;
pOutputDeviceIDs[1] = DEVICE_ID_HANDSFREE;
// FIXME SL_DEFAULTDEVICEID_AUDIOOUTPUT?
}
*pNumOutputs = 2;
return SL_RESULT_SUCCESS;
}
static SLresult IAudioIODeviceCapabilities_QueryAudioOutputCapabilities(
SLAudioIODeviceCapabilitiesItf self, SLuint32 deviceID,
SLAudioOutputDescriptor *pDescriptor)
SLAudioIODeviceCapabilitiesItf self, SLuint32 deviceID, SLAudioOutputDescriptor *pDescriptor)
{
if (NULL == pDescriptor)
return SL_RESULT_PARAMETER_INVALID;
......@@ -96,19 +91,18 @@ static SLresult IAudioIODeviceCapabilities_QueryAudioOutputCapabilities(
case DEVICE_ID_HANDSFREE:
*pDescriptor = *AudioOutput_id_descriptors[2].descriptor;
break;
// FIXME SL_DEFAULTDEVICEID_AUDIOOUTPUT?
default:
return SL_RESULT_IO_ERROR;
}
return SL_RESULT_SUCCESS;
}
static SLresult
IAudioIODeviceCapabilities_RegisterAvailableAudioOutputsChangedCallback(
SLAudioIODeviceCapabilitiesItf self,
slAvailableAudioOutputsChangedCallback callback, void *pContext)
static SLresult IAudioIODeviceCapabilities_RegisterAvailableAudioOutputsChangedCallback(
SLAudioIODeviceCapabilitiesItf self, slAvailableAudioOutputsChangedCallback callback,
void *pContext)
{
IAudioIODeviceCapabilities * this =
(IAudioIODeviceCapabilities *) self;
IAudioIODeviceCapabilities * this = (IAudioIODeviceCapabilities *) self;
interface_lock_exclusive(this);
this->mAvailableAudioOutputsChangedCallback = callback;
this->mAvailableAudioOutputsChangedContext = pContext;
......@@ -116,13 +110,11 @@ static SLresult
return SL_RESULT_SUCCESS;
}
static SLresult
IAudioIODeviceCapabilities_RegisterDefaultDeviceIDMapChangedCallback(
SLAudioIODeviceCapabilitiesItf self,
slDefaultDeviceIDMapChangedCallback callback, void *pContext)
static SLresult IAudioIODeviceCapabilities_RegisterDefaultDeviceIDMapChangedCallback(
SLAudioIODeviceCapabilitiesItf self, slDefaultDeviceIDMapChangedCallback callback,
void *pContext)
{
IAudioIODeviceCapabilities * this =
(IAudioIODeviceCapabilities *) self;
IAudioIODeviceCapabilities * this = (IAudioIODeviceCapabilities *) self;
interface_lock_exclusive(this);
this->mDefaultDeviceIDMapChangedCallback = callback;
this->mDefaultDeviceIDMapChangedContext = pContext;
......@@ -136,6 +128,7 @@ static SLresult IAudioIODeviceCapabilities_GetAssociatedAudioInputs(
{
if (NULL == pNumAudioInputs)
return SL_RESULT_PARAMETER_INVALID;
// FIXME Incomplete
*pNumAudioInputs = 0;
return SL_RESULT_SUCCESS;
}
......@@ -146,6 +139,7 @@ static SLresult IAudioIODeviceCapabilities_GetAssociatedAudioOutputs(
{
if (NULL == pNumAudioOutputs)
return SL_RESULT_PARAMETER_INVALID;
// FIXME Incomplete
*pNumAudioOutputs = 0;
return SL_RESULT_SUCCESS;
}
......@@ -175,9 +169,8 @@ static SLresult IAudioIODeviceCapabilities_GetDefaultAudioDevices(
}
static SLresult IAudioIODeviceCapabilities_QuerySampleFormatsSupported(
SLAudioIODeviceCapabilitiesItf self, SLuint32 deviceID,
SLmilliHertz samplingRate, SLint32 *pSampleFormats,
SLint32 *pNumOfSampleFormats)
SLAudioIODeviceCapabilitiesItf self, SLuint32 deviceID, SLmilliHertz samplingRate,
SLint32 *pSampleFormats, SLint32 *pNumOfSampleFormats)
{
if (NULL == pNumOfSampleFormats)
return SL_RESULT_PARAMETER_INVALID;
......@@ -188,6 +181,7 @@ static SLresult IAudioIODeviceCapabilities_QuerySampleFormatsSupported(
default:
return SL_RESULT_IO_ERROR;
}
// FIXME incomplete
switch (samplingRate) {
case SL_SAMPLINGRATE_44_1:
break;
......@@ -221,13 +215,10 @@ void IAudioIODeviceCapabilities_init(void *self)
{
IAudioIODeviceCapabilities *this = (IAudioIODeviceCapabilities *) self;
this->mItf = &IAudioIODeviceCapabilities_Itf;
#ifndef NDEBUG
this->mAvailableAudioInputsChangedCallback = NULL;
this->mAvailableAudioInputsChangedContext = NULL;
this->mAvailableAudioOutputsChangedCallback = NULL;
this->mAvailableAudioOutputsChangedContext = NULL;
this->mDefaultDeviceIDMapChangedCallback = NULL;
this->mDefaultDeviceIDMapChangedContext = NULL;
#endif
}
......@@ -22,7 +22,7 @@ static SLresult IBassBoost_SetEnabled(SLBassBoostItf self, SLboolean enabled)
{
IBassBoost *this = (IBassBoost *) self;
interface_lock_poke(this);
this->mEnabled = enabled;
this->mEnabled = SL_BOOLEAN_FALSE != enabled; // normalize
interface_unlock_poke(this);
return SL_RESULT_SUCCESS;
}
......@@ -41,6 +41,8 @@ static SLresult IBassBoost_IsEnabled(SLBassBoostItf self, SLboolean *pEnabled)
static SLresult IBassBoost_SetStrength(SLBassBoostItf self, SLpermille strength)
{
if (!(0 <= strength) && (strength <= 1000))
return SL_RESULT_PARAMETER_INVALID;
IBassBoost *this = (IBassBoost *) self;
interface_lock_poke(this);
this->mStrength = strength;
......@@ -48,8 +50,7 @@ static SLresult IBassBoost_SetStrength(SLBassBoostItf self, SLpermille strength)
return SL_RESULT_SUCCESS;
}
static SLresult IBassBoost_GetRoundedStrength(SLBassBoostItf self,
SLpermille *pStrength)
static SLresult IBassBoost_GetRoundedStrength(SLBassBoostItf self, SLpermille *pStrength)
{
if (NULL == pStrength)
return SL_RESULT_PARAMETER_INVALID;
......@@ -61,8 +62,7 @@ static SLresult IBassBoost_GetRoundedStrength(SLBassBoostItf self,
return SL_RESULT_SUCCESS;
}
static SLresult IBassBoost_IsStrengthSupported(SLBassBoostItf self,
SLboolean *pSupported)
static SLresult IBassBoost_IsStrengthSupported(SLBassBoostItf self, SLboolean *pSupported)
{
if (NULL == pSupported)
return SL_RESULT_PARAMETER_INVALID;
......@@ -82,8 +82,6 @@ void IBassBoost_init(void *self)
{
IBassBoost *this = (IBassBoost *) self;
this->mItf = &IBassBoost_Itf;
#ifndef NDEBUG
this->mEnabled = SL_BOOLEAN_FALSE;
#endif
this->mStrength = 1000;
}
......@@ -21,15 +21,13 @@
static SLresult IBufferQueue_Enqueue(SLBufferQueueItf self, const void *pBuffer,
SLuint32 size)
{
//FIXME if queue is empty and associated player is not in SL_PLAYSTATE_PLAYING state,
// set it to SL_PLAYSTATE_PLAYING (and start playing)
if (NULL == pBuffer || 0 == size)
return SL_RESULT_PARAMETER_INVALID;
IBufferQueue *this = (IBufferQueue *) self;
SLresult result;
interface_lock_exclusive(this);
struct BufferHeader *oldRear = this->mRear, *newRear;
if ((newRear = oldRear + 1) == &this->mArray[this->mNumBuffers])
BufferHeader *oldRear = this->mRear, *newRear;
if ((newRear = oldRear + 1) == &this->mArray[this->mNumBuffers + 1])
newRear = this->mArray;
if (newRear == this->mFront) {
result = SL_RESULT_BUFFER_INSUFFICIENT;
......@@ -113,7 +111,7 @@ void IBufferQueue_init(void *self)
this->mFront = NULL;
this->mRear = NULL;
this->mSizeConsumed = 0;
struct BufferHeader *bufferHeader = this->mTypical;
BufferHeader *bufferHeader = this->mTypical;
unsigned i;
for (i = 0; i < BUFFER_HEADER_TYPICAL+1; ++i, ++bufferHeader) {
bufferHeader->mBuffer = NULL;
......
......@@ -18,10 +18,19 @@
#include "sles_allinclusive.h"
static SLresult IDeviceVolume_GetVolumeScale(SLDeviceVolumeItf self,
SLuint32 deviceID, SLint32 *pMinValue, SLint32 *pMaxValue,
SLboolean *pIsMillibelScale)
static SLresult IDeviceVolume_GetVolumeScale(SLDeviceVolumeItf self, SLuint32 deviceID,
SLint32 *pMinValue, SLint32 *pMaxValue, SLboolean *pIsMillibelScale)
{
switch (deviceID) {
case SL_DEFAULTDEVICEID_AUDIOINPUT:
case SL_DEFAULTDEVICEID_AUDIOOUTPUT:
// FIXME move these to device-specific or platform-specific file
case DEVICE_ID_HEADSET:
case DEVICE_ID_HANDSFREE:
break;
default:
return SL_RESULT_PARAMETER_INVALID;
}
if (NULL != pMinValue)
*pMinValue = 0;
if (NULL != pMaxValue)
......@@ -31,18 +40,19 @@ static SLresult IDeviceVolume_GetVolumeScale(SLDeviceVolumeItf self,
return SL_RESULT_SUCCESS;
}
static SLresult IDeviceVolume_SetVolume(SLDeviceVolumeItf self,
SLuint32 deviceID, SLint32 volume)
static SLresult IDeviceVolume_SetVolume(SLDeviceVolumeItf self, SLuint32 deviceID, SLint32 volume)
{
switch (deviceID) {
case SL_DEFAULTDEVICEID_AUDIOINPUT:
case SL_DEFAULTDEVICEID_AUDIOOUTPUT:
break;
// FIXME These don't work yet
case DEVICE_ID_HEADSET:
case DEVICE_ID_HANDSFREE:
default:
return SL_RESULT_PARAMETER_INVALID;
}
IDeviceVolume *this =
(IDeviceVolume *) self;
IDeviceVolume *this = (IDeviceVolume *) self;
interface_lock_poke(this);
this->mVolume[~deviceID] = volume;
interface_unlock_poke(this);
......@@ -58,11 +68,13 @@ static SLresult IDeviceVolume_GetVolume(SLDeviceVolumeItf self,
case SL_DEFAULTDEVICEID_AUDIOINPUT:
case SL_DEFAULTDEVICEID_AUDIOOUTPUT:
break;
// FIXME These don't work yet
case DEVICE_ID_HEADSET:
case DEVICE_ID_HANDSFREE:
default:
return SL_RESULT_PARAMETER_INVALID;
}
IDeviceVolume *this =
(IDeviceVolume *) self;
IDeviceVolume *this = (IDeviceVolume *) self;
interface_lock_peek(this);
SLint32 volume = this->mVolume[~deviceID];
interface_unlock_peek(this);
......
......@@ -43,15 +43,22 @@ static SLresult IDynamicInterfaceManagement_AddInterface(SLDynamicInterfaceManag
// Lock the object rather than the DIM interface, because
// we modify both the object (exposed) and interface (added)
object_lock_exclusive(thisObject);
if (thisObject->mExposedMask & mask) {
if ((thisObject->mExposedMask | this->mAddingMask) & mask) {
result = SL_RESULT_PRECONDITIONS_VIOLATED;
} else {
// Mark operation pending to prevent duplication
this->mAddingMask |= mask;
object_unlock_exclusive(thisObject);
// FIXME Currently all initialization is done here, even if requested to be asynchronous
// FIXME For asynchronous, mark operation pending to prevent duplication
memset(thisItf, 0, size);
((void **) thisItf)[1] = thisObject;
if (NULL != init)
(*init)(thisItf);
// Note that this was previously locked, but then unlocked for the init hook
object_lock_exclusive(thisObject);
assert(this->mAddingMask & mask);
this->mAddingMask &= ~mask;
assert(!(thisObject->mExposedMask & mask));
thisObject->mExposedMask |= mask;
assert(!(this->mAddedMask & mask));
this->mAddedMask |= mask;
......@@ -95,16 +102,25 @@ static SLresult IDynamicInterfaceManagement_RemoveInterface(
// we modify both the object (exposed) and interface (added)
object_lock_exclusive(thisObject);
// disallow removal of non-dynamic interfaces
if (!(this->mAddedMask & mask)) {
if (!(this->mAddedMask & mask) || (this->mRemovingMask & mask)) {
result = SL_RESULT_PRECONDITIONS_VIOLATED;
} else {
this->mRemovingMask |= mask;
object_unlock_exclusive(thisObject);
// FIXME When async resume is implemented, a pending async resume should be cancelled
// The deinitialization is done with mutex unlocked
if (NULL != deinit)
(*deinit)(thisItf);
#ifndef NDEBUG
memset(thisItf, 0x55, size);
#endif
// Note that this was previously locked, but then unlocked for the deinit hook
object_lock_exclusive(thisObject);
assert(this->mRemovingMask & mask);
this->mRemovingMask &= ~mask;
assert(thisObject->mExposedMask & mask);
thisObject->mExposedMask &= ~mask;
assert(this->mAddedMask & mask);
this->mAddedMask &= ~mask;
this->mSuspendedMask &= ~mask;
}
......@@ -178,6 +194,8 @@ void IDynamicInterfaceManagement_init(void *self)
IDynamicInterfaceManagement *this = (IDynamicInterfaceManagement *) self;
this->mItf = &IDynamicInterfaceManagement_Itf;
this->mAddedMask = 0;
this->mAddingMask = 0;
this->mRemovingMask = 0;
this->mSuspendedMask = 0;
this->mCallback = NULL;
this->mContext = NULL;
......
......@@ -41,7 +41,7 @@ static SLresult IDynamicSource_SetSource(SLDynamicSourceItf self, SLDataSource *
// FIXME a bit of a simplification to say the least!
this->mDataSource = pDataSource;
object_unlock_exclusive(thisObject);
return SL_RESULT_SUCCESS;
return SL_RESULT_FEATURE_UNSUPPORTED;
}
static const struct SLDynamicSourceItf_ IDynamicSource_Itf = {
......
......@@ -18,8 +18,7 @@
#include "sles_allinclusive.h"
static struct EnableLevel *getEnableLevel(IEffectSend *this,
const void *pAuxEffect)
static struct EnableLevel *getEnableLevel(IEffectSend *this, const void *pAuxEffect)
{
COutputMix *outputMix = this->mOutputMix;
// Make sure the sink for this player is an output mix
......@@ -42,12 +41,14 @@ static struct EnableLevel *getEnableLevel(IEffectSend *this,
static SLresult IEffectSend_EnableEffectSend(SLEffectSendItf self,
const void *pAuxEffect, SLboolean enable, SLmillibel initialLevel)
{
if (!((SL_MILLIBEL_MIN <= initialLevel) && (initialLevel <= 0)))
return SL_RESULT_PARAMETER_INVALID;
IEffectSend *this = (IEffectSend *) self;
struct EnableLevel *enableLevel = getEnableLevel(this, pAuxEffect);
if (NULL == enableLevel)
return SL_RESULT_PARAMETER_INVALID;
interface_lock_exclusive(this);
enableLevel->mEnable = enable;
enableLevel->mEnable = SL_BOOLEAN_FALSE != enable; // normalize
enableLevel->mSendLevel = initialLevel;
interface_unlock_exclusive(this);
return SL_RESULT_SUCCESS;
......@@ -69,9 +70,10 @@ static SLresult IEffectSend_IsEnabled(SLEffectSendItf self,
return SL_RESULT_SUCCESS;
}
static SLresult IEffectSend_SetDirectLevel(SLEffectSendItf self,
SLmillibel directLevel)
static SLresult IEffectSend_SetDirectLevel(SLEffectSendItf self, SLmillibel directLevel)
{
if (!((SL_MILLIBEL_MIN <= directLevel) && (directLevel <= 0)))
return SL_RESULT_PARAMETER_INVALID;
IEffectSend *this = (IEffectSend *) self;
interface_lock_poke(this);
this->mDirectLevel = directLevel;
......@@ -79,8 +81,7 @@ static SLresult IEffectSend_SetDirectLevel(SLEffectSendItf self,
return SL_RESULT_SUCCESS;
}
static SLresult IEffectSend_GetDirectLevel(SLEffectSendItf self,
SLmillibel *pDirectLevel)
static SLresult IEffectSend_GetDirectLevel(SLEffectSendItf self, SLmillibel *pDirectLevel)
{
if (NULL == pDirectLevel)
return SL_RESULT_PARAMETER_INVALID;
......@@ -92,9 +93,10 @@ static SLresult IEffectSend_GetDirectLevel(SLEffectSendItf self,
return SL_RESULT_SUCCESS;
}
static SLresult IEffectSend_SetSendLevel(SLEffectSendItf self,
const void *pAuxEffect, SLmillibel sendLevel)
static SLresult IEffectSend_SetSendLevel(SLEffectSendItf self, const void *pAuxEffect, SLmillibel sendLevel)
{
if (!((SL_MILLIBEL_MIN <= sendLevel) && (sendLevel <= 0)))
return SL_RESULT_PARAMETER_INVALID;
IEffectSend *this = (IEffectSend *) self;
struct EnableLevel *enableLevel = getEnableLevel(this, pAuxEffect);
if (NULL == enableLevel)
......@@ -106,8 +108,7 @@ static SLresult IEffectSend_SetSendLevel(SLEffectSendItf self,
return SL_RESULT_SUCCESS;
}
static SLresult IEffectSend_GetSendLevel(SLEffectSendItf self,
const void *pAuxEffect, SLmillibel *pSendLevel)
static SLresult IEffectSend_GetSendLevel(SLEffectSendItf self, const void *pAuxEffect, SLmillibel *pSendLevel)
{
if (NULL == pSendLevel)
return SL_RESULT_PARAMETER_INVALID;
......@@ -135,13 +136,11 @@ void IEffectSend_init(void *self)
{
IEffectSend *this = (IEffectSend *) self;
this->mItf = &IEffectSend_Itf;
#ifndef NDEBUG
this->mOutputMix = NULL; // FIXME wrong
this->mDirectLevel = 0;
// FIXME hard-coded array initialization should be loop on AUX_MAX
this->mEnableLevels[AUX_ENVIRONMENTALREVERB].mEnable = SL_BOOLEAN_FALSE;
this->mEnableLevels[AUX_ENVIRONMENTALREVERB].mSendLevel = 0;
this->mEnableLevels[AUX_ENVIRONMENTALREVERB].mSendLevel = SL_MILLIBEL_MIN;
this->mEnableLevels[AUX_PRESETREVERB].mEnable = SL_BOOLEAN_FALSE;
this->mEnableLevels[AUX_PRESETREVERB].mSendLevel = 0;
#endif
this->mEnableLevels[AUX_PRESETREVERB].mSendLevel = SL_MILLIBEL_MIN;
}
......@@ -129,8 +129,8 @@ static SLresult IEngine_CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer
this->mBufferQueue.mArray = this->mBufferQueue.mTypical;
} else {
// FIXME integer overflow possible during multiplication
this->mBufferQueue.mArray = (struct BufferHeader *)
malloc((this->mBufferQueue.mNumBuffers + 1) * sizeof(struct BufferHeader));
this->mBufferQueue.mArray = (BufferHeader *)
malloc((this->mBufferQueue.mNumBuffers + 1) * sizeof(BufferHeader));
if (NULL == this->mBufferQueue.mArray) {
result = SL_RESULT_MEMORY_FAILURE;
goto abort;
......@@ -223,8 +223,7 @@ static SLresult IEngine_CreateMidiPlayer(SLEngineItf self, SLObjectItf *pPlayer,
}
static SLresult IEngine_CreateListener(SLEngineItf self, SLObjectItf *pListener,
SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds,
const SLboolean *pInterfaceRequired)
SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired)
{
if (NULL == pListener)
return SL_RESULT_PARAMETER_INVALID;
......@@ -238,9 +237,8 @@ static SLresult IEngine_CreateListener(SLEngineItf self, SLObjectItf *pListener,
return SL_RESULT_FEATURE_UNSUPPORTED;
}
static SLresult IEngine_Create3DGroup(SLEngineItf self, SLObjectItf *pGroup,
SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds,
const SLboolean *pInterfaceRequired)
static SLresult IEngine_Create3DGroup(SLEngineItf self, SLObjectItf *pGroup, SLuint32 numInterfaces,
const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired)
{
if (NULL == pGroup)
return SL_RESULT_PARAMETER_INVALID;
......@@ -273,9 +271,8 @@ static SLresult IEngine_CreateOutputMix(SLEngineItf self, SLObjectItf *pMix, SLu
return SL_RESULT_SUCCESS;
}
static SLresult IEngine_CreateMetadataExtractor(SLEngineItf self,
SLObjectItf *pMetadataExtractor, SLDataSource *pDataSource,
SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds,
static SLresult IEngine_CreateMetadataExtractor(SLEngineItf self, SLObjectItf *pMetadataExtractor,
SLDataSource *pDataSource, SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds,
const SLboolean *pInterfaceRequired)
{
if (NULL == pMetadataExtractor)
......@@ -295,10 +292,9 @@ static SLresult IEngine_CreateMetadataExtractor(SLEngineItf self,
return SL_RESULT_SUCCESS;
}
static SLresult IEngine_CreateExtensionObject(SLEngineItf self,
SLObjectItf *pObject, void *pParameters, SLuint32 objectID,
SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds,
const SLboolean *pInterfaceRequired)
static SLresult IEngine_CreateExtensionObject(SLEngineItf self, SLObjectItf *pObject,
void *pParameters, SLuint32 objectID, SLuint32 numInterfaces,
const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired)
{
if (NULL == pObject)
return SL_RESULT_PARAMETER_INVALID;
......@@ -387,4 +383,5 @@ void IEngine_init(void *self)
unsigned i;
for (i = 0; i < INSTANCE_MAX; ++i)
this->mInstances[i] = NULL;
this->mShutdown = SL_BOOLEAN_FALSE;
}
......@@ -23,9 +23,9 @@ static SLresult IEngineCapabilities_QuerySupportedProfiles(
{
if (NULL == pProfilesSupported)
return SL_RESULT_PARAMETER_INVALID;
// This omits the unofficial driver profile
*pProfilesSupported =
SL_PROFILES_PHONE | SL_PROFILES_MUSIC | SL_PROFILES_GAME;
// The generic implementation doesn't implement any of the profiles, they shouldn't
// be declared as supported. Also omits the unofficial driver profile.
*pProfilesSupported = 0; // SL_PROFILES_PHONE | SL_PROFILES_MUSIC | SL_PROFILES_GAME
return SL_RESULT_SUCCESS;
}
......@@ -71,9 +71,8 @@ static SLresult IEngineCapabilities_QueryAPIVersion(SLEngineCapabilitiesItf self
return SL_RESULT_SUCCESS;
}
static SLresult IEngineCapabilities_QueryLEDCapabilities(
SLEngineCapabilitiesItf self, SLuint32 *pIndex, SLuint32 *pLEDDeviceID,
SLLEDDescriptor *pDescriptor)
static SLresult IEngineCapabilities_QueryLEDCapabilities(SLEngineCapabilitiesItf self,
SLuint32 *pIndex, SLuint32 *pLEDDeviceID, SLLEDDescriptor *pDescriptor)
{
const struct LED_id_descriptor *id_descriptor = LED_id_descriptors;
while (NULL != id_descriptor->descriptor)
......@@ -110,9 +109,8 @@ static SLresult IEngineCapabilities_QueryLEDCapabilities(
}
}
static SLresult IEngineCapabilities_QueryVibraCapabilities(
SLEngineCapabilitiesItf self, SLuint32 *pIndex, SLuint32 *pVibraDeviceID,
SLVibraDescriptor *pDescriptor)
static SLresult IEngineCapabilities_QueryVibraCapabilities(SLEngineCapabilitiesItf self,
SLuint32 *pIndex, SLuint32 *pVibraDeviceID, SLVibraDescriptor *pDescriptor)
{
const struct Vibra_id_descriptor *id_descriptor = Vibra_id_descriptors;
while (NULL != id_descriptor->descriptor)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment