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.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
In Android SF framework, the codecs are registered through
media_codecs.xml
. In standard android distribution, an examplemedia_codecs.xml
can be found here. All audio-visual components are registered asOMX
components.1. Codec Registration
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 specificMIME
type. An example entry for a H.264 decoder could be as below.Where,
a.
OMX.ABC.XYZ.H264.Decoder
is the name of your componentb.
video/avc
is theMIME
type of your component. In this example, it denotes a AVC / H.264 video decoder.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 theStagefright
framework that the component prefers to allocate the buffers on all it's input ports. Similarly, the otherquirk
is informing that the component will also prefer to allocate on it's output ports. For a list of supportedquirks
in the system, you could refer to the functionOMXCodec::getComponentQuirks
in OMXCodec.cpp file. These quirks translate into flags which are then read by the framework to create and initialize the components.In the example illustration, it is shown that your
OMX
component is registered prior to the default Google implemented video decoder.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 Core Registration
To create your component and ensure that the correct factory method is invoked, you may have to register your
OMX
Core with theStagefright
framework.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 acreateOMXPlugin
symbol which will be looked bydlsym
.The registration of the
OMX
core is thus:OMXMaster
invokesaddVendorPlugin
which internally invokesaddPlugin("libstagefrighthw.so")
. InaddPlugin
, thecreateOMXPlugin
will be looked up using which the other function pointers formakeComponentInstance
,destroyComponentInstance
etc are initialized.Once the
OMX
core is initialized, you are ready to run your own your component within the android framework. The reference forOMXMaster
can be found here.With these changes, your video decoder is integrated into the android stagefright framework.