【第四篇章-android平台MediaCodec】推断是否支持硬件解码码
2024-08-26 11:10:30
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;
}
最新文章
- IOS FMDB 获取数据库表和表中的数据
- 【转】MyEclipse 2015优化技巧
- Windows 8.1 应用再出发 (WinJS) - 创建一个简单项目
- Leetcode: Random Pick Index
- SQL静态
- Blackhat EU 2013 黑客大会(Full Schedule for Black Hat USA 2013)
- VC5509的通用GEL代码
- linux网络相关
- 【转】使用 Auto Layout 的典型痛点和技巧
- linux学习之(五)-linux文解压、压缩、安装
- Bootstrap提示框
- Unity PUN插件多人在线同步角色坐标旋转角度和动作
- 7.20 Codeforces Beta Round #8
- Sublime text 2/3 [Decode error - output not utf-8] 完美解决方法
- SQLite与FMDB使用中区别
- CSS选择器之基本选择器总结
- Link-Cut Tree(LCT)&;TopTree讲解
- SURF算法
- 百度地图POI数据爬取,突破百度地图API爬取数目“400条“的限制11。
- python-day13--装饰器