[Android] LibVLC: add a method to activate spdif and surround
Thomas Guillem
git at videolan.org
Wed Apr 8 09:35:45 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Apr 7 11:36:30 2015 +0200| [645e32af3f009d7dbcbcdd206d9c68c96d19633c] | committer: Thomas Guillem
LibVLC: add a method to activate spdif and surround
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=645e32af3f009d7dbcbcdd206d9c68c96d19633c
---
libvlc/jni/libvlcjni.c | 11 +++++++++--
libvlc/src/org/videolan/libvlc/LibVLC.java | 9 +++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 0cea0f5..3b8fe8e 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -461,7 +461,10 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
(*env)->ReleaseStringUTFChars(env, cachePath, cache_path);
}
-#define MAX_ARGV 20
+ methodId = (*env)->GetMethodID(env, cls, "isHdmiAudioEnabled", "()Z");
+ bool hdmi_audio = (*env)->CallBooleanMethod(env, thiz, methodId);
+
+#define MAX_ARGV 22
const char *argv[MAX_ARGV];
int argc = 0;
@@ -500,7 +503,11 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
argv[argc++] = "--no-omxil-dr";
#endif
}
- argv[argc++] = "--spdif";
+ if (hdmi_audio) {
+ argv[argc++] = "--spdif";
+ argv[argc++] = "--audiotrack-audio-channels";
+ argv[argc++] = "8"; // 7.1 maximum
+ }
argv[argc++] = b_verbose ? "-vvv" : "-vv";
/* Reconnect on lost HTTP streams, e.g. network change */
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 4bcaad1..2712414 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -86,6 +86,7 @@ public class LibVLC {
private boolean frameSkip = false;
private int networkCaching = 0;
private boolean httpReconnect = false;
+ private boolean hdmiAudioEnabled = false;
/** Path of application-specific cache */
private String mCachePath = "";
@@ -338,6 +339,14 @@ public class LibVLC {
this.vout = VOUT_ANDROID_WINDOW;
}
+ public void setHdmiAudioEnabled(boolean enable) {
+ this.hdmiAudioEnabled = enable;
+ }
+
+ public boolean isHdmiAudioEnabled() {
+ return this.hdmiAudioEnabled;
+ }
+
public boolean useCompatSurface() {
return this.vout != VOUT_ANDROID_WINDOW;
}
More information about the Android
mailing list