Android的:如何整合去codeR多媒体框架 [英] Android: How to integrate a decoder to multimedia framework
问题描述
最近我移植一个视频去codeR成功机器人。也倾倒在一个surfaceview的输出,并使用原生API的检查输出。现在,下一个任务是实现播放,暂停,流媒体等,也就是媒体播放器的其他功能。这样做将是一个返工,因为所有这些功能都在Android多媒体框架已经确定。我听说我们可以使我们去codeR作为一个插件并将其集成到Android的多媒体框架。虽然我用Google搜索有关的一样,我很难找到有关的任何相同的信息。所以,我恳请所有的读者提出了一些relavent链接或解决方案,上述问题。在此先感谢,等待你的答复。
Recently i have ported a video decoder to android successfully. Also dumped the output on a surfaceview and checked the output using native API's. Now the next task is to implement play, pause, streaming etc. i.e. the other features of the media player. Doing this will be a rework as all these functionalities are already defined in the android multimedia framework. I heard that we can make our decoder as a plug-in and integrate it into Android's multimedia framework. Although i googled regarding the same, i could hardly find any info regarding the same. So i kindly request any of the readers to suggest some relavent links or solution for the above problem. Thanks in advance, waiting for your reply.
推荐答案
在Android的SF框架中,codeCS通过 media_ codecs.xml
注册。在标准的Android分布,一个例子 media_ codecs.xml
可以发现<一href="http://androidxref.com/4.2.2_r1/xref/development/tools/emulator/system/camera/media_$c$ccs.xml">here.所有的视听组件被注册为 OMX
组件。
In Android SF framework, the codecs are registered through media_codecs.xml
. In standard android distribution, an example media_codecs.xml
can be found here. All audio-visual components are registered as OMX
components.
1。 codeC注册
要注册您的视频去codeR,你就必须添加在℃的新条目;德codeRS&GT;
列表。为了确保您的codeC总是拿起,请确保您的codeC被列为特定的第一个条目 MIME
键入。对于H.264去codeR一个示例项可能如下图所示。
To register your video decoder, you would have to add a new entry under <Decoders>
list. To ensure that your codec is always picked up, please ensure that your codec is listed as the first entry for the specific MIME
type. An example entry for a H.264 decoder could be as below.
<Decoders>
<MediaCodec name="OMX.ABC.XYZ.H264.DECODER" type="video/avc" >
<Quirk name="requires-allocate-on-input-ports" />
<Quirk name="requires-allocate-on-output-ports" />
</MediaCodec>
<MediaCodec name="OMX.google.h264.decoder" type="video/avc" />
其中,
一个 OMX.ABC.XYZ.H264.De codeR
是组件的名称
乙。 视频/ AVC
是 MIME
键入您的组件。在这个例子中,它表示一个 AVC / H.264 视频去codeR。
b. video/avc
is the MIME
type of your component. In this example, it denotes a AVC / H.264 video decoder.
c.The未来2语句表示怪癖
或特殊要求您的组件。在给出的例子,要求分配上,输入端口
表示到 Stagefright
框架组件prefers分配在所有它的输入端口的缓冲区。同样,其他怪癖
的通知,该部门还将preFER分配上它的输出端口。有关支持怪癖
系统的列表,你可以参考功能 OMX codeC :: getComponentQuirks
在<一个href="http://androidxref.com/4.2.2_r1/xref/frameworks/av/media/libstagefright/OMX$c$cc.cpp#236">OMX$c$cc.cpp文件。这些怪异转化为标志,然后由该框架读创建并初始化组件。
c.The next 2 statements denote the quirks
or special requirements of your components. In the given example, requires-allocate-on-input-ports
indicates to the Stagefright
framework that the component prefers to allocate the buffers on all it's input ports. Similarly, the other quirk
is informing that the component will also prefer to allocate on it's output ports. For a list of supported quirks
in the system, you could refer to the function OMXCodec::getComponentQuirks
in OMXCodec.cpp file. These quirks translate into flags which are then read by the framework to create and initialize the components.
在这个例子说明,它表明你的 OMX
组件注册之前的默认的谷歌实现视频去codeR。
In the example illustration, it is shown that your OMX
component is registered prior to the default Google implemented video decoder.
注意:如果在终端设备上尝试这一点,你必须确保该项目被反映在最后 media_ codecs.xml
文件。
NOTE: If you trying this on an end device, you will have to ensure that this entry is reflected in the final media_codecs.xml
file.
2。 OMX核心登记
要创建组件,并确保正确的工厂方法被调用时,你的可以有的注册您的 OMX
核心与 Stagefright
框架。
To create your component and ensure that the correct factory method is invoked, you may have to register your OMX
Core with the Stagefright
framework.
要注册一个新的核心,你必须创建一个新的名为库 libstagefrighthw.so
将在位于 /系统/ lib目录
在你的终端系统。该库将不得不暴露 createOMXPlugin
符号将由则dlsym
照顾。
To register a new core, you will have to create a new library named libstagefrighthw.so
which will be located at /system/lib
in your end system. This library will have to expose a createOMXPlugin
symbol which will be looked by dlsym
.
因此, OMX
核心的登记为: OMXMaster
调用 addVendorPlugin
在内部调用 addPlugin(libstagefrighthw.so)
。在 addPlugin
的 createOMXPlugin
将使用进行查找其中的其他函数指针 makeComponentInstance
, destroyComponentInstance
等被初始化。
The registration of the OMX
core is thus: OMXMaster
invokes addVendorPlugin
which internally invokes addPlugin("libstagefrighthw.so")
. In addPlugin
, the createOMXPlugin
will be looked up using which the other function pointers for makeComponentInstance
, destroyComponentInstance
etc are initialized.
一旦 OMX
内核初始化,您就可以在Android框架内运行自己的组件。为 OMXMaster
基准可以发现<一href="http://androidxref.com/4.2.2_r1/xref/frameworks/av/media/libstagefright/omx/OMXMaster.cpp#46">here.
Once the OMX
core is initialized, you are ready to run your own your component within the android framework. The reference for OMXMaster
can be found here.
通过这些改变,你的视频去codeR被集成到了Android stagefright框架。
With these changes, your video decoder is integrated into the android stagefright framework.
这篇关于Android的:如何整合去codeR多媒体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!