diff options
author | Wei Jia <wjia@google.com> | 2015-02-09 16:05:53 -0800 |
---|---|---|
committer | Wei Jia <wjia@google.com> | 2015-03-03 14:43:55 -0800 |
commit | d93fcf400222e4d8b27a1025f6aa307839239b9f (patch) | |
tree | 2ee5493da351f10720df1885972fa4035f9ffca4 /media/jni | |
parent | 4bd091414a8eab104875d0115347307411e27ebd (diff) | |
download | frameworks_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.cpp | 13 |
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}, |