如何知道Android解码器MediaCodec.createDecoderByType(type)是硬件还是软件解码器? [英] How to know Android decoder MediaCodec.createDecoderByType(type) is Hardware or software decoder?

查看:822
本文介绍了如何知道Android解码器MediaCodec.createDecoderByType(type)是硬件还是软件解码器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以找出使用MediaCodec.createDecoderByType(type)接收到的解码器是硬件解码器还是软件解码器?

Is there a way to find out if the decoder that received using MediaCodec.createDecoderByType(type) is a hardware decoder or a software decoder?

推荐答案

没有真正的正式标志来指示编解码器是硬件还是软件编解码器.实际上,您可以执行以下操作:

There is no real formal flag for indicating whether a codec is a hardware or software codec. In practice, you can do this, though:

MediaCodec codec = MediaCodec.createDecoderByType(type);
if (codec.getName().startsWith("OMX.google.")) {
    // Is a software codec
}

(从API级别18开始提供MediaCodec.getName()方法.对于较低的API级别,您需要遍历MediaCodecList中的条目,并手动选择适合您需求的正确编解码器.)

(The MediaCodec.getName() method is available since API level 18. For lower API levels, you instead need to iterate over the entries in MediaCodecList and manually pick the right codec that fits your needs instead.)

这篇关于如何知道Android解码器MediaCodec.createDecoderByType(type)是硬件还是软件解码器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆