如何创建一个舞台惊险插件 [英] How to create a stagefright plugin

查看:28
本文介绍了如何创建一个舞台惊险插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务涉及将视频解码器集成到 Stagefright(Android 的多媒体框架)中.我搜索并发现以下关于为 Stagefright 创建新插件的内容:

I have a task which involves integration of a video decoder into Stagefright(Android's multimedia framework). I searched and found the following about creating a new plugin for Stagefright:

要添加对新格式的支持,您需要:

  • 如果容器还不支持,开发一个新的 Extractor 类.

  • Develop a new Extractor class, if the container is not supported yet.

开发一个新的解码器类,实现StageFright核心读取数据所需的接口.

Develop a new Decoder class, that implements the interface needed by the StageFright core to read the data.

将要读取的文件的 mime 类型与 OMXCodec.cpp 文件中的新解码器相关联,该文件位于 kDecoderInfo 数组中.

Associate the mime-type of the files to read to your new Decoder in the OMXCodec.cpp file, in the kDecoderInfo array.

    static const CodecInfo kDecoderInfo[] = {  
        {MEDIA_MIMETYPE_AUDIO_AAC, "OMX.TI.AAC.decode"},
        {MEDIA_MIMETYPE_AUDIO_AAC, "AACDecoder"},
    };

以上数据是我在网上能找到的所有数据.现在我有一个简单的应用程序,它将一个文件作为输入,并使用 android 中的本机 API 将其呈现在屏幕上.谁能告诉我如何进一步进行.所有这些 OMXCodec.cpp 和其他人从哪里出现,我应该将它们放在我的项目的哪个目录中.请提供相同的解决方案.提前致谢.

The above data is all i could find out on net. Right now i have a simple app that will take a file as an input and render it on the screen using native API's in android. Can anyone please tell me how to proceed further. And from where does all these OMXCodec.cpp and others come into picture and which directory of my project should i have them in. Please provide solutions regarding the same. Thanks in advance.

推荐答案

从您的问题来看,您似乎正在查看针对 Ice-Cream Sandwich 或更早版本的 Android 的建议.您首先应该清楚的是 android 的版本,即 Ice-Cream Sandwich 或之前或 JellyBean 和之后.不同版本的 Android 中编解码器的集成不同.

From your question, it appears that you are looking at a recommendation which is specific for Ice-Cream Sandwich or earlier versions of Android. The first thing you should be clear about is the version of the android i.e. Ice-Cream Sandwich or before or JellyBean and after. The integration of codecs is different across different releases of Android.

我已经评论了您针对 JellyBean 及更高版本的其他问题(参考:Android:如何将解码器集成到多媒体框架)

I have already commented on your other question which is specific for JellyBean and later (Reference: Android: How to integrate a decoder to multimedia framework)

如果您想将您的编解码器集成到 Ice-Cream Sandwich 或更早版本中,您的问题中已经提供了这些步骤.除了将解码器添加到 kDecoderInfo 列表之外,您可能还想设置某些怪癖,如图所示 这里.

If you would like to integrate your codec in Ice-Cream Sandwich or before, the steps are already available in your question. In addition to adding the decoder into kDecoderInfo list, you may like to setup certain quirks as shown here.

关于 OMXCodec.cpp 的问题,您可以在以下位置找到此文件frameworks/base/media/libstagefright/Ice-Cream Sandwichframeworks/av/media/libstagefright/>果冻豆.

For the question on OMXCodec.cpp, you can find this file at frameworks/base/media/libstagefright/ in case of Ice-Cream Sandwich and frameworks/av/media/libstagefright/ in case of JellyBean.

如果您已按照所有步骤将视频解码器集成到 Stagefright 框架中,那么最简单的测试将是执行以下操作:

If you have followed all the steps to integrate the video decoder into the Stagefright framework, then the easiest test would be to perform the following:

  1. 将媒体文件复制到 SD 卡中

  1. Copy a media file into SD-Card

OMXCodec.cpp 中,通过删除此语句 //#define LOG_NDEBUG 0 中的注释来启用日志并运行 mm 在目录中.将重建的 libstagefright.so 复制到您设备上的 /system/lib.

In OMXCodec.cpp, enable logs by removing the comment in this statement //#define LOG_NDEBUG 0 and run a mm in the directory. Copy the rebuilt libstagefright.so to /system/lib on your device.

启用 logcat 并开始捕获日志.

Enable logcat and start capturing logs.

转到图库,选择您的文件并允许标准播放器播放您的文件.

Goto gallery, select your file and allow the standard player to play your file.

如果播放器通过搜索您的组件名称选择了您的 OMX 组件,请检查您的日志文件.如果找到,则您将编解码器集成到 Stagefright 中是成功的.否则,您将不得不调试并找出问题所在.

Check your log file if the player has selected your OMX component by searching for your component name. If found, your integration of codec into Stagefright is successful. Else, you will have to debug and find out what is the problem.

后记:

  1. 根据您的查询,我认为您并不熟悉 Android 资源.请参阅 androidxref 站点以熟悉 AOSP 发行版.

  1. Based on your queries, I presume you aren't familiar with Android sources. Please refer to androidxref site to become familiar with AOSP distributions.

除非您计划支持新的媒体文件格式,否则您不需要支持 Extractor 类.MediaExtractor 对文件格式解析器进行抽象化,并帮助解复用媒体文件中的不同轨道.

Unless you are planning to support a new media file-format, you will not require to support Extractor class. MediaExtractor abstracts a file-format parser and helps to de-multiplex the different tracks in a media file.

我希望有了这些信息,您应该能够在 Android 中集成和运行您的编解码器.

I hope with this information, you should be able to get your codec integrated and functional in Android.

这篇关于如何创建一个舞台惊险插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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