diff options
author | Glenn Kasten <gkasten@google.com> | 2012-09-24 11:27:18 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-09-25 17:13:18 -0700 |
commit | cc0f1cfb69ce8b8985fc2c0984847a06a13ad22d (patch) | |
tree | f3522fd1ad371d1e592c8c8cfd8d0ce1d98f80c2 /media/libmedia | |
parent | d9aa7b4db46bea5966401f9fcfbecb3269ec55c7 (diff) | |
download | frameworks_av-cc0f1cfb69ce8b8985fc2c0984847a06a13ad22d.zip frameworks_av-cc0f1cfb69ce8b8985fc2c0984847a06a13ad22d.tar.gz frameworks_av-cc0f1cfb69ce8b8985fc2c0984847a06a13ad22d.tar.bz2 |
Implement android.media.AudioManager.getProperty()
Bug: 6635041
Change-Id: I3386a4a6c226bc4eceaf65556119e4fb15f73224
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioSystem.cpp | 13 | ||||
-rw-r--r-- | media/libmedia/IAudioFlinger.cpp | 31 |
2 files changed, 43 insertions, 1 deletions
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp index 6e0c620..5624df4 100644 --- a/media/libmedia/AudioSystem.cpp +++ b/media/libmedia/AudioSystem.cpp @@ -735,6 +735,19 @@ status_t AudioSystem::isStreamActive(audio_stream_type_t stream, bool* state, ui return NO_ERROR; } +int32_t AudioSystem::getPrimaryOutputSamplingRate() +{ + const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); + if (af == 0) return 0; + return af->getPrimaryOutputSamplingRate(); +} + +int32_t AudioSystem::getPrimaryOutputFrameCount() +{ + const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); + if (af == 0) return 0; + return af->getPrimaryOutputFrameCount(); +} void AudioSystem::clearAudioConfigCache() { diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index 71e7c31..ce8ffc4 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -70,7 +70,9 @@ enum { GET_EFFECT_DESCRIPTOR, CREATE_EFFECT, MOVE_EFFECTS, - LOAD_HW_MODULE + LOAD_HW_MODULE, + GET_PRIMARY_OUTPUT_SAMPLING_RATE, + GET_PRIMARY_OUTPUT_FRAME_COUNT, }; class BpAudioFlinger : public BpInterface<IAudioFlinger> @@ -687,6 +689,23 @@ public: remote()->transact(LOAD_HW_MODULE, data, &reply); return (audio_module_handle_t) reply.readInt32(); } + + virtual int32_t getPrimaryOutputSamplingRate() + { + Parcel data, reply; + data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); + remote()->transact(GET_PRIMARY_OUTPUT_SAMPLING_RATE, data, &reply); + return reply.readInt32(); + } + + virtual int32_t getPrimaryOutputFrameCount() + { + Parcel data, reply; + data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); + remote()->transact(GET_PRIMARY_OUTPUT_FRAME_COUNT, data, &reply); + return reply.readInt32(); + } + }; IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger"); @@ -1045,6 +1064,16 @@ status_t BnAudioFlinger::onTransact( reply->writeInt32(loadHwModule(data.readCString())); return NO_ERROR; } break; + case GET_PRIMARY_OUTPUT_SAMPLING_RATE: { + CHECK_INTERFACE(IAudioFlinger, data, reply); + reply->writeInt32(getPrimaryOutputSamplingRate()); + return NO_ERROR; + } break; + case GET_PRIMARY_OUTPUT_FRAME_COUNT: { + CHECK_INTERFACE(IAudioFlinger, data, reply); + reply->writeInt32(getPrimaryOutputFrameCount()); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); } |