[Android] LibVLC: handle hw decoding option for LibVLC 4.0

Thomas Guillem git at videolan.org
Tue Jan 21 09:36:54 CET 2020


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan 21 09:00:15 2020 +0100| [4036299072d0b2a0089fd7e0ad95d028e074e1eb] | committer: Thomas Guillem

LibVLC: handle hw decoding option for LibVLC 4.0

> https://code.videolan.org/videolan/vlc-android/commit/4036299072d0b2a0089fd7e0ad95d028e074e1eb
---

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

diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index 68da9f0ae..8f9301f50 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -449,6 +449,8 @@ public class Media extends VLCObject<IMedia.Event> implements IMedia {
      * @param force force hw acceleration even for unknown devices
      */
     public void setHWDecoderEnabled(boolean enabled, boolean force) {
+
+        if (LibVLC.majorVersion() == 3) {
             HWDecoderUtil.Decoder decoder = enabled ?
                     HWDecoderUtil.getDecoderFromDevice() :
                     HWDecoderUtil.Decoder.NONE;
@@ -484,12 +486,16 @@ public class Media extends VLCObject<IMedia.Event> implements IMedia {
             sb.append("all");
 
             addOption(sb.toString());
+        }
+        else if (!enabled) /* LibVLC >= 4.0 */
+            addOption(":no-decoder-hw");
     }
 
     /**
      * Enable HWDecoder options if not already set
      */
     public void setDefaultMediaPlayerOptions() {
+        if (LibVLC.majorVersion() == 3) {
             boolean codecOptionSet;
             synchronized (this) {
                 codecOptionSet = mCodecOptionSet;
@@ -497,6 +503,7 @@ public class Media extends VLCObject<IMedia.Event> implements IMedia {
             }
             if (!codecOptionSet)
                 setHWDecoderEnabled(true, false);
+        }
 
         /* dvdnav need to be explicitly forced for network playbacks */
         if (mUri != null && mUri.getScheme() != null && !mUri.getScheme().equalsIgnoreCase("file") &&



More information about the Android mailing list