diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:43 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:43 -0800 |
commit | f013e1afd1e68af5e3b868c26a653bbfb39538f8 (patch) | |
tree | 7ad6c8fd9c7b55f4b4017171dec1cb760bbd26bf /media/libmedia/IAudioFlinger.cpp | |
parent | e70cfafe580c6f2994c4827cd8a534aabf3eb05c (diff) | |
download | frameworks_base-f013e1afd1e68af5e3b868c26a653bbfb39538f8.zip frameworks_base-f013e1afd1e68af5e3b868c26a653bbfb39538f8.tar.gz frameworks_base-f013e1afd1e68af5e3b868c26a653bbfb39538f8.tar.bz2 |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'media/libmedia/IAudioFlinger.cpp')
-rw-r--r-- | media/libmedia/IAudioFlinger.cpp | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index 474381b..018ea6c 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -2,16 +2,16 @@ ** ** Copyright 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 +** 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 +** 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 +** 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. */ @@ -34,6 +34,7 @@ enum { CHANNEL_COUNT, FORMAT, FRAME_COUNT, + LATENCY, SET_MASTER_VOLUME, SET_MASTER_MUTE, MASTER_VOLUME, @@ -66,8 +67,10 @@ public: uint32_t sampleRate, int format, int channelCount, - int bufferCount, - uint32_t flags) + int frameCount, + uint32_t flags, + const sp<IMemory>& sharedBuffer, + status_t *status) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); @@ -76,13 +79,17 @@ public: data.writeInt32(sampleRate); data.writeInt32(format); data.writeInt32(channelCount); - data.writeInt32(bufferCount); + data.writeInt32(frameCount); data.writeInt32(flags); - status_t status = remote()->transact(CREATE_TRACK, data, &reply); - if ( status != NO_ERROR) { - LOGE("createTrack error: %s", strerror(-status)); + data.writeStrongBinder(sharedBuffer->asBinder()); + status_t lStatus = remote()->transact(CREATE_TRACK, data, &reply); + if (lStatus != NO_ERROR) { + LOGE("createTrack error: %s", strerror(-lStatus)); + } + lStatus = reply.readInt32(); + if (status) { + *status = lStatus; } - return interface_cast<IAudioTrack>(reply.readStrongBinder()); } @@ -92,8 +99,9 @@ public: uint32_t sampleRate, int format, int channelCount, - int bufferCount, - uint32_t flags) + int frameCount, + uint32_t flags, + status_t *status) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); @@ -102,9 +110,13 @@ public: data.writeInt32(sampleRate); data.writeInt32(format); data.writeInt32(channelCount); - data.writeInt32(bufferCount); + data.writeInt32(frameCount); data.writeInt32(flags); remote()->transact(OPEN_RECORD, data, &reply); + status_t lStatus = reply.readInt32(); + if (status) { + *status = lStatus; + } return interface_cast<IAudioRecord>(reply.readStrongBinder()); } @@ -140,6 +152,14 @@ public: return reply.readInt32(); } + virtual uint32_t latency() const + { + Parcel data, reply; + data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); + remote()->transact(LATENCY, data, &reply); + return reply.readInt32(); + } + virtual status_t setMasterVolume(float value) { Parcel data, reply; @@ -308,9 +328,12 @@ status_t BnAudioFlinger::onTransact( int channelCount = data.readInt32(); size_t bufferCount = data.readInt32(); uint32_t flags = data.readInt32(); - sp<IAudioTrack> track = createTrack(pid, + sp<IMemory> buffer = interface_cast<IMemory>(data.readStrongBinder()); + status_t status; + sp<IAudioTrack> track = createTrack(pid, streamType, sampleRate, format, - channelCount, bufferCount, flags); + channelCount, bufferCount, flags, buffer, &status); + reply->writeInt32(status); reply->writeStrongBinder(track->asBinder()); return NO_ERROR; } break; @@ -323,8 +346,10 @@ status_t BnAudioFlinger::onTransact( int channelCount = data.readInt32(); size_t bufferCount = data.readInt32(); uint32_t flags = data.readInt32(); + status_t status; sp<IAudioRecord> record = openRecord(pid, streamType, - sampleRate, format, channelCount, bufferCount, flags); + sampleRate, format, channelCount, bufferCount, flags, &status); + reply->writeInt32(status); reply->writeStrongBinder(record->asBinder()); return NO_ERROR; } break; @@ -348,7 +373,12 @@ status_t BnAudioFlinger::onTransact( reply->writeInt32( frameCount() ); return NO_ERROR; } break; - case SET_MASTER_VOLUME: { + case LATENCY: { + CHECK_INTERFACE(IAudioFlinger, data, reply); + reply->writeInt32( latency() ); + return NO_ERROR; + } break; + case SET_MASTER_VOLUME: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( setMasterVolume(data.readFloat()) ); return NO_ERROR; |