[Android] VLCOptions: Allow user-defined libVLC options

Guillaume Charifi git at videolan.org
Wed May 16 10:42:12 CEST 2018


vlc-android | branch: master | Guillaume Charifi <guillaume.charifi at sfr.fr> | Mon May 14 22:33:05 2018 +0200| [6c165b776cb00552969180d0c20708780a1d91d6] | committer: Geoffrey Métais

VLCOptions: Allow user-defined libVLC options

Signed-off-by: Guillaume Charifi <guillaume.charifi at sfr.fr>
Signed-off-by: Geoffrey Métais <geoffrey.metais at gmail.com>

> https://code.videolan.org/videolan/vlc-android/commit/6c165b776cb00552969180d0c20708780a1d91d6
---

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

diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 2e795e6f8..0370abe26 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -448,6 +448,7 @@
     <string name="dump_logcat">Dump logcat log</string>
     <string name="dump_logcat_success">Logcat successfully dumped to %1$s!</string>
     <string name="dump_logcat_failure">Failed to dump logcat.</string>
+    <string name="custom_libvlc_options">Custom libVLC options</string>
 
     <string name="serious_crash">Unfortunately, a serious error has occurred and VLC had to close.</string>
     <string name="help_us_send_log">Help us improving VLC by sending the following crash log:</string>
diff --git a/vlc-android/res/xml/preferences_adv.xml b/vlc-android/res/xml/preferences_adv.xml
index 7bf3fe683..78b147eb7 100644
--- a/vlc-android/res/xml/preferences_adv.xml
+++ b/vlc-android/res/xml/preferences_adv.xml
@@ -81,6 +81,13 @@
         <PreferenceScreen
             android:key="debug_logs"
             android:title="@string/debug_logs" />
+
+        <EditTextPreference
+            android:defaultValue=""
+            android:inputType="textMultiLine"
+            android:key="custom_libvlc_options"
+            android:singleLine="false"
+            android:title="@string/custom_libvlc_options" />
     </PreferenceCategory>
 
 </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 66aa89e86..aabbcd03a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.java
@@ -175,6 +175,7 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
                 // No break because need VLCInstance.restart();
             case "opengl":
             case "chroma_format":
+            case "custom_libvlc_options":
             case "deblocking":
             case "enable_frame_skip":
             case "enable_time_stretching_audio":
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 ee68b1f87..4d35a408d 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
                 // No break because need VLCInstance.restart();
             case "opengl":
             case "chroma_format":
+            case "custom_libvlc_options":
             case "deblocking":
             case "enable_frame_skip":
             case "enable_time_stretching_audio":
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
index 93c6092b4..b55c25a2b 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
@@ -40,6 +40,7 @@ import org.videolan.vlc.VLCApplication;
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Collections;
 
 
 public class VLCOptions {
@@ -144,6 +145,9 @@ public class VLCOptions {
         options.add("--sout-chromecast-conversion-quality="+pref.getString("casting_quality", "2"));
         options.add("--sout-keep");
 
+        final String customOptions[] = pref.getString("custom_libvlc_options", "").split("\\r?\\n", -1);
+        if (!Util.isArrayEmpty(customOptions)) Collections.addAll(options, customOptions);
+
         return options;
     }
 



More information about the Android mailing list