android 硬解码 是否支持

//读取系统配置文件/system/etc/media_codecc.xml
File file = new File("/system/etc/media_codecs.xml");
InputStream in = null;
try {
    in = new FileInputStream(file);
} catch (Exception e) {
    // TODO: handle exception
}
if(in == null)
{
    android.util.Log.i("xp", "in == null");
}else{
    android.util.Log.i("xp", "in != null");
}


boolean isHardcode = false;
XmlPullParserFactory pullFactory;
try {
    pullFactory = XmlPullParserFactory.newInstance();
    XmlPullParser xmlPullParser = pullFactory.newPullParser();
    xmlPullParser.setInput(in, "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);
                    android.util.Log.i("xp", componentName);
                    if(componentName.startsWith("OMX."))
                    {
                        if(!componentName.startsWith("OMX.google."))
                        {
                            isHardcode = true;
                        }
                    }
                }
        }
        eventType = xmlPullParser.next();
    }
} catch (Exception e) {
    // TODO: handle exception
}
android.util.Log.i("xp", ""+isHardcode);

你可能感兴趣的:(android)