简体   繁体   English

如何知道 Android 解码器 MediaCodec.createDecoderByType(type) 是硬件解码器还是软件解码器?

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

有没有办法找出使用 MediaCodec.createDecoderByType(type) 接收的解码器是硬件解码器还是软件解码器?

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.) MediaCodec.getName()方法自API级别18开始可用。对于较低的API级别,您需要迭代MediaCodecList的条目并手动选择适合您需要的正确编解码器。)

Putting it here for anyone it might help.把它放在这里给任何可能有帮助的人。 According to code for libstagefright, any codec which starts with OMX.google.根据 libstagefright 的代码,任何以OMX.google.开头的编解码器OMX.google. or c2.android.c2.android. or does not start with ( OMX. and c2. ) are all software codecs.或不以( OMX.c2. )开头的都是软件编解码器。
Source:来源:
https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/MediaCodecList.cpp#320 https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/MediaCodecList.cpp#320

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MediaCodec.createDecoderByType的类型列表(字符串类型) - Type list of MediaCodec.createDecoderByType (String type) 带有硬件加速的Android MediaCodec解码器的本机代码中的访问冲突 - Access violation in native code with hardware accelerated Android MediaCodec decoder Android MediaCodec如何创建解码器? - How does Android MediaCodec create a decoder? Android MediaCodec解码器输入/输出帧数 - Android MediaCodec decoder input/output frame count android-MediaCodec仅视频解码器帧率控制 - android - MediaCodec video only decoder framerate control Android MediaCodec解码器:放慢视频播放 - Android MediaCodec Decoder: Slow Down Video Playback 如何直接从Android Surface访问EGL图像以用于MediaCodec视频解码器? - How to access EGL Image directly from Android Surface for use in MediaCodec video decoder? 如何使用 mediaCodec 解码器解码具有 mime 类型应用程序/八位字节流的视频 - How to decode video with mime type application/octet-stream using mediaCodec decoder 在Android 4.2上调整Mediacodec解码器的缓冲区大小 - Adjust the buffer size of Mediacodec's decoder on Android 4.2 Android MediaCodec解码器,带有输入视频帧携带自定义信息 - Android MediaCodec decoder ,carry custom info with input video frames
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM