Generate the IPlayer interface with AIDL.
This removes the manually rolled IPlayer implementation and instead uses
an aidl generated implementation. The IPlayer aidl file is moved from
frameworks/base/.
Test: run cts --module CtsMediaTestCases
Bug: 64223827
Change-Id: Ia609f7ba1cc6f71ce919d6174dd8b5e0e1b05575
diff --git a/include/media/VolumeShaper.h b/include/media/VolumeShaper.h
index 302641f..a3aaece 100644
--- a/include/media/VolumeShaper.h
+++ b/include/media/VolumeShaper.h
@@ -37,6 +37,8 @@
namespace android {
+namespace media {
+
// The native VolumeShaper class mirrors the java VolumeShaper class;
// in addition, the native class contains implementation for actual operation.
//
@@ -101,7 +103,7 @@
* See "frameworks/base/media/java/android/media/VolumeShaper.java" for
* details on the Java implementation.
*/
- class Configuration : public Interpolator<S, T>, public RefBase {
+ class Configuration : public Interpolator<S, T>, public RefBase, public Parcelable {
public:
// Must match with VolumeShaper.java in frameworks/base.
enum Type : int32_t {
@@ -283,7 +285,7 @@
}
// The parcel layout must match VolumeShaper.java
- status_t writeToParcel(Parcel *parcel) const {
+ status_t writeToParcel(Parcel *parcel) const override {
if (parcel == nullptr) return BAD_VALUE;
return parcel->writeInt32((int32_t)mType)
?: parcel->writeInt32(mId)
@@ -294,17 +296,17 @@
?: Interpolator<S, T>::writeToParcel(parcel);
}
- status_t readFromParcel(const Parcel &parcel) {
+ status_t readFromParcel(const Parcel *parcel) override {
int32_t type, optionFlags;
- return parcel.readInt32(&type)
+ return parcel->readInt32(&type)
?: setType((Type)type)
- ?: parcel.readInt32(&mId)
+ ?: parcel->readInt32(&mId)
?: mType == TYPE_ID
? NO_ERROR
- : parcel.readInt32(&optionFlags)
+ : parcel->readInt32(&optionFlags)
?: setOptionFlags((OptionFlag)optionFlags)
- ?: parcel.readDouble(&mDurationMs)
- ?: Interpolator<S, T>::readFromParcel(parcel)
+ ?: parcel->readDouble(&mDurationMs)
+ ?: Interpolator<S, T>::readFromParcel(*parcel)
?: checkCurve();
}
@@ -336,7 +338,7 @@
* See "frameworks/base/media/java/android/media/VolumeShaper.java" for
* details on the Java implementation.
*/
- class Operation : public RefBase {
+ class Operation : public RefBase, public Parcelable {
public:
// Must match with VolumeShaper.java.
enum Flag : int32_t {
@@ -418,18 +420,18 @@
return NO_ERROR;
}
- status_t writeToParcel(Parcel *parcel) const {
+ status_t writeToParcel(Parcel *parcel) const override {
if (parcel == nullptr) return BAD_VALUE;
return parcel->writeInt32((int32_t)mFlags)
?: parcel->writeInt32(mReplaceId)
?: parcel->writeFloat(mXOffset);
}
- status_t readFromParcel(const Parcel &parcel) {
+ status_t readFromParcel(const Parcel *parcel) override {
int32_t flags;
- return parcel.readInt32(&flags)
- ?: parcel.readInt32(&mReplaceId)
- ?: parcel.readFloat(&mXOffset)
+ return parcel->readInt32(&flags)
+ ?: parcel->readInt32(&mReplaceId)
+ ?: parcel->readFloat(&mXOffset)
?: setFlags((Flag)flags);
}
@@ -455,7 +457,7 @@
* See "frameworks/base/media/java/android/media/VolumeShaper.java" for
* details on the Java implementation.
*/
- class State : public RefBase {
+ class State : public RefBase, public Parcelable {
public:
State(T volume, S xOffset)
: mVolume(volume)
@@ -481,15 +483,15 @@
mXOffset = xOffset;
}
- status_t writeToParcel(Parcel *parcel) const {
+ status_t writeToParcel(Parcel *parcel) const override {
if (parcel == nullptr) return BAD_VALUE;
return parcel->writeFloat(mVolume)
?: parcel->writeFloat(mXOffset);
}
- status_t readFromParcel(const Parcel &parcel) {
- return parcel.readFloat(&mVolume)
- ?: parcel.readFloat(&mXOffset);
+ status_t readFromParcel(const Parcel *parcel) override {
+ return parcel->readFloat(&mVolume)
+ ?: parcel->readFloat(&mXOffset);
}
std::string toString() const {
@@ -1020,6 +1022,8 @@
std::list<VolumeShaper> mVolumeShapers; // list provides stable iterators on erase
}; // VolumeHandler
+} // namespace media
+
} // namespace android
#pragma pop_macro("LOG_TAG")
diff --git a/media/libaaudio/src/Android.mk b/media/libaaudio/src/Android.mk
index c13fa67..112a192 100644
--- a/media/libaaudio/src/Android.mk
+++ b/media/libaaudio/src/Android.mk
@@ -60,7 +60,8 @@
binding/RingBufferParcelable.cpp \
binding/SharedMemoryParcelable.cpp \
binding/SharedRegionParcelable.cpp \
- ../../libaudioclient/aidl/android/media/IAudioRecord.aidl
+ ../../libaudioclient/aidl/android/media/IAudioRecord.aidl \
+ ../../libaudioclient/aidl/android/media/IPlayer.aidl
LOCAL_CFLAGS += -Wno-unused-parameter -Wall -Werror
diff --git a/media/libaudioclient/Android.bp b/media/libaudioclient/Android.bp
index a02311b..98e8d95 100644
--- a/media/libaudioclient/Android.bp
+++ b/media/libaudioclient/Android.bp
@@ -20,6 +20,7 @@
// The headers for these interfaces will be available to any modules that
// include libaudioclient, at the path "aidl/package/path/BnFoo.h"
"aidl/android/media/IAudioRecord.aidl",
+ "aidl/android/media/IPlayer.aidl",
"AudioEffect.cpp",
"AudioPolicy.cpp",
@@ -49,7 +50,7 @@
],
export_shared_lib_headers: ["libbinder"],
- local_include_dirs: ["include/media"],
+ local_include_dirs: ["include/media", "aidl"],
header_libs: ["libaudioclient_headers"],
export_header_lib_headers: ["libaudioclient_headers"],
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index 31e1e2b..07875ac 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -39,6 +39,8 @@
namespace android {
// ---------------------------------------------------------------------------
+using media::VolumeShaper;
+
// TODO: Move to a separate .h
template <typename T>
@@ -553,7 +555,7 @@
mFramesWritten = 0;
mFramesWrittenServerOffset = 0;
mFramesWrittenAtRestore = -1; // -1 is a unique initializer.
- mVolumeHandler = new VolumeHandler();
+ mVolumeHandler = new media::VolumeHandler();
return NO_ERROR;
}
diff --git a/media/libaudioclient/IAudioTrack.cpp b/media/libaudioclient/IAudioTrack.cpp
index 79e864d..adff057 100644
--- a/media/libaudioclient/IAudioTrack.cpp
+++ b/media/libaudioclient/IAudioTrack.cpp
@@ -28,6 +28,8 @@
namespace android {
+using media::VolumeShaper;
+
enum {
GET_CBLK = IBinder::FIRST_CALL_TRANSACTION,
START,
@@ -185,7 +187,7 @@
return nullptr;
}
sp<VolumeShaper::State> state = new VolumeShaper::State;
- status = state->readFromParcel(reply);
+ status = state->readFromParcel(&reply);
if (status != NO_ERROR) {
return nullptr;
}
@@ -263,12 +265,12 @@
status_t status = data.readInt32(&present);
if (status == NO_ERROR && present != 0) {
configuration = new VolumeShaper::Configuration();
- status = configuration->readFromParcel(data);
+ status = configuration->readFromParcel(&data);
}
status = status ?: data.readInt32(&present);
if (status == NO_ERROR && present != 0) {
operation = new VolumeShaper::Operation();
- status = operation->readFromParcel(data);
+ status = operation->readFromParcel(&data);
}
if (status == NO_ERROR) {
status = (status_t)applyVolumeShaper(configuration, operation);
diff --git a/media/libaudioclient/PlayerBase.cpp b/media/libaudioclient/PlayerBase.cpp
index 7868318..b0c68e5 100644
--- a/media/libaudioclient/PlayerBase.cpp
+++ b/media/libaudioclient/PlayerBase.cpp
@@ -22,6 +22,8 @@
namespace android {
+using media::VolumeShaper;
+
//--------------------------------------------------------------------------------------------------
PlayerBase::PlayerBase() : BnPlayer(),
mPanMultiplierL(1.0f), mPanMultiplierR(1.0f),
@@ -117,23 +119,26 @@
//------------------------------------------------------------------------------
// Implementation of IPlayer
-void PlayerBase::start() {
+binder::Status PlayerBase::start() {
ALOGD("PlayerBase::start() from IPlayer");
(void)startWithStatus();
+ return binder::Status::ok();
}
-void PlayerBase::pause() {
+binder::Status PlayerBase::pause() {
ALOGD("PlayerBase::pause() from IPlayer");
(void)pauseWithStatus();
+ return binder::Status::ok();
}
-void PlayerBase::stop() {
+binder::Status PlayerBase::stop() {
ALOGD("PlayerBase::stop() from IPlayer");
(void)stopWithStatus();
+ return binder::Status::ok();
}
-void PlayerBase::setVolume(float vol) {
+binder::Status PlayerBase::setVolume(float vol) {
ALOGD("PlayerBase::setVolume() from IPlayer");
{
Mutex::Autolock _l(mSettingsLock);
@@ -144,9 +149,10 @@
if (status != NO_ERROR) {
ALOGW("PlayerBase::setVolume() error %d", status);
}
+ return binder::Status::fromStatusT(status);
}
-void PlayerBase::setPan(float pan) {
+binder::Status PlayerBase::setPan(float pan) {
ALOGD("PlayerBase::setPan() from IPlayer");
{
Mutex::Autolock _l(mSettingsLock);
@@ -163,22 +169,19 @@
if (status != NO_ERROR) {
ALOGW("PlayerBase::setPan() error %d", status);
}
+ return binder::Status::fromStatusT(status);
}
-void PlayerBase::setStartDelayMs(int32_t delayMs __unused) {
+binder::Status PlayerBase::setStartDelayMs(int32_t delayMs __unused) {
ALOGW("setStartDelay() is not supported");
+ return binder::Status::ok();
}
-void PlayerBase::applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration __unused,
- const sp<VolumeShaper::Operation>& operation __unused) {
+binder::Status PlayerBase::applyVolumeShaper(
+ const VolumeShaper::Configuration& configuration __unused,
+ const VolumeShaper::Operation& operation __unused) {
ALOGW("applyVolumeShaper() is not supported");
-}
-
-status_t PlayerBase::onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
-{
- return BnPlayer::onTransact(code, data, reply, flags);
+ return binder::Status::ok();
}
} // namespace android
diff --git a/media/libaudioclient/TrackPlayerBase.cpp b/media/libaudioclient/TrackPlayerBase.cpp
index 48cd803..0a914fc 100644
--- a/media/libaudioclient/TrackPlayerBase.cpp
+++ b/media/libaudioclient/TrackPlayerBase.cpp
@@ -18,6 +18,8 @@
namespace android {
+using media::VolumeShaper;
+
//--------------------------------------------------------------------------------------------------
TrackPlayerBase::TrackPlayerBase() : PlayerBase(),
mPlayerVolumeL(1.0f), mPlayerVolumeR(1.0f)
@@ -103,18 +105,24 @@
}
-void TrackPlayerBase::applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation) {
+binder::Status TrackPlayerBase::applyVolumeShaper(
+ const VolumeShaper::Configuration& configuration,
+ const VolumeShaper::Operation& operation) {
+
+ sp<VolumeShaper::Configuration> spConfiguration = new VolumeShaper::Configuration(configuration);
+ sp<VolumeShaper::Operation> spOperation = new VolumeShaper::Operation(operation);
+
if (mAudioTrack != 0) {
ALOGD("TrackPlayerBase::applyVolumeShaper() from IPlayer");
- VolumeShaper::Status status = mAudioTrack->applyVolumeShaper(configuration, operation);
+ VolumeShaper::Status status = mAudioTrack->applyVolumeShaper(spConfiguration, spOperation);
if (status < 0) { // a non-negative value is the volume shaper id.
ALOGE("TrackPlayerBase::applyVolumeShaper() failed with status %d", status);
}
+ return binder::Status::fromStatusT(status);
} else {
ALOGD("TrackPlayerBase::applyVolumeShaper()"
- " no AudioTrack for volume control from IPlayer");
+ " no AudioTrack for volume control from IPlayer");
+ return binder::Status::ok();
}
}
diff --git a/media/libaudioclient/aidl/android/media/IPlayer.aidl b/media/libaudioclient/aidl/android/media/IPlayer.aidl
new file mode 100644
index 0000000..a90fcdd
--- /dev/null
+++ b/media/libaudioclient/aidl/android/media/IPlayer.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 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
+ *
+ * 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
+ * limitations under the License.
+ */
+
+package android.media;
+
+import android.media.VolumeShaper.Configuration;
+import android.media.VolumeShaper.Operation;
+
+/**
+ * @hide
+ */
+interface IPlayer {
+ oneway void start();
+ oneway void pause();
+ oneway void stop();
+ oneway void setVolume(float vol);
+ oneway void setPan(float pan);
+ oneway void setStartDelayMs(int delayMs);
+ oneway void applyVolumeShaper(in Configuration configuration,
+ in Operation operation);
+}
diff --git a/media/libaudioclient/aidl/android/media/VolumeShaper/Configuration.aidl b/media/libaudioclient/aidl/android/media/VolumeShaper/Configuration.aidl
new file mode 100644
index 0000000..fd0e60f
--- /dev/null
+++ b/media/libaudioclient/aidl/android/media/VolumeShaper/Configuration.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 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
+ *
+ * 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
+ * limitations under the License.
+ */
+
+package android.media.VolumeShaper;
+
+parcelable Configuration cpp_header "media/VolumeShaper.h";
diff --git a/media/libaudioclient/aidl/android/media/VolumeShaper/Operation.aidl b/media/libaudioclient/aidl/android/media/VolumeShaper/Operation.aidl
new file mode 100644
index 0000000..4290d9d
--- /dev/null
+++ b/media/libaudioclient/aidl/android/media/VolumeShaper/Operation.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 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
+ *
+ * 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
+ * limitations under the License.
+ */
+
+package android.media.VolumeShaper;
+
+parcelable Operation cpp_header "media/VolumeShaper.h";
diff --git a/media/libaudioclient/aidl/android/media/VolumeShaper/State.aidl b/media/libaudioclient/aidl/android/media/VolumeShaper/State.aidl
new file mode 100644
index 0000000..f6a22b8
--- /dev/null
+++ b/media/libaudioclient/aidl/android/media/VolumeShaper/State.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 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
+ *
+ * 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
+ * limitations under the License.
+ */
+
+package android.media.VolumeShaper;
+
+parcelable State cpp_header "media/VolumeShaper.h";
diff --git a/media/libaudioclient/include/media/AudioTrack.h b/media/libaudioclient/include/media/AudioTrack.h
index b168fc9..014df20 100644
--- a/media/libaudioclient/include/media/AudioTrack.h
+++ b/media/libaudioclient/include/media/AudioTrack.h
@@ -744,12 +744,12 @@
status_t setParameters(const String8& keyValuePairs);
/* Sets the volume shaper object */
- VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation);
+ media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation);
/* Gets the volume shaper state */
- sp<VolumeShaper::State> getVolumeShaperState(int id);
+ sp<media::VolumeShaper::State> getVolumeShaperState(int id);
/* Get parameters */
String8 getParameters(const String8& keys);
@@ -1146,7 +1146,7 @@
// May not match the app selection depending on other
// activity and connected devices.
- sp<VolumeHandler> mVolumeHandler;
+ sp<media::VolumeHandler> mVolumeHandler;
private:
class DeathNotifier : public IBinder::DeathRecipient {
diff --git a/media/libaudioclient/include/media/IAudioTrack.h b/media/libaudioclient/include/media/IAudioTrack.h
index 27a62d6..94afe3c 100644
--- a/media/libaudioclient/include/media/IAudioTrack.h
+++ b/media/libaudioclient/include/media/IAudioTrack.h
@@ -77,12 +77,12 @@
virtual void signal() = 0;
/* Sets the volume shaper */
- virtual VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation) = 0;
+ virtual media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation) = 0;
/* gets the volume shaper state */
- virtual sp<VolumeShaper::State> getVolumeShaperState(int id) = 0;
+ virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/media/libaudioclient/include/media/PlayerBase.h b/media/libaudioclient/include/media/PlayerBase.h
index e63090b..e7a8abc 100644
--- a/media/libaudioclient/include/media/PlayerBase.h
+++ b/media/libaudioclient/include/media/PlayerBase.h
@@ -17,35 +17,31 @@
#ifndef __ANDROID_PLAYER_BASE_H__
#define __ANDROID_PLAYER_BASE_H__
-#include <audiomanager/IPlayer.h>
#include <audiomanager/AudioManager.h>
#include <audiomanager/IAudioManager.h>
+#include "android/media/BnPlayer.h"
namespace android {
-class PlayerBase : public BnPlayer
+class PlayerBase : public ::android::media::BnPlayer
{
public:
explicit PlayerBase();
- virtual ~PlayerBase();
+ virtual ~PlayerBase() override;
virtual void destroy() = 0;
//IPlayer implementation
- virtual void start();
- virtual void pause();
- virtual void stop();
- virtual void setVolume(float vol);
- virtual void setPan(float pan);
- virtual void setStartDelayMs(int32_t delayMs);
- virtual void applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation) override;
-
- virtual status_t onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);
-
+ virtual binder::Status start() override;
+ virtual binder::Status pause() override;
+ virtual binder::Status stop() override;
+ virtual binder::Status setVolume(float vol) override;
+ virtual binder::Status setPan(float pan) override;
+ virtual binder::Status setStartDelayMs(int32_t delayMs) override;
+ virtual binder::Status applyVolumeShaper(
+ const media::VolumeShaper::Configuration& configuration,
+ const media::VolumeShaper::Operation& operation) override;
status_t startWithStatus();
status_t pauseWithStatus();
diff --git a/media/libaudioclient/include/media/TrackPlayerBase.h b/media/libaudioclient/include/media/TrackPlayerBase.h
index 2d113c0..66e9b3b 100644
--- a/media/libaudioclient/include/media/TrackPlayerBase.h
+++ b/media/libaudioclient/include/media/TrackPlayerBase.h
@@ -32,9 +32,9 @@
virtual void destroy();
//IPlayer implementation
- virtual void applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation);
+ virtual binder::Status applyVolumeShaper(
+ const media::VolumeShaper::Configuration& configuration,
+ const media::VolumeShaper::Operation& operation);
//FIXME move to protected field, so far made public to minimize changes to AudioTrack logic
sp<AudioTrack> mAudioTrack;
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index 3996227..cda3b3a 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -35,6 +35,8 @@
namespace android {
+using media::VolumeShaper;
+
enum {
DISCONNECT = IBinder::FIRST_CALL_TRANSACTION,
SET_DATA_SOURCE_URL,
@@ -509,7 +511,7 @@
return nullptr;
}
sp<VolumeShaper::State> state = new VolumeShaper::State();
- status = state->readFromParcel(reply);
+ status = state->readFromParcel(&reply);
if (status != NO_ERROR) {
return nullptr;
}
@@ -851,14 +853,14 @@
status_t status = data.readInt32(&present);
if (status == NO_ERROR && present != 0) {
configuration = new VolumeShaper::Configuration();
- status = configuration->readFromParcel(data);
+ status = configuration->readFromParcel(&data);
}
if (status == NO_ERROR) {
status = data.readInt32(&present);
}
if (status == NO_ERROR && present != 0) {
operation = new VolumeShaper::Operation();
- status = operation->readFromParcel(data);
+ status = operation->readFromParcel(&data);
}
if (status == NO_ERROR) {
status = (status_t)applyVolumeShaper(configuration, operation);
diff --git a/media/libmedia/include/media/IMediaPlayer.h b/media/libmedia/include/media/IMediaPlayer.h
index e5a98dd..e657716 100644
--- a/media/libmedia/include/media/IMediaPlayer.h
+++ b/media/libmedia/include/media/IMediaPlayer.h
@@ -91,10 +91,10 @@
virtual status_t getRetransmitEndpoint(struct sockaddr_in* endpoint) = 0;
virtual status_t setNextPlayer(const sp<IMediaPlayer>& next) = 0;
- virtual VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation) = 0;
- virtual sp<VolumeShaper::State> getVolumeShaperState(int id) = 0;
+ virtual media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation) = 0;
+ virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) = 0;
// Modular DRM
virtual status_t prepareDrm(const uint8_t uuid[16],
diff --git a/media/libmedia/include/media/mediaplayer.h b/media/libmedia/include/media/mediaplayer.h
index 623c374..cb0a99f 100644
--- a/media/libmedia/include/media/mediaplayer.h
+++ b/media/libmedia/include/media/mediaplayer.h
@@ -266,10 +266,10 @@
status_t setRetransmitEndpoint(const char* addrString, uint16_t port);
status_t setNextMediaPlayer(const sp<MediaPlayer>& player);
- VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation);
- sp<VolumeShaper::State> getVolumeShaperState(int id);
+ media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation);
+ sp<media::VolumeShaper::State> getVolumeShaperState(int id);
// Modular DRM
status_t prepareDrm(const uint8_t uuid[16], const Vector<uint8_t>& drmSessionId);
status_t releaseDrm();
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index efe947a..49101d1 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -48,6 +48,8 @@
namespace android {
+using media::VolumeShaper;
+
MediaPlayer::MediaPlayer()
{
ALOGV("constructor");
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 496db0d..ba98f18 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -93,6 +93,7 @@
using android::BAD_VALUE;
using android::NOT_ENOUGH_DATA;
using android::Parcel;
+using android::media::VolumeShaper;
// Max number of entries in the filter.
const int kMaxFilterSize = 64; // I pulled that out of thin air.
@@ -1577,7 +1578,7 @@
mSendLevel(0.0),
mAuxEffectId(0),
mFlags(AUDIO_OUTPUT_FLAG_NONE),
- mVolumeHandler(new VolumeHandler())
+ mVolumeHandler(new media::VolumeHandler())
{
ALOGV("AudioOutput(%d)", sessionId);
if (attr != NULL) {
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index 06b9cad..25691f9 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -132,10 +132,10 @@
virtual status_t setParameters(const String8& keyValuePairs);
virtual String8 getParameters(const String8& keys);
- virtual VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation) override;
- virtual sp<VolumeShaper::State> getVolumeShaperState(int id) override;
+ virtual media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation) override;
+ virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) override;
private:
static void setMinBufferCount();
@@ -165,7 +165,7 @@
float mSendLevel;
int mAuxEffectId;
audio_output_flags_t mFlags;
- sp<VolumeHandler> mVolumeHandler;
+ sp<media::VolumeHandler> mVolumeHandler;
mutable Mutex mLock;
// static variables below not protected by mutex
@@ -343,10 +343,10 @@
virtual status_t getRetransmitEndpoint(struct sockaddr_in* endpoint);
virtual status_t setNextPlayer(const sp<IMediaPlayer>& player);
- virtual VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation) override;
- virtual sp<VolumeShaper::State> getVolumeShaperState(int id) override;
+ virtual media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation) override;
+ virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) override;
sp<MediaPlayerBase> createPlayer(player_type playerType);
diff --git a/media/libmediaplayerservice/include/MediaPlayerInterface.h b/media/libmediaplayerservice/include/MediaPlayerInterface.h
index e8d59a7..bcdca37 100644
--- a/media/libmediaplayerservice/include/MediaPlayerInterface.h
+++ b/media/libmediaplayerservice/include/MediaPlayerInterface.h
@@ -146,10 +146,10 @@
virtual status_t setParameters(const String8& /* keyValuePairs */) { return NO_ERROR; }
virtual String8 getParameters(const String8& /* keys */) { return String8::empty(); }
- virtual VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation);
- virtual sp<VolumeShaper::State> getVolumeShaperState(int id);
+ virtual media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation);
+ virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id);
};
MediaPlayerBase() : mCookie(0), mNotify(0) {}
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 1b7d875..de617b9 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -557,10 +557,10 @@
virtual void pause();
virtual status_t attachAuxEffect(int effectId);
virtual status_t setParameters(const String8& keyValuePairs);
- virtual VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation) override;
- virtual sp<VolumeShaper::State> getVolumeShaperState(int id) override;
+ virtual media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation) override;
+ virtual sp<media::VolumeShaper::State> getVolumeShaperState(int id) override;
virtual status_t getTimestamp(AudioTimestamp& timestamp);
virtual void signal(); // signal playback thread for a change in control block
diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h
index 1c1a989..946d88f 100644
--- a/services/audioflinger/PlaybackTracks.h
+++ b/services/audioflinger/PlaybackTracks.h
@@ -82,11 +82,11 @@
virtual bool isFastTrack() const { return (mFlags & AUDIO_OUTPUT_FLAG_FAST) != 0; }
// implement volume handling.
- VolumeShaper::Status applyVolumeShaper(
- const sp<VolumeShaper::Configuration>& configuration,
- const sp<VolumeShaper::Operation>& operation);
-sp<VolumeShaper::State> getVolumeShaperState(int id);
- sp<VolumeHandler> getVolumeHandler() { return mVolumeHandler; }
+ media::VolumeShaper::Status applyVolumeShaper(
+ const sp<media::VolumeShaper::Configuration>& configuration,
+ const sp<media::VolumeShaper::Operation>& operation);
+ sp<media::VolumeShaper::State> getVolumeShaperState(int id);
+ sp<media::VolumeHandler> getVolumeHandler() { return mVolumeHandler; }
protected:
// for numerous
@@ -163,7 +163,7 @@
ExtendedTimestamp mSinkTimestamp;
- sp<VolumeHandler> mVolumeHandler; // handles multiple VolumeShaper configs and operations
+ sp<media::VolumeHandler> mVolumeHandler; // handles multiple VolumeShaper configs and operations
private:
// The following fields are only for fast tracks, and should be in a subclass
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 16eeccc..50c0e23 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -52,6 +52,7 @@
namespace android {
+using media::VolumeShaper;
// ----------------------------------------------------------------------------
// TrackBase
// ----------------------------------------------------------------------------
@@ -399,7 +400,7 @@
mAuxEffectId(0), mHasVolumeController(false),
mPresentationCompleteFrames(0),
mFrameMap(16 /* sink-frame-to-track-frame map memory */),
- mVolumeHandler(new VolumeHandler(sampleRate)),
+ mVolumeHandler(new media::VolumeHandler(sampleRate)),
// mSinkTimestamp
mFastIndex(-1),
mCachedVolume(1.0),