Loading include/media/AudioSystem.h +11 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,17 @@ public: static status_t setVoiceVolume(float volume); // return the number of audio frames written by AudioFlinger to audio HAL and // audio dsp to DAC since the output on which the specificed stream is playing // has exited standby. // returned status (from utils/Errors.h) can be: // - NO_ERROR: successful operation, halFrames and dspFrames point to valid data // - INVALID_OPERATION: Not supported on current hardware platform // - BAD_VALUE: invalid parameter // NOTE: this feature is not supported on all hardware platforms and it is // necessary to check returned status before using the returned values. static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream = DEFAULT); // // AudioPolicyService interface // Loading include/media/IAudioFlinger.h +1 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ public: virtual status_t setStreamOutput(uint32_t stream, int output) = 0; virtual status_t setVoiceVolume(float volume) = 0; virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) = 0; }; Loading include/media/MediaPlayerInterface.h +1 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public: virtual ssize_t frameSize() const = 0; virtual uint32_t latency() const = 0; virtual float msecsPerFrame() const = 0; virtual status_t getPosition(uint32_t *position) = 0; // If no callback is specified, use the "write" API below to submit // audio data. Otherwise return a full buffer of audio data on each Loading media/libmedia/AudioSystem.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -342,6 +342,18 @@ status_t AudioSystem::setVoiceVolume(float value) return af->setVoiceVolume(value); } status_t AudioSystem::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream) { const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; if (stream == DEFAULT) { stream = MUSIC; } return af->getRenderPosition(halFrames, dspFrames, getOutput((stream_type)stream)); } // --------------------------------------------------------------------------- void AudioSystem::AudioFlingerClient::binderDied(const wp<IBinder>& who) { Loading media/libmedia/IAudioFlinger.cpp +35 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,8 @@ enum { OPEN_INPUT, CLOSE_INPUT, SET_STREAM_OUTPUT, SET_VOICE_VOLUME SET_VOICE_VOLUME, GET_RENDER_POSITION }; class BpAudioFlinger : public BpInterface<IAudioFlinger> Loading Loading @@ -466,6 +467,26 @@ public: remote()->transact(SET_VOICE_VOLUME, data, &reply); return reply.readInt32(); } virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(output); remote()->transact(GET_RENDER_POSITION, data, &reply); status_t status = reply.readInt32(); if (status == NO_ERROR) { uint32_t tmp = reply.readInt32(); if (halFrames) { *halFrames = tmp; } tmp = reply.readInt32(); if (dspFrames) { *dspFrames = tmp; } } return status; } }; IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger"); Loading Loading @@ -718,6 +739,19 @@ status_t BnAudioFlinger::onTransact( reply->writeInt32( setVoiceVolume(volume) ); return NO_ERROR; } break; case GET_RENDER_POSITION: { CHECK_INTERFACE(IAudioFlinger, data, reply); int output = data.readInt32(); uint32_t halFrames; uint32_t dspFrames; status_t status = getRenderPosition(&halFrames, &dspFrames, output); reply->writeInt32(status); if (status == NO_ERROR) { reply->writeInt32(halFrames); reply->writeInt32(dspFrames); } return NO_ERROR; } default: return BBinder::onTransact(code, data, reply, flags); } Loading Loading
include/media/AudioSystem.h +11 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,17 @@ public: static status_t setVoiceVolume(float volume); // return the number of audio frames written by AudioFlinger to audio HAL and // audio dsp to DAC since the output on which the specificed stream is playing // has exited standby. // returned status (from utils/Errors.h) can be: // - NO_ERROR: successful operation, halFrames and dspFrames point to valid data // - INVALID_OPERATION: Not supported on current hardware platform // - BAD_VALUE: invalid parameter // NOTE: this feature is not supported on all hardware platforms and it is // necessary to check returned status before using the returned values. static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream = DEFAULT); // // AudioPolicyService interface // Loading
include/media/IAudioFlinger.h +1 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ public: virtual status_t setStreamOutput(uint32_t stream, int output) = 0; virtual status_t setVoiceVolume(float volume) = 0; virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) = 0; }; Loading
include/media/MediaPlayerInterface.h +1 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public: virtual ssize_t frameSize() const = 0; virtual uint32_t latency() const = 0; virtual float msecsPerFrame() const = 0; virtual status_t getPosition(uint32_t *position) = 0; // If no callback is specified, use the "write" API below to submit // audio data. Otherwise return a full buffer of audio data on each Loading
media/libmedia/AudioSystem.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -342,6 +342,18 @@ status_t AudioSystem::setVoiceVolume(float value) return af->setVoiceVolume(value); } status_t AudioSystem::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int stream) { const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; if (stream == DEFAULT) { stream = MUSIC; } return af->getRenderPosition(halFrames, dspFrames, getOutput((stream_type)stream)); } // --------------------------------------------------------------------------- void AudioSystem::AudioFlingerClient::binderDied(const wp<IBinder>& who) { Loading
media/libmedia/IAudioFlinger.cpp +35 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,8 @@ enum { OPEN_INPUT, CLOSE_INPUT, SET_STREAM_OUTPUT, SET_VOICE_VOLUME SET_VOICE_VOLUME, GET_RENDER_POSITION }; class BpAudioFlinger : public BpInterface<IAudioFlinger> Loading Loading @@ -466,6 +467,26 @@ public: remote()->transact(SET_VOICE_VOLUME, data, &reply); return reply.readInt32(); } virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(output); remote()->transact(GET_RENDER_POSITION, data, &reply); status_t status = reply.readInt32(); if (status == NO_ERROR) { uint32_t tmp = reply.readInt32(); if (halFrames) { *halFrames = tmp; } tmp = reply.readInt32(); if (dspFrames) { *dspFrames = tmp; } } return status; } }; IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger"); Loading Loading @@ -718,6 +739,19 @@ status_t BnAudioFlinger::onTransact( reply->writeInt32( setVoiceVolume(volume) ); return NO_ERROR; } break; case GET_RENDER_POSITION: { CHECK_INTERFACE(IAudioFlinger, data, reply); int output = data.readInt32(); uint32_t halFrames; uint32_t dspFrames; status_t status = getRenderPosition(&halFrames, &dspFrames, output); reply->writeInt32(status); if (status == NO_ERROR) { reply->writeInt32(halFrames); reply->writeInt32(dspFrames); } return NO_ERROR; } default: return BBinder::onTransact(code, data, reply, flags); } Loading