[Android] equalizer: make applyEqualizer private
Edward Wang
git at videolan.org
Sun Sep 1 17:15:17 CEST 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun Sep 1 17:13:56 2013 +0200| [cdad953f3cddc8bed0b96fa74d7b859a2e40f8b0] | committer: Edward Wang
equalizer: make applyEqualizer private
The equalizer is now applied automatically with the media player, so it is no longer needed to call applyEqualizer() manually.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=cdad953f3cddc8bed0b96fa74d7b859a2e40f8b0
---
vlc-android/jni/libvlcjni-equalizer.c | 4 ++--
vlc-android/jni/libvlcjni.c | 5 ++++-
vlc-android/src/org/videolan/libvlc/LibVLC.java | 7 +++----
vlc-android/src/org/videolan/vlc/AudioService.java | 4 ----
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 1 -
5 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/vlc-android/jni/libvlcjni-equalizer.c b/vlc-android/jni/libvlcjni-equalizer.c
index d11f24d..2dad0e4 100644
--- a/vlc-android/jni/libvlcjni-equalizer.c
+++ b/vlc-android/jni/libvlcjni-equalizer.c
@@ -89,10 +89,10 @@ jfloatArray Java_org_videolan_libvlc_LibVLC_getPreset(JNIEnv *env, jobject thiz,
* apply equalizer settings (param bands is float[] (first element is preamp, then bands))
*/
//"--audio-filter=equalizer", "--equalizer-bands=-3.5 -4.5 -1 0 0 5 8 8 8 8",
-jint Java_org_videolan_libvlc_LibVLC_setNativeEqualizer(JNIEnv *env, jobject thiz, jfloatArray bands)
+jint Java_org_videolan_libvlc_LibVLC_setNativeEqualizer(JNIEnv *env, jobject thiz, jlong media_player, jfloatArray bands)
{
jint res = -1;
- libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
+ libvlc_media_player_t *mp = (libvlc_media_player_t*)(intptr_t)media_player;
if (!mp)
return res;
diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index 524af24..d2d3629 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -332,7 +332,6 @@ static void create_player_and_play(JNIEnv* env, jobject thiz,
/* Create a media player playing environment */
libvlc_media_player_t *mp = libvlc_media_player_new((libvlc_instance_t*)(intptr_t)instance);
-
jobject myJavaLibVLC = (*env)->NewGlobalRef(env, thiz);
//if AOUT_AUDIOTRACK_JAVA, we use amem
@@ -363,6 +362,10 @@ static void create_player_and_play(JNIEnv* env, jobject thiz,
/* Keep a pointer to this media player */
setLong(env, thiz, "mInternalMediaPlayerInstance", (jlong)(intptr_t)mp);
+ cls = (*env)->GetObjectClass(env, thiz);
+ jmethodID methodID = (*env)->GetMethodID(env, cls, "applyEqualizer", "()V");
+ (*env)->CallVoidMethod(env, thiz, methodID);
+
setInt(env, thiz, "mInternalMediaPlayerIndex", (jint)position);
libvlc_media_list_lock(p_mlist);
libvlc_media_t* p_md = libvlc_media_list_item_at_index(p_mlist, position);
diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
index 96b3b3a..d427b08 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
@@ -301,10 +301,11 @@ public class LibVLC {
applyEqualizer();
}
- public void applyEqualizer()
+ private void applyEqualizer()
{
- setNativeEqualizer(this.equalizer);
+ setNativeEqualizer(mInternalMediaPlayerInstance, this.equalizer);
}
+ private native int setNativeEqualizer(long mediaPlayer, float[] bands);
public boolean frameSkipEnabled() {
return frameSkip;
@@ -649,6 +650,4 @@ public class LibVLC {
public native String[] getPresets();
public native float[] getPreset(int index);
-
- private native int setNativeEqualizer(float[] bands);
}
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index ba47b02..1ccfdce 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -752,7 +752,6 @@ public class AudioService extends Service {
mLibVLC.playIndex(mCurrentIndex);
}
- mLibVLC.applyEqualizer();
mHandler.sendEmptyMessage(SHOW_PROGRESS);
setUpRemoteControlClient();
showNotification();
@@ -786,7 +785,6 @@ public class AudioService extends Service {
}
mLibVLC.playIndex(mCurrentIndex);
- mLibVLC.applyEqualizer();
mHandler.sendEmptyMessage(SHOW_PROGRESS);
setUpRemoteControlClient();
showNotification();
@@ -968,7 +966,6 @@ public class AudioService extends Service {
mLibVLC.getMediaList().getEventHandler().addHandler(mListEventHandler);
mLibVLC.playIndex(mCurrentIndex);
- mLibVLC.applyEqualizer();
setUpRemoteControlClient();
showNotification();
updateWidget(AudioService.this);
@@ -994,7 +991,6 @@ public class AudioService extends Service {
mEventHandler.addHandler(mVlcEventHandler);
mLibVLC.playIndex(mCurrentIndex);
- mLibVLC.applyEqualizer();
setUpRemoteControlClient();
showNotification();
updateWidget(AudioService.this);
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index fa91ade..e3e4412 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1510,7 +1510,6 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
savedIndexPosition = mLibVLC.getMediaList().size() - 1;
mLibVLC.playIndex(savedIndexPosition);
}
- mLibVLC.applyEqualizer();
if (mLocation != null && mLocation.length() > 0 && !dontParse) {
// restore last position
More information about the Android
mailing list