[Android] [PATCH] VLCOptions: Allow user-defined libVLC options

Guillaume Charifi guillaume.charifi at sfr.fr
Mon May 14 22:33:05 CEST 2018


Signed-off-by: Guillaume Charifi <guillaume.charifi at sfr.fr>
---
 vlc-android/res/values-fr/strings.xml                      | 1 +
 vlc-android/res/values/strings.xml                         | 1 +
 vlc-android/res/xml/preferences_adv.xml                    | 7 +++++++
 .../videolan/vlc/gui/preferences/PreferencesAdvanced.java  | 1 +
 .../vlc/gui/tv/preferences/PreferencesAdvanced.java        | 1 +
 vlc-android/src/org/videolan/vlc/util/VLCOptions.java      | 5 +++++
 6 files changed, 16 insertions(+)

diff --git a/vlc-android/res/values-fr/strings.xml b/vlc-android/res/values-fr/strings.xml
index 7063f2ac7..c2272781c 100644
--- a/vlc-android/res/values-fr/strings.xml
+++ b/vlc-android/res/values-fr/strings.xml
@@ -393,6 +393,7 @@
     <string name="dump_logcat">Enregistrer journal logcat</string>
     <string name="dump_logcat_success">Logcat enregistré avec succès dans le fichier : %1$s !</string>
     <string name="dump_logcat_failure">Erreur lors de l\'enregistrement du logcat.</string>
+    <string name="custom_libvlc_options">Options personnalisées pour libVLC</string>
     <string name="serious_crash">Malheureusement, une importante erreur est intervenue et VLC a dû se fermer.</string>
     <string name="help_us_send_log">Aidez-nous à améliorer VLC en renvoyant le rapport de crash suivant :</string>
     <string name="restart_vlc">Redémarrer VLC</string>
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..c5fc88d96 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
@@ -144,6 +144,11 @@ public class VLCOptions {
         options.add("--sout-chromecast-conversion-quality="+pref.getString("casting_quality", "2"));
         options.add("--sout-keep");
 
+        String customOptions[] = pref.getString("custom_libvlc_options", "").split("\\r?\\n", -1);
+
+        for (String opt : customOptions)
+            options.add(opt);
+
         return options;
     }
 
-- 
2.17.0



More information about the Android mailing list