[Android] libvlc: LibVLC: set aout/vout default options if they are not set

Thomas Guillem git at videolan.org
Fri May 29 12:04:07 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri May 29 12:00:09 2015 +0200| [61f871b2dfcf87b99ad2f12ad2014ec0c4fb1a85] | committer: Thomas Guillem

libvlc: LibVLC: set aout/vout default options if they are not set

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

 libvlc/src/org/videolan/libvlc/LibVLC.java |   38 ++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index f3aa450..b51dae0 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -48,6 +48,44 @@ public class LibVLC extends VLCObject {
      * @param options
      */
     public LibVLC(ArrayList<String> options) {
+        boolean setAout = true, setVout = true, setChroma = true;
+        // check if aout/vout options are already set
+        if (options != null) {
+            for (String option : options) {
+                if (option.startsWith("--aout="))
+                    setAout = false;
+                if (option.startsWith("--vout="))
+                    setVout = false;
+                if (option.startsWith("--androidsurface-chroma"))
+                    setChroma = false;
+                if (!setAout && !setVout && !setChroma)
+                    break;
+            }
+        }
+
+        // set aout/vout options if they are not set
+        if (setAout || setVout || setChroma) {
+            if (options == null)
+                options = new ArrayList<String>();
+            if (setAout) {
+                final HWDecoderUtil.AudioOutput hwAout = HWDecoderUtil.getAudioOutputFromDevice();
+                if (hwAout == HWDecoderUtil.AudioOutput.OPENSLES)
+                    options.add("--aout=opensles");
+                else
+                    options.add("--aout=android_audiotrack");
+            }
+            if (setVout) {
+                if (HWDecoderUtil.HAS_WINDOW_VOUT)
+                    options.add("--vout=androidwindow");
+                else
+                    options.add("--vout=androidsurface");
+            }
+            if (setChroma) {
+                options.add("--androidsurface-chroma");
+                options.add("RV32");
+            }
+        }
+
         nativeNew(options != null ? options.toArray(new String[options.size()]) : null);
         setEventHandler(EventHandler.getInstance());
     }



More information about the Android mailing list