Commit 3ed7e517 authored by Thomas Guillem's avatar Thomas Guillem Committed by Martin Storsjö

Add android private headers for jbmr2 and kitkat

Signed-off-by: Martin Storsjö's avatarMartin Storsjö <martin@martin.st>
parent ae06cb91
/*
* Copyright (C) 2007 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.
*/
#ifndef ANDROID_AUDIO_BUFFER_PROVIDER_H
#define ANDROID_AUDIO_BUFFER_PROVIDER_H
#include <utils/Errors.h>
namespace android {
// ----------------------------------------------------------------------------
class AudioBufferProvider
{
public:
struct Buffer {
Buffer() : raw(NULL), frameCount(0) { }
union {
void* raw;
short* i16;
int8_t* i8;
};
size_t frameCount;
};
virtual ~AudioBufferProvider() {}
// value representing an invalid presentation timestamp
static const int64_t kInvalidPTS = 0x7FFFFFFFFFFFFFFFLL; // <stdint.h> is too painful
// pts is the local time when the next sample yielded by getNextBuffer
// will be rendered.
// Pass kInvalidPTS if the PTS is unknown or not applicable.
virtual status_t getNextBuffer(Buffer* buffer, int64_t pts = kInvalidPTS) = 0;
virtual void releaseBuffer(Buffer* buffer) = 0;
};
// ----------------------------------------------------------------------------
}; // namespace android
#endif // ANDROID_AUDIO_BUFFER_PROVIDER_H
/*
* Copyright (C) 2009 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.
*/
#ifndef ANDROID_AUDIOEFFECT_H
#define ANDROID_AUDIOEFFECT_H
#include <stdint.h>
#include <sys/types.h>
#include <media/IAudioFlinger.h>
#include <media/IAudioPolicyService.h>
#include <media/IEffect.h>
#include <media/IEffectClient.h>
#include <hardware/audio_effect.h>
#include <media/AudioSystem.h>
#include <utils/RefBase.h>
#include <utils/Errors.h>
#include <binder/IInterface.h>
namespace android {
// ----------------------------------------------------------------------------
class effect_param_cblk_t;
// ----------------------------------------------------------------------------
class AudioEffect : public RefBase
{
public:
/*
* Static methods for effects enumeration.
*/
/*
* Returns the number of effects available. This method together
* with queryEffect() is used to enumerate all effects:
* The enumeration sequence is:
* queryNumberEffects(&num_effects);
* for (i = 0; i < num_effects; i++)
* queryEffect(i,...);
*
* Parameters:
* numEffects: address where the number of effects should be returned.
*
* Returned status (from utils/Errors.h) can be:
* NO_ERROR successful operation.
* PERMISSION_DENIED could not get AudioFlinger interface
* NO_INIT effect library failed to initialize
* BAD_VALUE invalid numEffects pointer
*
* Returned value
* *numEffects: updated with number of effects available
*/
static status_t queryNumberEffects(uint32_t *numEffects);
/*
* Returns an effect descriptor during effect
* enumeration.
*
* Parameters:
* index: index of the queried effect.
* descriptor: address where the effect descriptor should be returned.
*
* Returned status (from utils/Errors.h) can be:
* NO_ERROR successful operation.
* PERMISSION_DENIED could not get AudioFlinger interface
* NO_INIT effect library failed to initialize
* BAD_VALUE invalid descriptor pointer or index
* INVALID_OPERATION effect list has changed since last execution of queryNumberEffects()
*
* Returned value
* *descriptor: updated with effect descriptor
*/
static status_t queryEffect(uint32_t index, effect_descriptor_t *descriptor);
/*
* Returns the descriptor for the specified effect uuid.
*
* Parameters:
* uuid: pointer to effect uuid.
* descriptor: address where the effect descriptor should be returned.
*
* Returned status (from utils/Errors.h) can be:
* NO_ERROR successful operation.
* PERMISSION_DENIED could not get AudioFlinger interface
* NO_INIT effect library failed to initialize
* BAD_VALUE invalid uuid or descriptor pointers
* NAME_NOT_FOUND no effect with this uuid found
*
* Returned value
* *descriptor updated with effect descriptor
*/
static status_t getEffectDescriptor(const effect_uuid_t *uuid,
effect_descriptor_t *descriptor) /*const*/;
/*
* Returns a list of descriptors corresponding to the pre processings enabled by default
* on an AudioRecord with the supplied audio session ID.
*
* Parameters:
* audioSession: audio session ID.
* descriptors: address where the effect descriptors should be returned.
* count: as input, the maximum number of descriptor than should be returned
* as output, the number of descriptor returned if status is NO_ERROR or the actual
* number of enabled pre processings if status is NO_MEMORY
*
* Returned status (from utils/Errors.h) can be:
* NO_ERROR successful operation.
* NO_MEMORY the number of descriptor to return is more than the maximum number
* indicated by count.
* PERMISSION_DENIED could not get AudioFlinger interface
* NO_INIT effect library failed to initialize
* BAD_VALUE invalid audio session or descriptor pointers
*
* Returned value
* *descriptor updated with descriptors of pre processings enabled by default
* *count number of descriptors returned if returned status is N_ERROR.
* total number of pre processing enabled by default if returned status is
* NO_MEMORY. This happens if the count passed as input is less than the number
* of descriptors to return
*/
static status_t queryDefaultPreProcessing(int audioSession,
effect_descriptor_t *descriptors,
uint32_t *count);
/*
* Events used by callback function (effect_callback_t).
*/
enum event_type {
EVENT_CONTROL_STATUS_CHANGED = 0,
EVENT_ENABLE_STATUS_CHANGED = 1,
EVENT_PARAMETER_CHANGED = 2,
EVENT_ERROR = 3
};
/* Callback function notifying client application of a change in effect engine state or
* configuration.
* An effect engine can be shared by several applications but only one has the control
* of the engine activity and configuration at a time.
* The EVENT_CONTROL_STATUS_CHANGED event is received when an application loses or
* retrieves the control of the effect engine. Loss of control happens
* if another application requests the use of the engine by creating an AudioEffect for
* the same effect type but with a higher priority. Control is returned when the
* application having the control deletes its AudioEffect object.
* The EVENT_ENABLE_STATUS_CHANGED event is received by all applications not having the
* control of the effect engine when the effect is enabled or disabled.
* The EVENT_PARAMETER_CHANGED event is received by all applications not having the
* control of the effect engine when an effect parameter is changed.
* The EVENT_ERROR event is received when the media server process dies.
*
* Parameters:
*
* event: type of event notified (see enum AudioEffect::event_type).
* user: Pointer to context for use by the callback receiver.
* info: Pointer to optional parameter according to event type:
* - EVENT_CONTROL_STATUS_CHANGED: boolean indicating if control is granted (true)
* or stolen (false).
* - EVENT_ENABLE_STATUS_CHANGED: boolean indicating if effect is now enabled (true)
* or disabled (false).
* - EVENT_PARAMETER_CHANGED: pointer to a effect_param_t structure.
* - EVENT_ERROR: status_t indicating the error (DEAD_OBJECT when media server dies).
*/
typedef void (*effect_callback_t)(int32_t event, void* user, void *info);
/* Constructor.
* AudioEffect is the base class for creating and controlling an effect engine from
* the application process. Creating an AudioEffect object will create the effect engine
* in the AudioFlinger if no engine of the specified type exists. If one exists, this engine
* will be used. The application creating the AudioEffect object (or a derived class like
* Reverb for instance) will either receive control of the effect engine or not, depending
* on the priority parameter. If priority is higher than the priority used by the current
* effect engine owner, the control will be transfered to the new application. Otherwise
* control will remain to the previous application. In this case, the new application will be
* notified of changes in effect engine state or control ownership by the effect callback.
* After creating the AudioEffect, the application must call the initCheck() method and
* check the creation status before trying to control the effect engine (see initCheck()).
* If the effect is to be applied to an AudioTrack or MediaPlayer only the application
* must specify the audio session ID corresponding to this player.
*/
/* Simple Constructor.
*/
AudioEffect();
/* Constructor.
*
* Parameters:
*
* type: type of effect created: can be null if uuid is specified. This corresponds to
* the OpenSL ES interface implemented by this effect.
* uuid: Uuid of effect created: can be null if type is specified. This uuid corresponds to
* a particular implementation of an effect type.
* priority: requested priority for effect control: the priority level corresponds to the
* value of priority parameter: negative values indicate lower priorities, positive values
* higher priorities, 0 being the normal priority.
* cbf: optional callback function (see effect_callback_t)
* user: pointer to context for use by the callback receiver.
* sessionID: audio session this effect is associated to. If 0, the effect will be global to
* the output mix. If not 0, the effect will be applied to all players
* (AudioTrack or MediaPLayer) within the same audio session.
* io: HAL audio output or input stream to which this effect must be attached. Leave at 0 for
* automatic output selection by AudioFlinger.
*/
AudioEffect(const effect_uuid_t *type,
const effect_uuid_t *uuid = NULL,
int32_t priority = 0,
effect_callback_t cbf = NULL,
void* user = NULL,
int sessionId = 0,
audio_io_handle_t io = 0
);
/* Constructor.
* Same as above but with type and uuid specified by character strings
*/
AudioEffect(const char *typeStr,
const char *uuidStr = NULL,
int32_t priority = 0,
effect_callback_t cbf = NULL,
void* user = NULL,
int sessionId = 0,
audio_io_handle_t io = 0
);
/* Terminates the AudioEffect and unregisters it from AudioFlinger.
* The effect engine is also destroyed if this AudioEffect was the last controlling
* the engine.
*/
~AudioEffect();
/* Initialize an uninitialized AudioEffect.
* Returned status (from utils/Errors.h) can be:
* - NO_ERROR or ALREADY_EXISTS: successful initialization