[Android] Preferences: add an adv preference to force OpenGLES2

Thomas Guillem git at videolan.org
Thu Dec 22 20:50:24 CET 2016


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Dec 22 20:49:35 2016 +0100| [0728e7935b47cbcf0a2978694433bbc256fdd843] | committer: Thomas Guillem

Preferences: add an adv preference to force OpenGLES2

> https://code.videolan.org/videolan/vlc-android/commit/0728e7935b47cbcf0a2978694433bbc256fdd843
---

 vlc-android/res/values/strings.xml                       | 16 ++++++++++++++++
 vlc-android/res/xml/preferences_adv.xml                  |  9 ++++++++-
 .../vlc/gui/preferences/PreferencesAdvanced.java         |  1 +
 .../vlc/gui/tv/preferences/PreferencesAdvanced.java      |  1 +
 vlc-android/src/org/videolan/vlc/util/VLCOptions.java    |  5 +++++
 5 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 38341a3..cc2a680 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -634,6 +634,22 @@
         <item>1</item>
     </string-array>
 
+    <string name="opengl_title">OpenGL ES2 usage</string>
+    <string name="opengl_summary">By default, OpenGL ES2 is used for software decoding and hardware decoding when needed (360° videos).</string>
+    <string-array name="opengl_list">
+        <item>@string/opengl_automatic</item>
+        <item>@string/opengl_on</item>
+        <item>@string/opengl_off</item>
+    </string-array>
+    <string-array name="opengl_values" translatable="false">
+        <item>-1</item>
+        <item>1</item>
+        <item>0</item>
+    </string-array>
+    <string name="opengl_automatic">Automatic</string>
+    <string name="opengl_on">Force On</string>
+    <string name="opengl_off">Force Off</string>
+
     <string-array name="chroma_formats_values" translatable="false">
         <item>RV32</item>
         <item>RV16</item>
diff --git a/vlc-android/res/xml/preferences_adv.xml b/vlc-android/res/xml/preferences_adv.xml
index 2045bb6..dd73a2a 100644
--- a/vlc-android/res/xml/preferences_adv.xml
+++ b/vlc-android/res/xml/preferences_adv.xml
@@ -37,6 +37,13 @@
             android:summary="@string/enable_time_stretching_audio_summary"
             android:title="@string/enable_time_stretching_audio" />
         <ListPreference
+            android:defaultValue="-1"
+            android:entries="@array/opengl_list"
+            android:entryValues="@array/opengl_values"
+            android:key="opengl"
+            android:summary="@string/opengl_summary"
+            android:title="@string/opengl_title" />
+        <ListPreference
             android:defaultValue="@string/chroma_format_default"
             android:entries="@array/chroma_formats"
             android:entryValues="@array/chroma_formats_values"
@@ -69,4 +76,4 @@
             android:title="@string/debug_logs" />
     </PreferenceCategory>
 
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
index a9f012d..ab8396b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
@@ -132,6 +132,7 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
                 }
                 editor.apply();
                 // No break because need VLCInstance.restart();
+            case "opengl":
             case "chroma_format":
             case "deblocking":
             case "enable_frame_skip":
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
index 8dc7056..cbfe7e6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAdvanced.java
@@ -134,6 +134,7 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
                 }
                 editor.apply();
                 // No break because need VLCInstance.restart();
+            case "opengl":
             case "chroma_format":
             case "deblocking":
             case "enable_frame_skip":
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
index 0436b47..886ccdd 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
@@ -80,6 +80,7 @@ public class VLCOptions {
         final String freetypeRelFontsize = pref.getString("subtitles_size", "16");
         final String freetypeColor = pref.getString("subtitles_color", "16777215");
         final boolean freetypeBackground = pref.getBoolean("subtitles_background", false);
+        final int opengl = Integer.parseInt(pref.getString("opengl", "-1"));
 
         /* CPU intensive plugin, setting for slow devices */
         options.add(timeStreching ? "--audio-time-stretch" : "--no-audio-time-stretch");
@@ -106,6 +107,10 @@ public class VLCOptions {
             options.add("--freetype-background-opacity=128");
         else
             options.add("--freetype-background-opacity=0");
+        if (opengl == 1)
+            options.add("--vout=gles2,none");
+        else if (opengl == 0)
+            options.add("--vout=android_display,none");
 
         /* Configure keystore */
         options.add("--keystore");



More information about the Android mailing list