Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 1 | /* |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2 | ** |
| 3 | ** Copyright 2007, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #define LOG_TAG "IAudioFlinger" |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 19 | //#define LOG_NDEBUG 0 |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | #include <utils/Log.h> |
| 21 | |
| 22 | #include <stdint.h> |
| 23 | #include <sys/types.h> |
| 24 | |
Mathias Agopian | 7562408 | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 25 | #include <binder/Parcel.h> |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | |
| 27 | #include <media/IAudioFlinger.h> |
| 28 | |
| 29 | namespace android { |
| 30 | |
| 31 | enum { |
| 32 | CREATE_TRACK = IBinder::FIRST_CALL_TRANSACTION, |
| 33 | OPEN_RECORD, |
| 34 | SAMPLE_RATE, |
Glenn Kasten | 5876f2f | 2012-11-30 10:52:16 -0800 | [diff] [blame] | 35 | RESERVED, // obsolete, was CHANNEL_COUNT |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | FORMAT, |
| 37 | FRAME_COUNT, |
| 38 | LATENCY, |
| 39 | SET_MASTER_VOLUME, |
| 40 | SET_MASTER_MUTE, |
| 41 | MASTER_VOLUME, |
| 42 | MASTER_MUTE, |
| 43 | SET_STREAM_VOLUME, |
| 44 | SET_STREAM_MUTE, |
| 45 | STREAM_VOLUME, |
| 46 | STREAM_MUTE, |
| 47 | SET_MODE, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | SET_MIC_MUTE, |
| 49 | GET_MIC_MUTE, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 50 | SET_PARAMETERS, |
| 51 | GET_PARAMETERS, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | REGISTER_CLIENT, |
| 53 | GET_INPUTBUFFERSIZE, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 54 | OPEN_OUTPUT, |
| 55 | OPEN_DUPLICATE_OUTPUT, |
| 56 | CLOSE_OUTPUT, |
| 57 | SUSPEND_OUTPUT, |
| 58 | RESTORE_OUTPUT, |
| 59 | OPEN_INPUT, |
| 60 | CLOSE_INPUT, |
Eric Laurent | f0ee6f4 | 2009-10-21 08:14:22 -0700 | [diff] [blame] | 61 | SET_STREAM_OUTPUT, |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 62 | SET_VOICE_VOLUME, |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 63 | GET_RENDER_POSITION, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 64 | GET_INPUT_FRAMES_LOST, |
| 65 | NEW_AUDIO_SESSION_ID, |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 66 | ACQUIRE_AUDIO_SESSION_ID, |
| 67 | RELEASE_AUDIO_SESSION_ID, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 68 | QUERY_NUM_EFFECTS, |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 69 | QUERY_EFFECT, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 70 | GET_EFFECT_DESCRIPTOR, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 71 | CREATE_EFFECT, |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 72 | MOVE_EFFECTS, |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 73 | LOAD_HW_MODULE, |
| 74 | GET_PRIMARY_OUTPUT_SAMPLING_RATE, |
| 75 | GET_PRIMARY_OUTPUT_FRAME_COUNT, |
Glenn Kasten | 4182c4e | 2013-07-15 14:45:07 -0700 | [diff] [blame] | 76 | SET_LOW_RAM_DEVICE, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | class BpAudioFlinger : public BpInterface<IAudioFlinger> |
| 80 | { |
| 81 | public: |
| 82 | BpAudioFlinger(const sp<IBinder>& impl) |
| 83 | : BpInterface<IAudioFlinger>(impl) |
| 84 | { |
| 85 | } |
| 86 | |
| 87 | virtual sp<IAudioTrack> createTrack( |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 88 | audio_stream_type_t streamType, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | uint32_t sampleRate, |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 90 | audio_format_t format, |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 91 | audio_channel_mask_t channelMask, |
Glenn Kasten | e33054e | 2012-11-14 12:54:39 -0800 | [diff] [blame] | 92 | size_t frameCount, |
Glenn Kasten | e0b0717 | 2012-11-06 15:03:34 -0800 | [diff] [blame] | 93 | track_flags_t *flags, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 94 | const sp<IMemory>& sharedBuffer, |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 95 | audio_io_handle_t output, |
Glenn Kasten | 3acbd05 | 2012-02-28 10:39:56 -0800 | [diff] [blame] | 96 | pid_t tid, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 97 | int *sessionId, |
Glenn Kasten | d054c32 | 2013-07-12 12:59:20 -0700 | [diff] [blame] | 98 | String8& name, |
Marco Nelissen | 9cae217 | 2013-01-14 14:12:05 -0800 | [diff] [blame] | 99 | int clientUid, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | status_t *status) |
| 101 | { |
| 102 | Parcel data, reply; |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 103 | sp<IAudioTrack> track; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 104 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 105 | data.writeInt32((int32_t) streamType); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 106 | data.writeInt32(sampleRate); |
| 107 | data.writeInt32(format); |
Jean-Michel Trivi | 0d255b2 | 2011-05-24 15:53:33 -0700 | [diff] [blame] | 108 | data.writeInt32(channelMask); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 109 | data.writeInt64(frameCount); |
Glenn Kasten | b26e3e9 | 2012-11-14 08:32:08 -0800 | [diff] [blame] | 110 | track_flags_t lFlags = flags != NULL ? *flags : (track_flags_t) TRACK_DEFAULT; |
Glenn Kasten | e0b0717 | 2012-11-06 15:03:34 -0800 | [diff] [blame] | 111 | data.writeInt32(lFlags); |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 112 | if (sharedBuffer != 0) { |
| 113 | data.writeInt32(true); |
| 114 | data.writeStrongBinder(sharedBuffer->asBinder()); |
| 115 | } else { |
| 116 | data.writeInt32(false); |
| 117 | } |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 118 | data.writeInt32((int32_t) output); |
Glenn Kasten | 3acbd05 | 2012-02-28 10:39:56 -0800 | [diff] [blame] | 119 | data.writeInt32((int32_t) tid); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 120 | int lSessionId = 0; |
| 121 | if (sessionId != NULL) { |
| 122 | lSessionId = *sessionId; |
| 123 | } |
| 124 | data.writeInt32(lSessionId); |
Marco Nelissen | 9cae217 | 2013-01-14 14:12:05 -0800 | [diff] [blame] | 125 | data.writeInt32(clientUid); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 126 | status_t lStatus = remote()->transact(CREATE_TRACK, data, &reply); |
| 127 | if (lStatus != NO_ERROR) { |
Steve Block | 29357bc | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 128 | ALOGE("createTrack error: %s", strerror(-lStatus)); |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 129 | } else { |
Glenn Kasten | e0b0717 | 2012-11-06 15:03:34 -0800 | [diff] [blame] | 130 | lFlags = reply.readInt32(); |
| 131 | if (flags != NULL) { |
| 132 | *flags = lFlags; |
| 133 | } |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 134 | lSessionId = reply.readInt32(); |
| 135 | if (sessionId != NULL) { |
| 136 | *sessionId = lSessionId; |
| 137 | } |
Glenn Kasten | d054c32 | 2013-07-12 12:59:20 -0700 | [diff] [blame] | 138 | name = reply.readString8(); |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 139 | lStatus = reply.readInt32(); |
| 140 | track = interface_cast<IAudioTrack>(reply.readStrongBinder()); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 141 | } |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 142 | if (status) { |
| 143 | *status = lStatus; |
| 144 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 145 | return track; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | virtual sp<IAudioRecord> openRecord( |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 149 | audio_io_handle_t input, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 150 | uint32_t sampleRate, |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 151 | audio_format_t format, |
Glenn Kasten | 28b76b3 | 2012-07-03 17:24:41 -0700 | [diff] [blame] | 152 | audio_channel_mask_t channelMask, |
Glenn Kasten | e33054e | 2012-11-14 12:54:39 -0800 | [diff] [blame] | 153 | size_t frameCount, |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 154 | track_flags_t *flags, |
Glenn Kasten | 1879fff | 2012-07-11 15:36:59 -0700 | [diff] [blame] | 155 | pid_t tid, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 156 | int *sessionId, |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 157 | status_t *status) |
| 158 | { |
| 159 | Parcel data, reply; |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 160 | sp<IAudioRecord> record; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 161 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 162 | data.writeInt32((int32_t) input); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 163 | data.writeInt32(sampleRate); |
| 164 | data.writeInt32(format); |
Jean-Michel Trivi | 0d255b2 | 2011-05-24 15:53:33 -0700 | [diff] [blame] | 165 | data.writeInt32(channelMask); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 166 | data.writeInt64(frameCount); |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 167 | track_flags_t lFlags = flags != NULL ? *flags : (track_flags_t) TRACK_DEFAULT; |
| 168 | data.writeInt32(lFlags); |
Glenn Kasten | 1879fff | 2012-07-11 15:36:59 -0700 | [diff] [blame] | 169 | data.writeInt32((int32_t) tid); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 170 | int lSessionId = 0; |
| 171 | if (sessionId != NULL) { |
| 172 | lSessionId = *sessionId; |
| 173 | } |
| 174 | data.writeInt32(lSessionId); |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 175 | status_t lStatus = remote()->transact(OPEN_RECORD, data, &reply); |
| 176 | if (lStatus != NO_ERROR) { |
Steve Block | 29357bc | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 177 | ALOGE("openRecord error: %s", strerror(-lStatus)); |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 178 | } else { |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 179 | lFlags = reply.readInt32(); |
| 180 | if (flags != NULL) { |
| 181 | *flags = lFlags; |
| 182 | } |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 183 | lSessionId = reply.readInt32(); |
| 184 | if (sessionId != NULL) { |
| 185 | *sessionId = lSessionId; |
| 186 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 187 | lStatus = reply.readInt32(); |
| 188 | record = interface_cast<IAudioRecord>(reply.readStrongBinder()); |
Glenn Kasten | e93cf2c | 2013-09-24 11:52:37 -0700 | [diff] [blame] | 189 | if (lStatus == NO_ERROR) { |
| 190 | if (record == 0) { |
| 191 | ALOGE("openRecord should have returned an IAudioRecord"); |
| 192 | lStatus = UNKNOWN_ERROR; |
| 193 | } |
| 194 | } else { |
| 195 | if (record != 0) { |
| 196 | ALOGE("openRecord returned an IAudioRecord but with status %d", lStatus); |
| 197 | record.clear(); |
| 198 | } |
| 199 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 200 | } |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 201 | if (status) { |
| 202 | *status = lStatus; |
| 203 | } |
Eric Laurent | 5841db7 | 2009-09-09 05:16:08 -0700 | [diff] [blame] | 204 | return record; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 205 | } |
| 206 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 207 | virtual uint32_t sampleRate(audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 208 | { |
| 209 | Parcel data, reply; |
| 210 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 211 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 212 | remote()->transact(SAMPLE_RATE, data, &reply); |
| 213 | return reply.readInt32(); |
| 214 | } |
| 215 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 216 | virtual audio_format_t format(audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 217 | { |
| 218 | Parcel data, reply; |
| 219 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 220 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 221 | remote()->transact(FORMAT, data, &reply); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 222 | return (audio_format_t) reply.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 223 | } |
| 224 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 225 | virtual size_t frameCount(audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 226 | { |
| 227 | Parcel data, reply; |
| 228 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 229 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 230 | remote()->transact(FRAME_COUNT, data, &reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 231 | return reply.readInt64(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 232 | } |
| 233 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 234 | virtual uint32_t latency(audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 235 | { |
| 236 | Parcel data, reply; |
| 237 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 238 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 239 | remote()->transact(LATENCY, data, &reply); |
| 240 | return reply.readInt32(); |
| 241 | } |
| 242 | |
| 243 | virtual status_t setMasterVolume(float value) |
| 244 | { |
| 245 | Parcel data, reply; |
| 246 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 247 | data.writeFloat(value); |
| 248 | remote()->transact(SET_MASTER_VOLUME, data, &reply); |
| 249 | return reply.readInt32(); |
| 250 | } |
| 251 | |
| 252 | virtual status_t setMasterMute(bool muted) |
| 253 | { |
| 254 | Parcel data, reply; |
| 255 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 256 | data.writeInt32(muted); |
| 257 | remote()->transact(SET_MASTER_MUTE, data, &reply); |
| 258 | return reply.readInt32(); |
| 259 | } |
| 260 | |
| 261 | virtual float masterVolume() const |
| 262 | { |
| 263 | Parcel data, reply; |
| 264 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 265 | remote()->transact(MASTER_VOLUME, data, &reply); |
| 266 | return reply.readFloat(); |
| 267 | } |
| 268 | |
| 269 | virtual bool masterMute() const |
| 270 | { |
| 271 | Parcel data, reply; |
| 272 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 273 | remote()->transact(MASTER_MUTE, data, &reply); |
| 274 | return reply.readInt32(); |
| 275 | } |
| 276 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 277 | virtual status_t setStreamVolume(audio_stream_type_t stream, float value, |
| 278 | audio_io_handle_t output) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 279 | { |
| 280 | Parcel data, reply; |
| 281 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 282 | data.writeInt32((int32_t) stream); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 283 | data.writeFloat(value); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 284 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 285 | remote()->transact(SET_STREAM_VOLUME, data, &reply); |
| 286 | return reply.readInt32(); |
| 287 | } |
| 288 | |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 289 | virtual status_t setStreamMute(audio_stream_type_t stream, bool muted) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 290 | { |
| 291 | Parcel data, reply; |
| 292 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 293 | data.writeInt32((int32_t) stream); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 294 | data.writeInt32(muted); |
| 295 | remote()->transact(SET_STREAM_MUTE, data, &reply); |
| 296 | return reply.readInt32(); |
| 297 | } |
| 298 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 299 | virtual float streamVolume(audio_stream_type_t stream, audio_io_handle_t output) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 300 | { |
| 301 | Parcel data, reply; |
| 302 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 303 | data.writeInt32((int32_t) stream); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 304 | data.writeInt32((int32_t) output); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 305 | remote()->transact(STREAM_VOLUME, data, &reply); |
| 306 | return reply.readFloat(); |
| 307 | } |
| 308 | |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 309 | virtual bool streamMute(audio_stream_type_t stream) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 310 | { |
| 311 | Parcel data, reply; |
| 312 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 313 | data.writeInt32((int32_t) stream); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 314 | remote()->transact(STREAM_MUTE, data, &reply); |
| 315 | return reply.readInt32(); |
| 316 | } |
| 317 | |
Glenn Kasten | f78aee7 | 2012-01-04 11:00:47 -0800 | [diff] [blame] | 318 | virtual status_t setMode(audio_mode_t mode) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 319 | { |
| 320 | Parcel data, reply; |
| 321 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 322 | data.writeInt32(mode); |
| 323 | remote()->transact(SET_MODE, data, &reply); |
| 324 | return reply.readInt32(); |
| 325 | } |
| 326 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 327 | virtual status_t setMicMute(bool state) |
| 328 | { |
| 329 | Parcel data, reply; |
| 330 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 331 | data.writeInt32(state); |
| 332 | remote()->transact(SET_MIC_MUTE, data, &reply); |
| 333 | return reply.readInt32(); |
| 334 | } |
| 335 | |
| 336 | virtual bool getMicMute() const |
| 337 | { |
| 338 | Parcel data, reply; |
| 339 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 340 | remote()->transact(GET_MIC_MUTE, data, &reply); |
| 341 | return reply.readInt32(); |
| 342 | } |
| 343 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 344 | virtual status_t setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 345 | { |
| 346 | Parcel data, reply; |
| 347 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 348 | data.writeInt32((int32_t) ioHandle); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 349 | data.writeString8(keyValuePairs); |
| 350 | remote()->transact(SET_PARAMETERS, data, &reply); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 351 | return reply.readInt32(); |
| 352 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 353 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 354 | virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) const |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 355 | { |
| 356 | Parcel data, reply; |
| 357 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 358 | data.writeInt32((int32_t) ioHandle); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 359 | data.writeString8(keys); |
| 360 | remote()->transact(GET_PARAMETERS, data, &reply); |
| 361 | return reply.readString8(); |
| 362 | } |
| 363 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 364 | virtual void registerClient(const sp<IAudioFlingerClient>& client) |
| 365 | { |
| 366 | Parcel data, reply; |
| 367 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 368 | data.writeStrongBinder(client->asBinder()); |
| 369 | remote()->transact(REGISTER_CLIENT, data, &reply); |
| 370 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 371 | |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 372 | virtual size_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, |
| 373 | audio_channel_mask_t channelMask) const |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 374 | { |
| 375 | Parcel data, reply; |
| 376 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 377 | data.writeInt32(sampleRate); |
| 378 | data.writeInt32(format); |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 379 | data.writeInt32(channelMask); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 380 | remote()->transact(GET_INPUTBUFFERSIZE, data, &reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 381 | return reply.readInt64(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 382 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 383 | |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 384 | virtual audio_io_handle_t openOutput(audio_module_handle_t module, |
| 385 | audio_devices_t *pDevices, |
| 386 | uint32_t *pSamplingRate, |
| 387 | audio_format_t *pFormat, |
| 388 | audio_channel_mask_t *pChannelMask, |
| 389 | uint32_t *pLatencyMs, |
Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 390 | audio_output_flags_t flags, |
| 391 | const audio_offload_info_t *offloadInfo) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 392 | { |
| 393 | Parcel data, reply; |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 394 | audio_devices_t devices = pDevices != NULL ? *pDevices : (audio_devices_t)0; |
| 395 | uint32_t samplingRate = pSamplingRate != NULL ? *pSamplingRate : 0; |
| 396 | audio_format_t format = pFormat != NULL ? *pFormat : AUDIO_FORMAT_DEFAULT; |
| 397 | audio_channel_mask_t channelMask = pChannelMask != NULL ? |
| 398 | *pChannelMask : (audio_channel_mask_t)0; |
| 399 | uint32_t latency = pLatencyMs != NULL ? *pLatencyMs : 0; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 400 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 401 | data.writeInt32(module); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 402 | data.writeInt32(devices); |
| 403 | data.writeInt32(samplingRate); |
| 404 | data.writeInt32(format); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 405 | data.writeInt32(channelMask); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 406 | data.writeInt32(latency); |
Glenn Kasten | 18868c5 | 2012-03-07 09:15:37 -0800 | [diff] [blame] | 407 | data.writeInt32((int32_t) flags); |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 408 | if (offloadInfo == NULL) { |
| 409 | data.writeInt32(0); |
| 410 | } else { |
| 411 | data.writeInt32(1); |
| 412 | data.write(offloadInfo, sizeof(audio_offload_info_t)); |
| 413 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 414 | remote()->transact(OPEN_OUTPUT, data, &reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 415 | audio_io_handle_t output = (audio_io_handle_t) reply.readInt32(); |
| 416 | ALOGV("openOutput() returned output, %d", output); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 417 | devices = (audio_devices_t)reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 418 | if (pDevices != NULL) *pDevices = devices; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 419 | samplingRate = reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 420 | if (pSamplingRate != NULL) *pSamplingRate = samplingRate; |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 421 | format = (audio_format_t) reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 422 | if (pFormat != NULL) *pFormat = format; |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 423 | channelMask = (audio_channel_mask_t)reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 424 | if (pChannelMask != NULL) *pChannelMask = channelMask; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 425 | latency = reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 426 | if (pLatencyMs != NULL) *pLatencyMs = latency; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 427 | return output; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 428 | } |
| 429 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 430 | virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, |
| 431 | audio_io_handle_t output2) |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 432 | { |
| 433 | Parcel data, reply; |
| 434 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 435 | data.writeInt32((int32_t) output1); |
| 436 | data.writeInt32((int32_t) output2); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 437 | remote()->transact(OPEN_DUPLICATE_OUTPUT, data, &reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 438 | return (audio_io_handle_t) reply.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 439 | } |
| 440 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 441 | virtual status_t closeOutput(audio_io_handle_t output) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 442 | { |
| 443 | Parcel data, reply; |
| 444 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 445 | data.writeInt32((int32_t) output); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 446 | remote()->transact(CLOSE_OUTPUT, data, &reply); |
| 447 | return reply.readInt32(); |
| 448 | } |
| 449 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 450 | virtual status_t suspendOutput(audio_io_handle_t output) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 451 | { |
| 452 | Parcel data, reply; |
| 453 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 454 | data.writeInt32((int32_t) output); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 455 | remote()->transact(SUSPEND_OUTPUT, data, &reply); |
| 456 | return reply.readInt32(); |
| 457 | } |
| 458 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 459 | virtual status_t restoreOutput(audio_io_handle_t output) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 460 | { |
| 461 | Parcel data, reply; |
| 462 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 463 | data.writeInt32((int32_t) output); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 464 | remote()->transact(RESTORE_OUTPUT, data, &reply); |
| 465 | return reply.readInt32(); |
| 466 | } |
| 467 | |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 468 | virtual audio_io_handle_t openInput(audio_module_handle_t module, |
| 469 | audio_devices_t *pDevices, |
| 470 | uint32_t *pSamplingRate, |
| 471 | audio_format_t *pFormat, |
| 472 | audio_channel_mask_t *pChannelMask) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 473 | { |
| 474 | Parcel data, reply; |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 475 | audio_devices_t devices = pDevices != NULL ? *pDevices : (audio_devices_t)0; |
| 476 | uint32_t samplingRate = pSamplingRate != NULL ? *pSamplingRate : 0; |
| 477 | audio_format_t format = pFormat != NULL ? *pFormat : AUDIO_FORMAT_DEFAULT; |
| 478 | audio_channel_mask_t channelMask = pChannelMask != NULL ? |
| 479 | *pChannelMask : (audio_channel_mask_t)0; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 480 | |
| 481 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 482 | data.writeInt32(module); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 483 | data.writeInt32(devices); |
| 484 | data.writeInt32(samplingRate); |
| 485 | data.writeInt32(format); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 486 | data.writeInt32(channelMask); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 487 | remote()->transact(OPEN_INPUT, data, &reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 488 | audio_io_handle_t input = (audio_io_handle_t) reply.readInt32(); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 489 | devices = (audio_devices_t)reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 490 | if (pDevices != NULL) *pDevices = devices; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 491 | samplingRate = reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 492 | if (pSamplingRate != NULL) *pSamplingRate = samplingRate; |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 493 | format = (audio_format_t) reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 494 | if (pFormat != NULL) *pFormat = format; |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 495 | channelMask = (audio_channel_mask_t)reply.readInt32(); |
Glenn Kasten | 7c5977f | 2013-07-02 14:17:22 -0700 | [diff] [blame] | 496 | if (pChannelMask != NULL) *pChannelMask = channelMask; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 497 | return input; |
| 498 | } |
| 499 | |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 500 | virtual status_t closeInput(int input) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 501 | { |
| 502 | Parcel data, reply; |
| 503 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 504 | data.writeInt32(input); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 505 | remote()->transact(CLOSE_INPUT, data, &reply); |
| 506 | return reply.readInt32(); |
| 507 | } |
| 508 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 509 | virtual status_t setStreamOutput(audio_stream_type_t stream, audio_io_handle_t output) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 510 | { |
| 511 | Parcel data, reply; |
| 512 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 513 | data.writeInt32((int32_t) stream); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 514 | data.writeInt32((int32_t) output); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 515 | remote()->transact(SET_STREAM_OUTPUT, data, &reply); |
| 516 | return reply.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 517 | } |
Eric Laurent | f0ee6f4 | 2009-10-21 08:14:22 -0700 | [diff] [blame] | 518 | |
| 519 | virtual status_t setVoiceVolume(float volume) |
| 520 | { |
| 521 | Parcel data, reply; |
| 522 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 523 | data.writeFloat(volume); |
| 524 | remote()->transact(SET_VOICE_VOLUME, data, &reply); |
| 525 | return reply.readInt32(); |
| 526 | } |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 527 | |
Kévin PETIT | 377b2ec | 2014-02-03 12:35:36 +0000 | [diff] [blame] | 528 | virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 529 | audio_io_handle_t output) const |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 530 | { |
| 531 | Parcel data, reply; |
| 532 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 533 | data.writeInt32((int32_t) output); |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 534 | remote()->transact(GET_RENDER_POSITION, data, &reply); |
| 535 | status_t status = reply.readInt32(); |
| 536 | if (status == NO_ERROR) { |
| 537 | uint32_t tmp = reply.readInt32(); |
| 538 | if (halFrames) { |
| 539 | *halFrames = tmp; |
| 540 | } |
| 541 | tmp = reply.readInt32(); |
| 542 | if (dspFrames) { |
| 543 | *dspFrames = tmp; |
| 544 | } |
| 545 | } |
| 546 | return status; |
| 547 | } |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 548 | |
Kévin PETIT | 377b2ec | 2014-02-03 12:35:36 +0000 | [diff] [blame] | 549 | virtual uint32_t getInputFramesLost(audio_io_handle_t ioHandle) const |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 550 | { |
| 551 | Parcel data, reply; |
| 552 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 553 | data.writeInt32((int32_t) ioHandle); |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 554 | remote()->transact(GET_INPUT_FRAMES_LOST, data, &reply); |
| 555 | return reply.readInt32(); |
| 556 | } |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 557 | |
| 558 | virtual int newAudioSessionId() |
| 559 | { |
| 560 | Parcel data, reply; |
| 561 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 562 | status_t status = remote()->transact(NEW_AUDIO_SESSION_ID, data, &reply); |
| 563 | int id = 0; |
| 564 | if (status == NO_ERROR) { |
| 565 | id = reply.readInt32(); |
| 566 | } |
| 567 | return id; |
| 568 | } |
| 569 | |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 570 | virtual void acquireAudioSessionId(int audioSession) |
| 571 | { |
| 572 | Parcel data, reply; |
| 573 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 574 | data.writeInt32(audioSession); |
| 575 | remote()->transact(ACQUIRE_AUDIO_SESSION_ID, data, &reply); |
| 576 | } |
| 577 | |
| 578 | virtual void releaseAudioSessionId(int audioSession) |
| 579 | { |
| 580 | Parcel data, reply; |
| 581 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 582 | data.writeInt32(audioSession); |
| 583 | remote()->transact(RELEASE_AUDIO_SESSION_ID, data, &reply); |
| 584 | } |
| 585 | |
Glenn Kasten | f587ba5 | 2012-01-26 16:25:10 -0800 | [diff] [blame] | 586 | virtual status_t queryNumberEffects(uint32_t *numEffects) const |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 587 | { |
| 588 | Parcel data, reply; |
| 589 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 590 | status_t status = remote()->transact(QUERY_NUM_EFFECTS, data, &reply); |
| 591 | if (status != NO_ERROR) { |
| 592 | return status; |
| 593 | } |
| 594 | status = reply.readInt32(); |
| 595 | if (status != NO_ERROR) { |
| 596 | return status; |
| 597 | } |
Glenn Kasten | 9d1f02d | 2012-02-08 17:47:58 -0800 | [diff] [blame] | 598 | if (numEffects != NULL) { |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 599 | *numEffects = (uint32_t)reply.readInt32(); |
| 600 | } |
| 601 | return NO_ERROR; |
| 602 | } |
| 603 | |
Glenn Kasten | f587ba5 | 2012-01-26 16:25:10 -0800 | [diff] [blame] | 604 | virtual status_t queryEffect(uint32_t index, effect_descriptor_t *pDescriptor) const |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 605 | { |
| 606 | if (pDescriptor == NULL) { |
| 607 | return BAD_VALUE; |
| 608 | } |
| 609 | Parcel data, reply; |
| 610 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 611 | data.writeInt32(index); |
| 612 | status_t status = remote()->transact(QUERY_EFFECT, data, &reply); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 613 | if (status != NO_ERROR) { |
| 614 | return status; |
| 615 | } |
| 616 | status = reply.readInt32(); |
| 617 | if (status != NO_ERROR) { |
| 618 | return status; |
| 619 | } |
| 620 | reply.read(pDescriptor, sizeof(effect_descriptor_t)); |
| 621 | return NO_ERROR; |
| 622 | } |
| 623 | |
Glenn Kasten | 5e92a78 | 2012-01-30 07:40:52 -0800 | [diff] [blame] | 624 | virtual status_t getEffectDescriptor(const effect_uuid_t *pUuid, |
Glenn Kasten | f587ba5 | 2012-01-26 16:25:10 -0800 | [diff] [blame] | 625 | effect_descriptor_t *pDescriptor) const |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 626 | { |
| 627 | if (pUuid == NULL || pDescriptor == NULL) { |
| 628 | return BAD_VALUE; |
| 629 | } |
| 630 | Parcel data, reply; |
| 631 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 632 | data.write(pUuid, sizeof(effect_uuid_t)); |
| 633 | status_t status = remote()->transact(GET_EFFECT_DESCRIPTOR, data, &reply); |
| 634 | if (status != NO_ERROR) { |
| 635 | return status; |
| 636 | } |
| 637 | status = reply.readInt32(); |
| 638 | if (status != NO_ERROR) { |
| 639 | return status; |
| 640 | } |
| 641 | reply.read(pDescriptor, sizeof(effect_descriptor_t)); |
| 642 | return NO_ERROR; |
| 643 | } |
| 644 | |
Glenn Kasten | 8d6cc84 | 2012-02-03 11:06:53 -0800 | [diff] [blame] | 645 | virtual sp<IEffect> createEffect( |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 646 | effect_descriptor_t *pDesc, |
| 647 | const sp<IEffectClient>& client, |
| 648 | int32_t priority, |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 649 | audio_io_handle_t output, |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 650 | int sessionId, |
| 651 | status_t *status, |
| 652 | int *id, |
| 653 | int *enabled) |
| 654 | { |
| 655 | Parcel data, reply; |
| 656 | sp<IEffect> effect; |
| 657 | |
| 658 | if (pDesc == NULL) { |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 659 | return effect; |
| 660 | if (status) { |
| 661 | *status = BAD_VALUE; |
| 662 | } |
| 663 | } |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 664 | |
| 665 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 666 | data.write(pDesc, sizeof(effect_descriptor_t)); |
| 667 | data.writeStrongBinder(client->asBinder()); |
| 668 | data.writeInt32(priority); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 669 | data.writeInt32((int32_t) output); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 670 | data.writeInt32(sessionId); |
| 671 | |
| 672 | status_t lStatus = remote()->transact(CREATE_EFFECT, data, &reply); |
| 673 | if (lStatus != NO_ERROR) { |
Steve Block | 29357bc | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 674 | ALOGE("createEffect error: %s", strerror(-lStatus)); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 675 | } else { |
| 676 | lStatus = reply.readInt32(); |
| 677 | int tmp = reply.readInt32(); |
| 678 | if (id) { |
| 679 | *id = tmp; |
| 680 | } |
| 681 | tmp = reply.readInt32(); |
Glenn Kasten | a0d6833 | 2012-01-27 16:47:15 -0800 | [diff] [blame] | 682 | if (enabled != NULL) { |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 683 | *enabled = tmp; |
| 684 | } |
| 685 | effect = interface_cast<IEffect>(reply.readStrongBinder()); |
| 686 | reply.read(pDesc, sizeof(effect_descriptor_t)); |
| 687 | } |
| 688 | if (status) { |
| 689 | *status = lStatus; |
| 690 | } |
| 691 | |
| 692 | return effect; |
| 693 | } |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 694 | |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 695 | virtual status_t moveEffects(int session, audio_io_handle_t srcOutput, |
| 696 | audio_io_handle_t dstOutput) |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 697 | { |
| 698 | Parcel data, reply; |
| 699 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 700 | data.writeInt32(session); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 701 | data.writeInt32((int32_t) srcOutput); |
| 702 | data.writeInt32((int32_t) dstOutput); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 703 | remote()->transact(MOVE_EFFECTS, data, &reply); |
| 704 | return reply.readInt32(); |
| 705 | } |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 706 | |
| 707 | virtual audio_module_handle_t loadHwModule(const char *name) |
| 708 | { |
| 709 | Parcel data, reply; |
| 710 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 711 | data.writeCString(name); |
| 712 | remote()->transact(LOAD_HW_MODULE, data, &reply); |
| 713 | return (audio_module_handle_t) reply.readInt32(); |
| 714 | } |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 715 | |
Glenn Kasten | 3b16c76 | 2012-11-14 08:44:39 -0800 | [diff] [blame] | 716 | virtual uint32_t getPrimaryOutputSamplingRate() |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 717 | { |
| 718 | Parcel data, reply; |
| 719 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 720 | remote()->transact(GET_PRIMARY_OUTPUT_SAMPLING_RATE, data, &reply); |
| 721 | return reply.readInt32(); |
| 722 | } |
| 723 | |
Glenn Kasten | e33054e | 2012-11-14 12:54:39 -0800 | [diff] [blame] | 724 | virtual size_t getPrimaryOutputFrameCount() |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 725 | { |
| 726 | Parcel data, reply; |
| 727 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 728 | remote()->transact(GET_PRIMARY_OUTPUT_FRAME_COUNT, data, &reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 729 | return reply.readInt64(); |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 730 | } |
| 731 | |
Glenn Kasten | 4182c4e | 2013-07-15 14:45:07 -0700 | [diff] [blame] | 732 | virtual status_t setLowRamDevice(bool isLowRamDevice) |
| 733 | { |
| 734 | Parcel data, reply; |
| 735 | data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); |
| 736 | data.writeInt32((int) isLowRamDevice); |
| 737 | remote()->transact(SET_LOW_RAM_DEVICE, data, &reply); |
| 738 | return reply.readInt32(); |
| 739 | } |
| 740 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 741 | }; |
| 742 | |
| 743 | IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger"); |
| 744 | |
| 745 | // ---------------------------------------------------------------------- |
| 746 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 747 | status_t BnAudioFlinger::onTransact( |
| 748 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
| 749 | { |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 750 | switch (code) { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 751 | case CREATE_TRACK: { |
| 752 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 753 | int streamType = data.readInt32(); |
| 754 | uint32_t sampleRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 755 | audio_format_t format = (audio_format_t) data.readInt32(); |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 756 | audio_channel_mask_t channelMask = data.readInt32(); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 757 | size_t frameCount = data.readInt64(); |
Glenn Kasten | a075db4 | 2012-03-06 11:22:44 -0800 | [diff] [blame] | 758 | track_flags_t flags = (track_flags_t) data.readInt32(); |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 759 | bool haveSharedBuffer = data.readInt32() != 0; |
| 760 | sp<IMemory> buffer; |
| 761 | if (haveSharedBuffer) { |
| 762 | buffer = interface_cast<IMemory>(data.readStrongBinder()); |
| 763 | } |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 764 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Glenn Kasten | 3acbd05 | 2012-02-28 10:39:56 -0800 | [diff] [blame] | 765 | pid_t tid = (pid_t) data.readInt32(); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 766 | int sessionId = data.readInt32(); |
Marco Nelissen | 9cae217 | 2013-01-14 14:12:05 -0800 | [diff] [blame] | 767 | int clientUid = data.readInt32(); |
Glenn Kasten | d054c32 | 2013-07-12 12:59:20 -0700 | [diff] [blame] | 768 | String8 name; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 769 | status_t status; |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 770 | sp<IAudioTrack> track; |
| 771 | if ((haveSharedBuffer && (buffer == 0)) || |
| 772 | ((buffer != 0) && (buffer->pointer() == NULL))) { |
| 773 | ALOGW("CREATE_TRACK: cannot retrieve shared memory"); |
| 774 | status = DEAD_OBJECT; |
| 775 | } else { |
| 776 | track = createTrack( |
| 777 | (audio_stream_type_t) streamType, sampleRate, format, |
| 778 | channelMask, frameCount, &flags, buffer, output, tid, |
Marco Nelissen | 9cae217 | 2013-01-14 14:12:05 -0800 | [diff] [blame] | 779 | &sessionId, name, clientUid, &status); |
Eric Laurent | 3d00aa6 | 2013-09-24 09:53:27 -0700 | [diff] [blame] | 780 | } |
Glenn Kasten | e0b0717 | 2012-11-06 15:03:34 -0800 | [diff] [blame] | 781 | reply->writeInt32(flags); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 782 | reply->writeInt32(sessionId); |
Glenn Kasten | d054c32 | 2013-07-12 12:59:20 -0700 | [diff] [blame] | 783 | reply->writeString8(name); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 784 | reply->writeInt32(status); |
| 785 | reply->writeStrongBinder(track->asBinder()); |
| 786 | return NO_ERROR; |
| 787 | } break; |
| 788 | case OPEN_RECORD: { |
| 789 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 790 | audio_io_handle_t input = (audio_io_handle_t) data.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 791 | uint32_t sampleRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 792 | audio_format_t format = (audio_format_t) data.readInt32(); |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 793 | audio_channel_mask_t channelMask = data.readInt32(); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 794 | size_t frameCount = data.readInt64(); |
Glenn Kasten | a075db4 | 2012-03-06 11:22:44 -0800 | [diff] [blame] | 795 | track_flags_t flags = (track_flags_t) data.readInt32(); |
Glenn Kasten | 1879fff | 2012-07-11 15:36:59 -0700 | [diff] [blame] | 796 | pid_t tid = (pid_t) data.readInt32(); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 797 | int sessionId = data.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 798 | status_t status; |
Glenn Kasten | 8d6cc84 | 2012-02-03 11:06:53 -0800 | [diff] [blame] | 799 | sp<IAudioRecord> record = openRecord(input, |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 800 | sampleRate, format, channelMask, frameCount, &flags, tid, &sessionId, &status); |
Glenn Kasten | e93cf2c | 2013-09-24 11:52:37 -0700 | [diff] [blame] | 801 | LOG_ALWAYS_FATAL_IF((record != 0) != (status == NO_ERROR)); |
Glenn Kasten | eeca326 | 2013-07-31 16:12:48 -0700 | [diff] [blame] | 802 | reply->writeInt32(flags); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 803 | reply->writeInt32(sessionId); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 804 | reply->writeInt32(status); |
| 805 | reply->writeStrongBinder(record->asBinder()); |
| 806 | return NO_ERROR; |
| 807 | } break; |
| 808 | case SAMPLE_RATE: { |
| 809 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 810 | reply->writeInt32( sampleRate((audio_io_handle_t) data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 811 | return NO_ERROR; |
| 812 | } break; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 813 | case FORMAT: { |
| 814 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 815 | reply->writeInt32( format((audio_io_handle_t) data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 816 | return NO_ERROR; |
| 817 | } break; |
| 818 | case FRAME_COUNT: { |
| 819 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 820 | reply->writeInt64( frameCount((audio_io_handle_t) data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 821 | return NO_ERROR; |
| 822 | } break; |
| 823 | case LATENCY: { |
| 824 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 825 | reply->writeInt32( latency((audio_io_handle_t) data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 826 | return NO_ERROR; |
| 827 | } break; |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 828 | case SET_MASTER_VOLUME: { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 829 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 830 | reply->writeInt32( setMasterVolume(data.readFloat()) ); |
| 831 | return NO_ERROR; |
| 832 | } break; |
| 833 | case SET_MASTER_MUTE: { |
| 834 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 835 | reply->writeInt32( setMasterMute(data.readInt32()) ); |
| 836 | return NO_ERROR; |
| 837 | } break; |
| 838 | case MASTER_VOLUME: { |
| 839 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 840 | reply->writeFloat( masterVolume() ); |
| 841 | return NO_ERROR; |
| 842 | } break; |
| 843 | case MASTER_MUTE: { |
| 844 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 845 | reply->writeInt32( masterMute() ); |
| 846 | return NO_ERROR; |
| 847 | } break; |
| 848 | case SET_STREAM_VOLUME: { |
| 849 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 850 | int stream = data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 851 | float volume = data.readFloat(); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 852 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 853 | reply->writeInt32( setStreamVolume((audio_stream_type_t) stream, volume, output) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 854 | return NO_ERROR; |
| 855 | } break; |
| 856 | case SET_STREAM_MUTE: { |
| 857 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 858 | int stream = data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 859 | reply->writeInt32( setStreamMute((audio_stream_type_t) stream, data.readInt32()) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 860 | return NO_ERROR; |
| 861 | } break; |
| 862 | case STREAM_VOLUME: { |
| 863 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 864 | int stream = data.readInt32(); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 865 | int output = data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 866 | reply->writeFloat( streamVolume((audio_stream_type_t) stream, output) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 867 | return NO_ERROR; |
| 868 | } break; |
| 869 | case STREAM_MUTE: { |
| 870 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 871 | int stream = data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 872 | reply->writeInt32( streamMute((audio_stream_type_t) stream) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 873 | return NO_ERROR; |
| 874 | } break; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 875 | case SET_MODE: { |
| 876 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | f78aee7 | 2012-01-04 11:00:47 -0800 | [diff] [blame] | 877 | audio_mode_t mode = (audio_mode_t) data.readInt32(); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 878 | reply->writeInt32( setMode(mode) ); |
| 879 | return NO_ERROR; |
| 880 | } break; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 881 | case SET_MIC_MUTE: { |
| 882 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 883 | int state = data.readInt32(); |
| 884 | reply->writeInt32( setMicMute(state) ); |
| 885 | return NO_ERROR; |
| 886 | } break; |
| 887 | case GET_MIC_MUTE: { |
| 888 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 889 | reply->writeInt32( getMicMute() ); |
| 890 | return NO_ERROR; |
| 891 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 892 | case SET_PARAMETERS: { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 893 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 894 | audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 895 | String8 keyValuePairs(data.readString8()); |
| 896 | reply->writeInt32(setParameters(ioHandle, keyValuePairs)); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 897 | return NO_ERROR; |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 898 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 899 | case GET_PARAMETERS: { |
| 900 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 901 | audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 902 | String8 keys(data.readString8()); |
| 903 | reply->writeString8(getParameters(ioHandle, keys)); |
| 904 | return NO_ERROR; |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 905 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 906 | |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 907 | case REGISTER_CLIENT: { |
| 908 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 909 | sp<IAudioFlingerClient> client = interface_cast<IAudioFlingerClient>( |
| 910 | data.readStrongBinder()); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 911 | registerClient(client); |
| 912 | return NO_ERROR; |
| 913 | } break; |
| 914 | case GET_INPUTBUFFERSIZE: { |
| 915 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 916 | uint32_t sampleRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 917 | audio_format_t format = (audio_format_t) data.readInt32(); |
Glenn Kasten | dd8104c | 2012-07-02 12:42:44 -0700 | [diff] [blame] | 918 | audio_channel_mask_t channelMask = data.readInt32(); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 919 | reply->writeInt64( getInputBufferSize(sampleRate, format, channelMask) ); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 920 | return NO_ERROR; |
| 921 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 922 | case OPEN_OUTPUT: { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 923 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 924 | audio_module_handle_t module = (audio_module_handle_t)data.readInt32(); |
| 925 | audio_devices_t devices = (audio_devices_t)data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 926 | uint32_t samplingRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 927 | audio_format_t format = (audio_format_t) data.readInt32(); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 928 | audio_channel_mask_t channelMask = (audio_channel_mask_t)data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 929 | uint32_t latency = data.readInt32(); |
Eric Laurent | 0ca3cf9 | 2012-04-18 09:24:29 -0700 | [diff] [blame] | 930 | audio_output_flags_t flags = (audio_output_flags_t) data.readInt32(); |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 931 | bool hasOffloadInfo = data.readInt32() != 0; |
| 932 | audio_offload_info_t offloadInfo; |
| 933 | if (hasOffloadInfo) { |
| 934 | data.read(&offloadInfo, sizeof(audio_offload_info_t)); |
| 935 | } |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 936 | audio_io_handle_t output = openOutput(module, |
| 937 | &devices, |
| 938 | &samplingRate, |
| 939 | &format, |
| 940 | &channelMask, |
| 941 | &latency, |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 942 | flags, |
| 943 | hasOffloadInfo ? &offloadInfo : NULL); |
Steve Block | 3856b09 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 944 | ALOGV("OPEN_OUTPUT output, %p", output); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 945 | reply->writeInt32((int32_t) output); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 946 | reply->writeInt32(devices); |
| 947 | reply->writeInt32(samplingRate); |
| 948 | reply->writeInt32(format); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 949 | reply->writeInt32(channelMask); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 950 | reply->writeInt32(latency); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 951 | return NO_ERROR; |
| 952 | } break; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 953 | case OPEN_DUPLICATE_OUTPUT: { |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 954 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 955 | audio_io_handle_t output1 = (audio_io_handle_t) data.readInt32(); |
| 956 | audio_io_handle_t output2 = (audio_io_handle_t) data.readInt32(); |
| 957 | reply->writeInt32((int32_t) openDuplicateOutput(output1, output2)); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 958 | return NO_ERROR; |
| 959 | } break; |
| 960 | case CLOSE_OUTPUT: { |
| 961 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 962 | reply->writeInt32(closeOutput((audio_io_handle_t) data.readInt32())); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 963 | return NO_ERROR; |
| 964 | } break; |
| 965 | case SUSPEND_OUTPUT: { |
| 966 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 967 | reply->writeInt32(suspendOutput((audio_io_handle_t) data.readInt32())); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 968 | return NO_ERROR; |
| 969 | } break; |
| 970 | case RESTORE_OUTPUT: { |
| 971 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 972 | reply->writeInt32(restoreOutput((audio_io_handle_t) data.readInt32())); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 973 | return NO_ERROR; |
| 974 | } break; |
| 975 | case OPEN_INPUT: { |
| 976 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 977 | audio_module_handle_t module = (audio_module_handle_t)data.readInt32(); |
| 978 | audio_devices_t devices = (audio_devices_t)data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 979 | uint32_t samplingRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 980 | audio_format_t format = (audio_format_t) data.readInt32(); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 981 | audio_channel_mask_t channelMask = (audio_channel_mask_t)data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 982 | |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 983 | audio_io_handle_t input = openInput(module, |
| 984 | &devices, |
| 985 | &samplingRate, |
| 986 | &format, |
| 987 | &channelMask); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 988 | reply->writeInt32((int32_t) input); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 989 | reply->writeInt32(devices); |
| 990 | reply->writeInt32(samplingRate); |
| 991 | reply->writeInt32(format); |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 992 | reply->writeInt32(channelMask); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 993 | return NO_ERROR; |
| 994 | } break; |
| 995 | case CLOSE_INPUT: { |
| 996 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 997 | reply->writeInt32(closeInput((audio_io_handle_t) data.readInt32())); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 998 | return NO_ERROR; |
| 999 | } break; |
| 1000 | case SET_STREAM_OUTPUT: { |
| 1001 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1002 | uint32_t stream = data.readInt32(); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1003 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 1004 | reply->writeInt32(setStreamOutput((audio_stream_type_t) stream, output)); |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1005 | return NO_ERROR; |
| 1006 | } break; |
Eric Laurent | f0ee6f4 | 2009-10-21 08:14:22 -0700 | [diff] [blame] | 1007 | case SET_VOICE_VOLUME: { |
| 1008 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1009 | float volume = data.readFloat(); |
| 1010 | reply->writeInt32( setVoiceVolume(volume) ); |
| 1011 | return NO_ERROR; |
| 1012 | } break; |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 1013 | case GET_RENDER_POSITION: { |
| 1014 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1015 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Kévin PETIT | 377b2ec | 2014-02-03 12:35:36 +0000 | [diff] [blame] | 1016 | uint32_t halFrames; |
| 1017 | uint32_t dspFrames; |
Eric Laurent | 342e9cf | 2010-01-19 17:37:09 -0800 | [diff] [blame] | 1018 | status_t status = getRenderPosition(&halFrames, &dspFrames, output); |
| 1019 | reply->writeInt32(status); |
| 1020 | if (status == NO_ERROR) { |
| 1021 | reply->writeInt32(halFrames); |
| 1022 | reply->writeInt32(dspFrames); |
| 1023 | } |
| 1024 | return NO_ERROR; |
| 1025 | } |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 1026 | case GET_INPUT_FRAMES_LOST: { |
| 1027 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1028 | audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 1029 | reply->writeInt32(getInputFramesLost(ioHandle)); |
| 1030 | return NO_ERROR; |
| 1031 | } break; |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1032 | case NEW_AUDIO_SESSION_ID: { |
| 1033 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1034 | reply->writeInt32(newAudioSessionId()); |
| 1035 | return NO_ERROR; |
| 1036 | } break; |
Marco Nelissen | 3a34bef | 2011-08-02 13:33:41 -0700 | [diff] [blame] | 1037 | case ACQUIRE_AUDIO_SESSION_ID: { |
| 1038 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1039 | int audioSession = data.readInt32(); |
| 1040 | acquireAudioSessionId(audioSession); |
| 1041 | return NO_ERROR; |
| 1042 | } break; |
| 1043 | case RELEASE_AUDIO_SESSION_ID: { |
| 1044 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1045 | int audioSession = data.readInt32(); |
| 1046 | releaseAudioSessionId(audioSession); |
| 1047 | return NO_ERROR; |
| 1048 | } break; |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1049 | case QUERY_NUM_EFFECTS: { |
| 1050 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1051 | uint32_t numEffects; |
| 1052 | status_t status = queryNumberEffects(&numEffects); |
| 1053 | reply->writeInt32(status); |
| 1054 | if (status == NO_ERROR) { |
| 1055 | reply->writeInt32((int32_t)numEffects); |
| 1056 | } |
| 1057 | return NO_ERROR; |
| 1058 | } |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 1059 | case QUERY_EFFECT: { |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1060 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1061 | effect_descriptor_t desc; |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 1062 | status_t status = queryEffect(data.readInt32(), &desc); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1063 | reply->writeInt32(status); |
| 1064 | if (status == NO_ERROR) { |
| 1065 | reply->write(&desc, sizeof(effect_descriptor_t)); |
| 1066 | } |
| 1067 | return NO_ERROR; |
| 1068 | } |
| 1069 | case GET_EFFECT_DESCRIPTOR: { |
| 1070 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1071 | effect_uuid_t uuid; |
| 1072 | data.read(&uuid, sizeof(effect_uuid_t)); |
| 1073 | effect_descriptor_t desc; |
| 1074 | status_t status = getEffectDescriptor(&uuid, &desc); |
| 1075 | reply->writeInt32(status); |
| 1076 | if (status == NO_ERROR) { |
| 1077 | reply->write(&desc, sizeof(effect_descriptor_t)); |
| 1078 | } |
| 1079 | return NO_ERROR; |
| 1080 | } |
| 1081 | case CREATE_EFFECT: { |
| 1082 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1083 | effect_descriptor_t desc; |
| 1084 | data.read(&desc, sizeof(effect_descriptor_t)); |
| 1085 | sp<IEffectClient> client = interface_cast<IEffectClient>(data.readStrongBinder()); |
| 1086 | int32_t priority = data.readInt32(); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1087 | audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1088 | int sessionId = data.readInt32(); |
| 1089 | status_t status; |
| 1090 | int id; |
| 1091 | int enabled; |
Eric Laurent | 05bca2f | 2010-02-26 02:47:27 -0800 | [diff] [blame] | 1092 | |
Glenn Kasten | 8d6cc84 | 2012-02-03 11:06:53 -0800 | [diff] [blame] | 1093 | sp<IEffect> effect = createEffect(&desc, client, priority, output, sessionId, |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 1094 | &status, &id, &enabled); |
Eric Laurent | be916aa | 2010-06-01 23:49:17 -0700 | [diff] [blame] | 1095 | reply->writeInt32(status); |
| 1096 | reply->writeInt32(id); |
| 1097 | reply->writeInt32(enabled); |
| 1098 | reply->writeStrongBinder(effect->asBinder()); |
| 1099 | reply->write(&desc, sizeof(effect_descriptor_t)); |
| 1100 | return NO_ERROR; |
| 1101 | } break; |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1102 | case MOVE_EFFECTS: { |
| 1103 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1104 | int session = data.readInt32(); |
Glenn Kasten | 72ef00d | 2012-01-17 11:09:42 -0800 | [diff] [blame] | 1105 | audio_io_handle_t srcOutput = (audio_io_handle_t) data.readInt32(); |
| 1106 | audio_io_handle_t dstOutput = (audio_io_handle_t) data.readInt32(); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1107 | reply->writeInt32(moveEffects(session, srcOutput, dstOutput)); |
| 1108 | return NO_ERROR; |
| 1109 | } break; |
Eric Laurent | a4c5a55 | 2012-03-29 10:12:40 -0700 | [diff] [blame] | 1110 | case LOAD_HW_MODULE: { |
| 1111 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1112 | reply->writeInt32(loadHwModule(data.readCString())); |
| 1113 | return NO_ERROR; |
| 1114 | } break; |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 1115 | case GET_PRIMARY_OUTPUT_SAMPLING_RATE: { |
| 1116 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1117 | reply->writeInt32(getPrimaryOutputSamplingRate()); |
| 1118 | return NO_ERROR; |
| 1119 | } break; |
| 1120 | case GET_PRIMARY_OUTPUT_FRAME_COUNT: { |
| 1121 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
Glenn Kasten | e03dd22 | 2014-01-28 11:04:39 -0800 | [diff] [blame^] | 1122 | reply->writeInt64(getPrimaryOutputFrameCount()); |
Glenn Kasten | cc0f1cf | 2012-09-24 11:27:18 -0700 | [diff] [blame] | 1123 | return NO_ERROR; |
| 1124 | } break; |
Glenn Kasten | 4182c4e | 2013-07-15 14:45:07 -0700 | [diff] [blame] | 1125 | case SET_LOW_RAM_DEVICE: { |
| 1126 | CHECK_INTERFACE(IAudioFlinger, data, reply); |
| 1127 | bool isLowRamDevice = data.readInt32() != 0; |
| 1128 | reply->writeInt32(setLowRamDevice(isLowRamDevice)); |
| 1129 | return NO_ERROR; |
| 1130 | } break; |
The Android Open Source Project | 89fa4ad | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1131 | default: |
| 1132 | return BBinder::onTransact(code, data, reply, flags); |
| 1133 | } |
| 1134 | } |
| 1135 | |
| 1136 | // ---------------------------------------------------------------------------- |
| 1137 | |
| 1138 | }; // namespace android |