[Android] HWDecoderUtil: use a DecoderBySOC per key/value

Thomas Guillem git at videolan.org
Wed Apr 1 12:11:41 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar 31 17:09:08 2015 +0200| [ed726b62912fa730a7fb8c97ef06771a4124ec6b] | committer: Thomas Guillem

HWDecoderUtil: use a DecoderBySOC per key/value

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

 libvlc/src/org/videolan/libvlc/HWDecoderUtil.java |   66 ++++++++++-----------
 1 file changed, 30 insertions(+), 36 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/HWDecoderUtil.java b/libvlc/src/org/videolan/libvlc/HWDecoderUtil.java
index 7d48899..58ffd25 100644
--- a/libvlc/src/org/videolan/libvlc/HWDecoderUtil.java
+++ b/libvlc/src/org/videolan/libvlc/HWDecoderUtil.java
@@ -32,14 +32,15 @@ public class HWDecoderUtil {
         UNKNOWN, NONE, OMX, MEDIACODEC, ALL
     }
 
+
     private static class DecoderBySOC {
         public final String key;
+        public final String value;
         public final Decoder dec;
-        public final String[] list;
-        public DecoderBySOC(String key, Decoder dec, String[] list) {
+        public DecoderBySOC(String key, String value, Decoder dec) {
             this.key = key;
+            this.value = value;
             this.dec = dec;
-            this.list = list;
         }
     }
 
@@ -48,42 +49,36 @@ public class HWDecoderUtil {
          *  Put first devices you want to blacklist
          *  because theses devices can match the next rules.
          */
-        new DecoderBySOC ("ro.product.brand", Decoder.NONE, new  String[] {
-                "SEMC",             // Xperia S
-        }),
-        new DecoderBySOC ("ro.board.platform", Decoder.NONE, new  String[] {
-                "msm7627",          // QCOM S1
-        }),
+        new DecoderBySOC("ro.product.brand", "SEMC", Decoder.NONE), // Xperia S
+        new DecoderBySOC("ro.board.platform", "msm7627", Decoder.NONE), // QCOM S1
+
         /*
          * Devices working on OMX
          */
-        new DecoderBySOC ("ro.board.platform", Decoder.OMX, new  String[] {
-                "omap3",            // Omap 3
-                "rockchip", "rk29", // Rockchip RK29
-                "msm7630",          // QCOM S2
-                "s5pc",             // Exynos 3
-                "montblanc",        // Montblanc
-                "exdroid",          // Allwinner A31
-        }),
-        new DecoderBySOC ("ro.hardware", Decoder.OMX, new  String[] {
-                "sun6i",            // Allwinner A31
-        }),
+        new DecoderBySOC("ro.board.platform", "omap3", Decoder.OMX), // Omap 3
+        new DecoderBySOC("ro.board.platform", "rockchip", Decoder.OMX), // Rockchip RK29
+        new DecoderBySOC("ro.board.platform", "rk29", Decoder.OMX), // Rockchip RK29
+        new DecoderBySOC("ro.board.platform", "msm7630", Decoder.OMX), // QCOM S2
+        new DecoderBySOC("ro.board.platform", "s5pc", Decoder.OMX), // Exynos 3
+        new DecoderBySOC("ro.board.platform",  "montblanc", Decoder.OMX), // Montblanc
+        new DecoderBySOC("ro.board.platform", "exdroid", Decoder.OMX), // Allwinner A31
+        new DecoderBySOC("ro.board.platform", "sun6i", Decoder.OMX), // Allwinner A31
+
         /*
          * Devices working on Mediacodec and OMX
          */
-        new DecoderBySOC ("ro.board.platform", Decoder.ALL, new  String[] {
-                "omap4",            // Omap 4
-                "tegra",            // Tegra 2 & 3
-                "tegra3",           // Tegra 3
-                "msm8660",          // QCOM S3
-                "exynos4",          // Exynos 4 (Samsung Galaxy S2/S3)
-                "exynos5",          // Exynos 5 (Samsung Galaxy S4)
-                "rk30", "rk31",     // Rockchip RK3*
-                "mv88de3100",       // Marvell ARMADA 1500
-        }),
-        new DecoderBySOC ("ro.hardware", Decoder.ALL, new  String[] {
-                "mt65", "mt83",     // MTK
-        }),
+        new DecoderBySOC("ro.board.platform", "omap4", Decoder.ALL), // Omap 4
+        new DecoderBySOC("ro.board.platform", "tegra", Decoder.ALL), // Tegra 2 & 3
+        new DecoderBySOC("ro.board.platform", "tegra3", Decoder.ALL), // Tegra 3
+        new DecoderBySOC("ro.board.platform", "msm8660", Decoder.ALL), // QCOM S3
+        new DecoderBySOC("ro.board.platform", "exynos4", Decoder.ALL), // Exynos 4 (Samsung Galaxy S2/S3)
+        new DecoderBySOC("ro.board.platform", "exynos5", Decoder.ALL), // Exynos 5 (Samsung Galaxy S4)
+        new DecoderBySOC("ro.board.platform", "rk30", Decoder.ALL), // Rockchip RK30
+        new DecoderBySOC("ro.board.platform", "rk31", Decoder.ALL), // Rockchip RK31
+        new DecoderBySOC("ro.board.platform", "mv88de3100", Decoder.ALL), // Marvell ARMADA 1500
+
+        new DecoderBySOC("ro.hardware", "mt65", Decoder.ALL), //MTK
+        new DecoderBySOC("ro.hardware", "mt83", Decoder.ALL), //MTK
     };
 
     private static final HashMap<String, String> sSystemPropertyMap = new HashMap<String, String>();
@@ -108,9 +103,8 @@ public class HWDecoderUtil {
                     sSystemPropertyMap.put(decBySOC.key, prop);
                 }
                 if (prop != null) {
-                    for (String decProp: decBySOC.list)
-                        if (prop.contains(decProp))
-                            return decBySOC.dec;
+                    if (prop.contains(decBySOC.value))
+                        return decBySOC.dec;
                 }
             }
         }



More information about the Android mailing list