[Android] LibVLC: Expose if device is ready for passThrough

Geoffrey Métais git at videolan.org
Fri Apr 20 09:10:59 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr 19 18:05:06 2018 +0200| [10ece0491b5eeb98f11fad6297b8b86e6c9ff60e] | committer: Geoffrey Métais

LibVLC: Expose if device is ready for passThrough

> https://code.videolan.org/videolan/vlc-android/commit/10ece0491b5eeb98f11fad6297b8b86e6c9ff60e
---

 libvlc/src/org/videolan/libvlc/MediaPlayer.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 8f00202b3..2a41a40e2 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -372,6 +372,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
     private boolean mAudioDigitalOutputEnabled = false;
     private String mAudioPlugOutputDevice = "stereo";
 
+    private boolean mCanDoPassthrough;
+
     private final AWindow mWindow = new AWindow(new AWindow.SurfaceCallback() {
         @Override
         public void onSurfacesCreated(AWindow vout) {
@@ -402,7 +404,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
     });
 
     private synchronized void updateAudioOutputDevice(long encodingFlags, String defaultDevice) {
-        final String newDeviceId = mAudioDigitalOutputEnabled && encodingFlags != 0 ? "encoded:" + encodingFlags : defaultDevice;
+        mCanDoPassthrough = encodingFlags != 0;
+        final String newDeviceId = mAudioDigitalOutputEnabled && mCanDoPassthrough ? "encoded:" + encodingFlags : defaultDevice;
         if (!newDeviceId.equals(mAudioPlugOutputDevice)) {
             mAudioPlugOutputDevice = newDeviceId;
             setAudioOutputDeviceInternal(mAudioPlugOutputDevice, false);
@@ -1201,6 +1204,10 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
         nativeRelease();
     }
 
+    public boolean canDoPassthrough() {
+        return mCanDoPassthrough;
+    }
+
     /* JNI */
     private native void nativeNewFromLibVlc(LibVLC libVLC, AWindow window);
     private native void nativeNewFromMedia(Media media, AWindow window);



More information about the Android mailing list