[Android] Use HWDecoderUtil.getAudioOutputFromDevice

Thomas Guillem git at videolan.org
Wed Apr 1 12:11:41 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar 31 17:13:16 2015 +0200| [1de1ab2c59560859035babd7c3a59d00a3e6bb06] | committer: Thomas Guillem

Use HWDecoderUtil.getAudioOutputFromDevice

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=1de1ab2c59560859035babd7c3a59d00a3e6bb06
---

 libvlc/src/org/videolan/libvlc/LibVLC.java                 |    9 +++++----
 .../src/org/videolan/vlc/gui/PreferencesActivity.java      |   12 +++++++-----
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 0dfe95b..4bcaad1 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -318,10 +318,11 @@ public class LibVLC {
     }
 
     public void setAout(int aout) {
-        if (aout == AOUT_OPENSLES && LibVlcUtil.isICSOrLater())
-            this.aout = AOUT_OPENSLES;
-        else
-            this.aout = AOUT_AUDIOTRACK;
+        final HWDecoderUtil.AudioOutput hwaout = HWDecoderUtil.getAudioOutputFromDevice();
+        if (hwaout == HWDecoderUtil.AudioOutput.AUDIOTRACK || hwaout == HWDecoderUtil.AudioOutput.OPENSLES)
+            aout = hwaout == HWDecoderUtil.AudioOutput.OPENSLES ? AOUT_OPENSLES : AOUT_AUDIOTRACK;
+
+        this.aout = aout == AOUT_OPENSLES ? AOUT_OPENSLES : AOUT_AUDIOTRACK;
     }
 
     public int getVout() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index d3fa303..89e5e37 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -20,6 +20,7 @@
 
 package org.videolan.vlc.gui;
 
+import org.videolan.libvlc.HWDecoderUtil;
 import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcUtil;
 import org.videolan.vlc.MediaDatabase;
@@ -219,7 +220,12 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
 
         // Audio output
         ListPreference aoutPref = (ListPreference) findPreference("aout");
-        if (LibVlcUtil.isGingerbreadOrLater()) {
+        final HWDecoderUtil.AudioOutput aout = HWDecoderUtil.getAudioOutputFromDevice();
+        if (aout == HWDecoderUtil.AudioOutput.AUDIOTRACK || aout == HWDecoderUtil.AudioOutput.OPENSLES) {
+            /* no AudioOutput choice */
+            PreferenceGroup group = (PreferenceGroup) findPreference("advanced_prefs_group");
+            group.removePreference(aoutPref);
+        } else {
             int aoutEntriesId = R.array.aouts;
             int aoutEntriesIdValues = R.array.aouts_values;
             aoutPref.setEntries(aoutEntriesId);
@@ -233,10 +239,6 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
                 if (intValue != LibVLC.AOUT_AUDIOTRACK && intValue != LibVLC.AOUT_OPENSLES)
                     aoutPref.setValue(String.valueOf(LibVLC.AOUT_AUDIOTRACK));
             }
-        } else {
-            /* only audiotrack before gingerbread */
-            PreferenceGroup group = (PreferenceGroup) findPreference("advanced_prefs_group");
-            group.removePreference(aoutPref);
         }
         // Video output
 //        FIXME : This setting is disable until OpenGL it's fixed



More information about the Android mailing list