zoukankan      html  css  js  c++  java
  • 【第四篇章-android平台MediaCodec】推断是否支持硬件解码码

    public boolean isSupportMediaCodecHardDecoder(){
        boolean isHardcode = false;
        //读取系统配置文件/system/etc/media_codecc.xml
        File file = new File("/system/etc/media_codecs.xml");
        InputStream inFile = null;
        try {
          inFile = new FileInputStream(file);
        } catch (Exception e) {
            // TODO: handle exception
        }
    
        if(inFile != null) { 
            XmlPullParserFactory pullFactory;
            try {
                pullFactory = XmlPullParserFactory.newInstance();
                XmlPullParser xmlPullParser = pullFactory.newPullParser();
                xmlPullParser.setInput(inFile, "UTF-8");
                int eventType = xmlPullParser.getEventType();
                while (eventType != XmlPullParser.END_DOCUMENT) {
                    String tagName = xmlPullParser.getName();
                    switch (eventType) {
                    case XmlPullParser.START_TAG:
                        if ("MediaCodec".equals(tagName)) {
                            String componentName = xmlPullParser.getAttributeValue(0);
    
                            if(componentName.startsWith("OMX."))
                            {
                                if(!componentName.startsWith("OMX.google."))
                                {
                                    isHardcode = true;
                                }
                            }
                        }
                    }
                    eventType = xmlPullParser.next();
                }
            } catch (Exception e) {
                // TODO: handle exception
            }
        }
        return isHardcode;
    }
    

  • 相关阅读:
    POJ 1269 Intersecting Lines
    POJ 3304 Segments
    BZOJ 4591 超能粒子炮·改
    POJ 2318 TOYS/POJ 2398 Toy Storage
    BZOJ 1044 木棍分割
    BZOJ 2836 魔法树
    BZOJ 3176 Sort
    BZOJ 1668 馅饼里的财富
    Flood-it!
    Eight
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/5050792.html
Copyright © 2011-2022 走看看