Using MediaCodec asynchronously to decode and render a Video File

拜拜、爱过 提交于 2019-11-28 13:01:36

问题


Recently started toying around with the Android Media Codec class to render the video frames from a Native C++ application. Was able to successfully decode and render both audio and video streams using Android MediaCodec class using synchronous approach[queueInputBuffer and deququeInputBuffer].

Android has a good reference example of how to do it in Native C++ Application. Ex : SimplePlayer.cpp

Now i have started with the implementation of asynchronous approach using callbacks and feed the input streams to codec in those callbacks[OnInputBufferAvailable/ OnOutPutBufferAvailable].

I was searching around for a sample code on internet and all i can find are the references which are based on Java MediaCodec class.

If anyone has any sample reference code or any links to the C++ based asynchronous usage of MediaCodec to render a video file, that would be great.

Any guidance on this would also be great on this.


回答1:


An example of converting the ExtractDecodeEditEncodeMuxTest example from synchronous mode to asynchronous mode is available at https://github.com/mstorsjo/android-decodeencodetest. See the commit history for all the steps leading up to this.

This isn't C++ and it isn't for rendering, but it covers a few of the essential aspects at least.



来源:https://stackoverflow.com/questions/50880232/using-mediacodec-asynchronously-to-decode-and-render-a-video-file

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