[Android] Secondary Dsiplay : Disable Hardware Acceleration by default

Alexandre Perraud git at videolan.org
Tue May 6 11:54:03 CEST 2014


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Mon May  5 14:52:11 2014 +0200| [89c5c0436de969fb5340625e01dd17f588fb99d5] | committer: Adrien Maglo

Secondary Dsiplay : Disable Hardware Acceleration by default

Signed-off-by: Adrien Maglo <magsoft at videolan.org>

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

 vlc-android/res/values/strings.xml                      |   11 ++++++++---
 vlc-android/res/xml/preferences.xml                     |   15 ++++++++++++---
 .../org/videolan/vlc/gui/video/VideoPlayerActivity.java |    9 +++++++++
 3 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 3f0ab25..8779fbe 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -199,7 +199,14 @@
 
     <string name="extra_prefs_category">Extra settings</string>
 
-    <string name="interface_prefs_category">Interface</string>
+    <string name="interface_prefs_screen">Interface</string>
+    <string name="interface_secondary_display_category">Interface - Secondary Display</string>
+    <string name="interface_secondary_display_category_summary">Settings when secondary displays are connected (HDMI/Miracast).</string>
+    <string name="enable_secondary_display_hardware_acceleration">Keep Hardware Acceleration setting</string>
+    <string name="enable_secondary_display_hardware_acceleration_summary">Hardware Acceleration might not work</string>
+    <string name="enable_clone_mode">Prefer clone</string>
+    <string name="enable_clone_mode_summary">Clone the device screen without remote control.</string>
+    <string name="interface_other_category">Interface - Other</string>
     <string name="enable_brightness_gesture">Enable brightness gesture</string>
     <string name="enable_brightness_gesture_summary">Control brightness by gesture during video playback</string>
     <string name="enable_headset_detection">Detect headset</string>
@@ -255,8 +262,6 @@
     <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="enable_clone_mode">Prefer clone mode for Secondary Displays</string>
-    <string name="enable_clone_mode_summary">Clone the device screen without remote control when secondary displays are connected (HDMI/Miracast).</string>
 
     <string-array name="hardware_acceleration_list">
         <item>@string/automatic</item>
diff --git a/vlc-android/res/xml/preferences.xml b/vlc-android/res/xml/preferences.xml
index 4705f20..5dff2ba 100644
--- a/vlc-android/res/xml/preferences.xml
+++ b/vlc-android/res/xml/preferences.xml
@@ -36,14 +36,23 @@
             android:title="@string/subtitle_text_encoding" />
     </PreferenceCategory>
     <PreferenceCategory android:title="@string/extra_prefs_category" >
-        <PreferenceScreen android:title="@string/interface_prefs_category" >
-            <PreferenceCategory android:title="@string/interface_prefs_category" >
+        <PreferenceScreen android:title="@string/interface_prefs_screen" >
+            <PreferenceCategory android:title="@string/interface_secondary_display_category" >
+                <Preference android:summary="@string/interface_secondary_display_category_summary" />
+
                 <CheckBoxPreference
                     android:defaultValue="false"
                     android:key="enable_clone_mode"
                     android:summary="@string/enable_clone_mode_summary"
                     android:title="@string/enable_clone_mode" />
                 <CheckBoxPreference
+                    android:defaultValue="false"
+                    android:key="enable_secondary_display_hardware_acceleration"
+                    android:summary="@string/enable_secondary_display_hardware_acceleration_summary"
+                    android:title="@string/enable_secondary_display_hardware_acceleration" />
+            </PreferenceCategory>
+            <PreferenceCategory android:title="@string/interface_other_category" >
+                <CheckBoxPreference
                     android:defaultValue="true"
                     android:key="enable_brightness_gesture"
                     android:summary="@string/enable_brightness_gesture_summary"
@@ -152,4 +161,4 @@
         </PreferenceScreen>
     </PreferenceCategory>
 
-</PreferenceScreen>
+</PreferenceScreen>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index d174a18..6ebe21c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -371,6 +371,15 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
             Log.d(TAG, "LibVLC initialisation failed");
             return;
         }
+
+        if (mPresentation != null && !pref.getBoolean("enable_secondary_display_hardware_acceleration", false)) {
+            mDisabledHardwareAcceleration = true;
+            mPreviousHardwareAccelerationMode = mLibVLC.getHardwareAcceleration();
+            mLibVLC.setHardwareAcceleration(LibVLC.HW_ACCELERATION_DISABLED);
+            Log.d(TAG,"Secondary Display : Hardware Acceleration disabled");
+        }
+        Log.d(TAG,"Hardware Acceleration mode : " + Integer.toString(mLibVLC.getHardwareAcceleration() ));
+
         /* Only show the subtitles surface when using "Full Acceleration" mode */
         if (mLibVLC.getHardwareAcceleration() == 2)
             mSubtitlesSurface.setVisibility(View.VISIBLE);



More information about the Android mailing list