获取支持codeC的Andr​​oid设备设备、codeC、Andr、oid

2023-09-07 10:10:07 作者:折木

有没有办法问它支持什么编码的音频和视频codeCS Android设备?

我发现,不支持某些列为强制性的codeCS设备 http://developer.android.com/guide/appendix/media-formats.html 而且似乎是支持更多codeC没有被列入其中的设备。

解决方案   

有没有办法问它支持什么编码的音频和视频codeCS Android设备?

我真的很希望有,但是没有,至少到ICS。

果冻豆提供了一个媒体codeC 类。虽然它并没有给我的支持codeCS清单,它确实有 createEn coderByType(),在那里你传递一个MIME类型。 presumably,这将抛出一个的RuntimeException 或返回如果不支持所需的MIME类型。我不能答应,仅仅因为媒体codeC 报道说,一间codeR可用,它是保证,比如说, MediaRecorder 。

Is there a way to ask an Android device what audio and video Codecs it supports for encoding?

I found devices that do not support some of the codecs listed as mandatory in http://developer.android.com/guide/appendix/media-formats.html and there seem to be devices supporting additional codec not listed there.

解决方案

Is there a way to ask an Android device what audio and video Codecs it supports for encoding?

I really wish there were, but there is not, at least through ICS.

Jelly Bean offers a MediaCodec class. While it does not have a "give me a list of supported codecs", it does have createEncoderByType(), where you pass in a MIME type. Presumably, that will throw a RuntimeException or return null if your desired MIME type is not supported. And I cannot promise that just because MediaCodec reports that an encoder is available that it is guaranteed to work from, say, MediaRecorder.