CainKernel / CainPlayer

A Simple Android MediaPlayer using FFmpeg, OpenSLES and OpenGLES base on ffplay
GNU General Public License v3.0
104 stars 26 forks source link

能否接入mediacodec做android平台硬解码 #11

Open austin98x opened 5 years ago

austin98x commented 5 years ago

能否接入mediacodec做android平台硬解码

CainKernel commented 5 years ago

可以的,现在播放器是支持Android5.0以上的AMediaCodec,你把PlayerState中的videoCodecName设置为H264_mediacodec即可,libffmpeg.sohttp://libffmpeg.so中已经开了硬解码了。现在播放器还没暴露出设置这些的方法,你可以参考ijkplayer的方式暴露出一个setOption方法进行设置。

发自我的小米手机 在 Austin notifications@github.com,2019年2月19日 上午10:45写道:

能否接入mediacodec做android平台硬解码

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/CainKernel/CainPlayer/issues/11, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AK7ZPKHYD9XedHTOmc-QFUDoG8TFkDCiks5vO2VKgaJpZM4bCDof.

CainKernel commented 5 years ago

我刚在播放器里面添加了setOption方法,可以通过以下方式指定播放器使用MediaCodec: mCainMediaPlayer.setOption(CainMediaPlayer.OPT_CATEGORY_PLAYER, "vcodec", "h264_mediacodec"); 这个是用FFmpeg自身支持的硬解码方式,只支持Android 5.0以上版本。我这边测试过了,你看看是否遇到什么问题没有。

austin98x commented 5 years ago

这个方法可以使用,可以硬解码了