dom/system/gonk/android_audio/IAudioFlinger.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (C) 2007 The Android Open Source Project
michael@0 3 *
michael@0 4 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 5 * you may not use this file except in compliance with the License.
michael@0 6 * You may obtain a copy of the License at
michael@0 7 *
michael@0 8 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 9 *
michael@0 10 * Unless required by applicable law or agreed to in writing, software
michael@0 11 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 13 * See the License for the specific language governing permissions and
michael@0 14 * limitations under the License.
michael@0 15 */
michael@0 16
michael@0 17 #ifndef ANDROID_IAUDIOFLINGER_H
michael@0 18 #define ANDROID_IAUDIOFLINGER_H
michael@0 19
michael@0 20 #include <stdint.h>
michael@0 21 #include <sys/types.h>
michael@0 22 #include <unistd.h>
michael@0 23
michael@0 24 #include <utils/RefBase.h>
michael@0 25 #include <utils/Errors.h>
michael@0 26 #include <binder/IInterface.h>
michael@0 27 #include "IAudioTrack.h"
michael@0 28 #include "IAudioRecord.h"
michael@0 29 #include "IAudioFlingerClient.h"
michael@0 30 #include "EffectApi.h"
michael@0 31 #include "IEffect.h"
michael@0 32 #include "IEffectClient.h"
michael@0 33 #include <utils/String8.h>
michael@0 34
michael@0 35 namespace android {
michael@0 36
michael@0 37 // ----------------------------------------------------------------------------
michael@0 38
michael@0 39 class IAudioFlinger : public IInterface
michael@0 40 {
michael@0 41 public:
michael@0 42 DECLARE_META_INTERFACE(AudioFlinger);
michael@0 43
michael@0 44 /* create an audio track and registers it with AudioFlinger.
michael@0 45 * return null if the track cannot be created.
michael@0 46 */
michael@0 47 virtual sp<IAudioTrack> createTrack(
michael@0 48 pid_t pid,
michael@0 49 int streamType,
michael@0 50 uint32_t sampleRate,
michael@0 51 int format,
michael@0 52 int channelCount,
michael@0 53 int frameCount,
michael@0 54 uint32_t flags,
michael@0 55 const sp<IMemory>& sharedBuffer,
michael@0 56 int output,
michael@0 57 int *sessionId,
michael@0 58 status_t *status) = 0;
michael@0 59
michael@0 60 virtual sp<IAudioRecord> openRecord(
michael@0 61 pid_t pid,
michael@0 62 int input,
michael@0 63 uint32_t sampleRate,
michael@0 64 int format,
michael@0 65 int channelCount,
michael@0 66 int frameCount,
michael@0 67 uint32_t flags,
michael@0 68 int *sessionId,
michael@0 69 status_t *status) = 0;
michael@0 70
michael@0 71 /* query the audio hardware state. This state never changes,
michael@0 72 * and therefore can be cached.
michael@0 73 */
michael@0 74 virtual uint32_t sampleRate(int output) const = 0;
michael@0 75 virtual int channelCount(int output) const = 0;
michael@0 76 virtual int format(int output) const = 0;
michael@0 77 virtual size_t frameCount(int output) const = 0;
michael@0 78 virtual uint32_t latency(int output) const = 0;
michael@0 79
michael@0 80 /* set/get the audio hardware state. This will probably be used by
michael@0 81 * the preference panel, mostly.
michael@0 82 */
michael@0 83 virtual status_t setMasterVolume(float value) = 0;
michael@0 84 virtual status_t setMasterMute(bool muted) = 0;
michael@0 85
michael@0 86 virtual float masterVolume() const = 0;
michael@0 87 virtual bool masterMute() const = 0;
michael@0 88
michael@0 89 /* set/get stream type state. This will probably be used by
michael@0 90 * the preference panel, mostly.
michael@0 91 */
michael@0 92 virtual status_t setStreamVolume(int stream, float value, int output) = 0;
michael@0 93 virtual status_t setStreamMute(int stream, bool muted) = 0;
michael@0 94
michael@0 95 virtual float streamVolume(int stream, int output) const = 0;
michael@0 96 virtual bool streamMute(int stream) const = 0;
michael@0 97
michael@0 98 // set audio mode
michael@0 99 virtual status_t setMode(int mode) = 0;
michael@0 100
michael@0 101 // mic mute/state
michael@0 102 virtual status_t setMicMute(bool state) = 0;
michael@0 103 virtual bool getMicMute() const = 0;
michael@0 104
michael@0 105 // is any track active on this stream?
michael@0 106 virtual bool isStreamActive(int stream) const = 0;
michael@0 107
michael@0 108 virtual status_t setParameters(int ioHandle, const String8& keyValuePairs) = 0;
michael@0 109 virtual String8 getParameters(int ioHandle, const String8& keys) = 0;
michael@0 110
michael@0 111 // register a current process for audio output change notifications
michael@0 112 virtual void registerClient(const sp<IAudioFlingerClient>& client) = 0;
michael@0 113
michael@0 114 // retrieve the audio recording buffer size
michael@0 115 virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount) = 0;
michael@0 116
michael@0 117 virtual int openOutput(uint32_t *pDevices,
michael@0 118 uint32_t *pSamplingRate,
michael@0 119 uint32_t *pFormat,
michael@0 120 uint32_t *pChannels,
michael@0 121 uint32_t *pLatencyMs,
michael@0 122 uint32_t flags) = 0;
michael@0 123 virtual int openDuplicateOutput(int output1, int output2) = 0;
michael@0 124 virtual status_t closeOutput(int output) = 0;
michael@0 125 virtual status_t suspendOutput(int output) = 0;
michael@0 126 virtual status_t restoreOutput(int output) = 0;
michael@0 127
michael@0 128 virtual int openInput(uint32_t *pDevices,
michael@0 129 uint32_t *pSamplingRate,
michael@0 130 uint32_t *pFormat,
michael@0 131 uint32_t *pChannels,
michael@0 132 uint32_t acoustics) = 0;
michael@0 133 virtual status_t closeInput(int input) = 0;
michael@0 134
michael@0 135 virtual status_t setStreamOutput(uint32_t stream, int output) = 0;
michael@0 136
michael@0 137 virtual status_t setVoiceVolume(float volume) = 0;
michael@0 138
michael@0 139 virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) = 0;
michael@0 140
michael@0 141 virtual unsigned int getInputFramesLost(int ioHandle) = 0;
michael@0 142
michael@0 143 virtual int newAudioSessionId() = 0;
michael@0 144
michael@0 145 virtual status_t loadEffectLibrary(const char *libPath, int *handle) = 0;
michael@0 146
michael@0 147 virtual status_t unloadEffectLibrary(int handle) = 0;
michael@0 148
michael@0 149 virtual status_t queryNumberEffects(uint32_t *numEffects) = 0;
michael@0 150
michael@0 151 virtual status_t queryEffect(uint32_t index, effect_descriptor_t *pDescriptor) = 0;
michael@0 152
michael@0 153 virtual status_t getEffectDescriptor(effect_uuid_t *pEffectUUID, effect_descriptor_t *pDescriptor) = 0;
michael@0 154
michael@0 155 virtual sp<IEffect> createEffect(pid_t pid,
michael@0 156 effect_descriptor_t *pDesc,
michael@0 157 const sp<IEffectClient>& client,
michael@0 158 int32_t priority,
michael@0 159 int output,
michael@0 160 int sessionId,
michael@0 161 status_t *status,
michael@0 162 int *id,
michael@0 163 int *enabled) = 0;
michael@0 164
michael@0 165 virtual status_t moveEffects(int session, int srcOutput, int dstOutput) = 0;
michael@0 166 };
michael@0 167
michael@0 168
michael@0 169 // ----------------------------------------------------------------------------
michael@0 170
michael@0 171 class BnAudioFlinger : public BnInterface<IAudioFlinger>
michael@0 172 {
michael@0 173 public:
michael@0 174 virtual status_t onTransact( uint32_t code,
michael@0 175 const Parcel& data,
michael@0 176 Parcel* reply,
michael@0 177 uint32_t flags = 0);
michael@0 178 };
michael@0 179
michael@0 180 // ----------------------------------------------------------------------------
michael@0 181
michael@0 182 }; // namespace android
michael@0 183
michael@0 184 #endif // ANDROID_IAUDIOFLINGER_H

mercurial