summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-02-09 16:05:53 -0800
committerWei Jia <wjia@google.com>2015-03-03 14:43:55 -0800
commitd93fcf400222e4d8b27a1025f6aa307839239b9f (patch)
tree2ee5493da351f10720df1885972fa4035f9ffca4 /media/jni
parent4bd091414a8eab104875d0115347307411e27ebd (diff)
downloadframeworks_base-d93fcf400222e4d8b27a1025f6aa307839239b9f.zip
frameworks_base-d93fcf400222e4d8b27a1025f6aa307839239b9f.tar.gz
frameworks_base-d93fcf400222e4d8b27a1025f6aa307839239b9f.tar.bz2
MediaPlayer: add setPlaybackRate JAVA API.
Bug: 19196501 Change-Id: I43daced7d9b53bcaca4e6a8d81ca729b32efc79f
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_media_MediaPlayer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 820de5b..55643f7 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -402,6 +402,18 @@ android_media_MediaPlayer_isPlaying(JNIEnv *env, jobject thiz)
}
static void
+android_media_MediaPlayer_setPlaybackRate(JNIEnv *env, jobject thiz, jfloat rate)
+{
+ sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
+ if (mp == NULL) {
+ jniThrowException(env, "java/lang/IllegalStateException", NULL);
+ return;
+ }
+ ALOGV("setPlaybackRate: %f", rate);
+ process_media_player_call(env, thiz, mp->setPlaybackRate(rate), NULL, NULL);
+}
+
+static void
android_media_MediaPlayer_seekTo(JNIEnv *env, jobject thiz, jint msec)
{
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
@@ -867,6 +879,7 @@ static JNINativeMethod gMethods[] = {
{"_stop", "()V", (void *)android_media_MediaPlayer_stop},
{"getVideoWidth", "()I", (void *)android_media_MediaPlayer_getVideoWidth},
{"getVideoHeight", "()I", (void *)android_media_MediaPlayer_getVideoHeight},
+ {"_setPlaybackRate", "(F)V", (void *)android_media_MediaPlayer_setPlaybackRate},
{"seekTo", "(I)V", (void *)android_media_MediaPlayer_seekTo},
{"_pause", "()V", (void *)android_media_MediaPlayer_pause},
{"isPlaying", "()Z", (void *)android_media_MediaPlayer_isPlaying},