summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-06-26 12:05:16 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2014-07-01 16:45:29 +0000
commit8df982dfa5408afe67cd6a4b45bfbf26c94299d0 (patch)
treec0a9a65cbfc3de3c17b0f96f68b9d322b0d42b79 /media/jni
parent2bd52dff6c96ace9c19e3e77068a45ea0d21c8fb (diff)
downloadframeworks_base-8df982dfa5408afe67cd6a4b45bfbf26c94299d0.zip
frameworks_base-8df982dfa5408afe67cd6a4b45bfbf26c94299d0.tar.gz
frameworks_base-8df982dfa5408afe67cd6a4b45bfbf26c94299d0.tar.bz2
Java MediaPlayer: add support for setting audio attributes
Change-Id: Ia638107a5e67c20c46c2f5f1800db9da57d6f698
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_media_MediaPlayer.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 6f42057..4587cf5 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -514,6 +514,25 @@ android_media_MediaPlayer_getAudioStreamType(JNIEnv *env, jobject thiz)
return (jint) streamtype;
}
+static jboolean
+android_media_MediaPlayer_setParameter(JNIEnv *env, jobject thiz, jint key, jobject java_request)
+{
+ ALOGV("setParameter: key %d", key);
+ sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
+ if (mp == NULL ) {
+ jniThrowException(env, "java/lang/IllegalStateException", NULL);
+ return false;
+ }
+
+ Parcel *request = parcelForJavaObject(env, java_request);
+ status_t err = mp->setParameter(key, *request);
+ if (err == OK) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
static void
android_media_MediaPlayer_setLooping(JNIEnv *env, jobject thiz, jboolean looping)
{
@@ -857,6 +876,7 @@ static JNINativeMethod gMethods[] = {
{"_reset", "()V", (void *)android_media_MediaPlayer_reset},
{"_setAudioStreamType", "(I)V", (void *)android_media_MediaPlayer_setAudioStreamType},
{"_getAudioStreamType", "()I", (void *)android_media_MediaPlayer_getAudioStreamType},
+ {"setParameter", "(ILandroid/os/Parcel;)Z", (void *)android_media_MediaPlayer_setParameter},
{"setLooping", "(Z)V", (void *)android_media_MediaPlayer_setLooping},
{"isLooping", "()Z", (void *)android_media_MediaPlayer_isLooping},
{"_setVolume", "(FF)V", (void *)android_media_MediaPlayer_setVolume},