diff options
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); } |