How to know Android decoder MediaCodec.createDecoderByType(type) is Hardware or software decoder?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 04:53:30

问题


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


回答1:


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
}

(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.)



来源:https://stackoverflow.com/questions/37715529/how-to-know-android-decoder-mediacodec-createdecoderbytypetype-is-hardware-or

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!