异步使用MediaCodec解码和呈现视频文件 [英] Using MediaCodec asynchronously to decode and render a Video File

查看:467
本文介绍了异步使用MediaCodec解码和呈现视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近开始玩弄Android Media Codec类,以渲染来自Native C ++应用程序的视频帧.能够使用同步方法[queueInputBuffer和deququeInputBuffer]使用Android MediaCodec类成功解码和呈现音频和视频流.

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有一个很好的参考示例,说明了如何在本机C ++应用程序中执行此操作.例如:SimplePlayer.cpp

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

现在,我开始使用回调实现异步方法,并在这些回调中将输入流馈送到编解码器[OnInputBufferAvailable/OnOutPutBufferAvailable].

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

我正在互联网上搜索示例代码,我所能找到的只是基于Java MediaCodec类的引用.

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.

如果任何人有任何示例参考代码或指向MediaCodec的基于C ++的异步用法的任何链接以呈现视频文件,那将很棒.

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.

推荐答案

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.

这不是C ++,也不是用于渲染,但至少涵盖了一些基本方面.

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

这篇关于异步使用MediaCodec解码和呈现视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆