[Android] Add a libvlc jni helper method for getting the native audio sampling rate
Martin Storsjö
git at videolan.org
Sat Feb 1 14:10:48 CET 2014
vlc-ports/android | branch: master | Martin Storsjö <martin at martin.st> | Fri Jan 31 15:31:03 2014 +0200| [ce8b48e8693d2f33b3cb1c43596f4c555f097b99] | committer: Rafaël Carré
Add a libvlc jni helper method for getting the native audio sampling rate
Signed-off-by: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ce8b48e8693d2f33b3cb1c43596f4c555f097b99
---
vlc-android/jni/aout.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/vlc-android/jni/aout.c b/vlc-android/jni/aout.c
index 02eae0f..bc146b4 100644
--- a/vlc-android/jni/aout.c
+++ b/vlc-android/jni/aout.c
@@ -245,3 +245,14 @@ void aout_close(void *opaque)
(*myVm)->DetachCurrentThread (myVm);
free (p_sys);
}
+
+int aout_get_native_sample_rate(void)
+{
+ JNIEnv *p_env;
+ (*myVm)->AttachCurrentThread (myVm, &p_env, NULL);
+ jclass cls = (*p_env)->FindClass (p_env, "android/media/AudioTrack");
+ jmethodID method = (*p_env)->GetStaticMethodID (p_env, cls, "getNativeOutputSampleRate", "(I)I");
+ int sample_rate = (*p_env)->CallStaticIntMethod (p_env, cls, method, 3); // AudioManager.STREAM_MUSIC
+ (*myVm)->DetachCurrentThread (myVm);
+ return sample_rate;
+}
More information about the Android
mailing list