Android平台Stagefright中增加flv/f4v支持及相关原理介绍
2016-05-26 21:57
447 查看
http://blog.csdn.net/bonderwu/article/details/6261798
Android平台Stagefright框架的文档非常少,以下两篇文章比较好,可以参考一下:
http://blogold.chinaunix.net/u1/57901/showart_2423206.html
http://blogold.chinaunix.net/u2/61880/showart_2339481.html
笔者最近在NV Tegra2的Android平台完成了stagefright中增加flv支持,基本能正常播所有本地和在线flv(h264+aac)文件。细节还是非常多的,一不留神就可能在一个小细节上卡上好几天。
--------------------------------------------------------------------------------------------------------------------
整个视频播放的过程(我就懒得画图了):
MediaPlayerService调用StagefrightPlayer
StagefrightPlayer调用AwesomePlayer
AwesomePlayer调用OMXCodec
OMXCodec调用Extractor中相关方法
OMXCodec调用Android标准的IOMX接口(即Stagefright中的OMX实现),OMX实现调用OMXMaster,OMXMaster调用OMXPluginBase插件接口获得外部codec的插件
OMXCodec调用render模块实现渲染
--------------------------------------------------------------------------------------------------------------------
Google大牛教我们如何在Stagefright中增加FLAC的支持,其他音视频格式同理(不过视频比纯音频要难得多):
There is no documentation on Stagefright. I haven't tried implementing a new stream type yet, but it does look pretty straightforward:
1. Create a FLAC stream extractor. See MP3Extractor.cpp or AMRExtractor.cpp for examples of audio stream extractors. It needs to be able to handle things like sniff a file to recognize FLAC content, seek in the stream, resync, etc. Add the new extractor to
the list of stream extractors registered in DataSource.cpp.
2. Create a FLAC decoder node. See MP3Decoder.cpp or AMRNBDecoder.cpp for examples. Add the new codec to various places in OMXCodec.cpp so that the player engine can find it. Add the new mime type to the list of supported formats.
3. Add the FLAC Container format to the MediaScanner (3 place if I remember
correctly). This may already in Kenny's original FLAC submission.
4. Add FLAC to the unit tests in the media test framework.
This took all of about 5 minutes of spelunking in the code. The trick is just to use the existing audio formats as a guide.
--------------------------------------------------------------------------------------------------------------------
先在此打个桩,容我日后完善此篇博客。
Android平台Stagefright框架的文档非常少,以下两篇文章比较好,可以参考一下:
http://blogold.chinaunix.net/u1/57901/showart_2423206.html
http://blogold.chinaunix.net/u2/61880/showart_2339481.html
笔者最近在NV Tegra2的Android平台完成了stagefright中增加flv支持,基本能正常播所有本地和在线flv(h264+aac)文件。细节还是非常多的,一不留神就可能在一个小细节上卡上好几天。
--------------------------------------------------------------------------------------------------------------------
整个视频播放的过程(我就懒得画图了):
MediaPlayerService调用StagefrightPlayer
StagefrightPlayer调用AwesomePlayer
AwesomePlayer调用OMXCodec
OMXCodec调用Extractor中相关方法
OMXCodec调用Android标准的IOMX接口(即Stagefright中的OMX实现),OMX实现调用OMXMaster,OMXMaster调用OMXPluginBase插件接口获得外部codec的插件
OMXCodec调用render模块实现渲染
--------------------------------------------------------------------------------------------------------------------
Google大牛教我们如何在Stagefright中增加FLAC的支持,其他音视频格式同理(不过视频比纯音频要难得多):
There is no documentation on Stagefright. I haven't tried implementing a new stream type yet, but it does look pretty straightforward:
1. Create a FLAC stream extractor. See MP3Extractor.cpp or AMRExtractor.cpp for examples of audio stream extractors. It needs to be able to handle things like sniff a file to recognize FLAC content, seek in the stream, resync, etc. Add the new extractor to
the list of stream extractors registered in DataSource.cpp.
2. Create a FLAC decoder node. See MP3Decoder.cpp or AMRNBDecoder.cpp for examples. Add the new codec to various places in OMXCodec.cpp so that the player engine can find it. Add the new mime type to the list of supported formats.
3. Add the FLAC Container format to the MediaScanner (3 place if I remember
correctly). This may already in Kenny's original FLAC submission.
4. Add FLAC to the unit tests in the media test framework.
This took all of about 5 minutes of spelunking in the code. The trick is just to use the existing audio formats as a guide.
--------------------------------------------------------------------------------------------------------------------
先在此打个桩,容我日后完善此篇博客。
相关文章推荐
- 使用android studio 查看android源码
- Android 自定义view:实现ListView下拉的视差特效
- 【android】:android实现一个加法计算器
- Android TabLayout分析
- Android中使用DESMD5Utils对数据进行加密
- Android——Android实现多级菜单联动操作
- 【android】:android 实现String到int的互换
- Android之自定义ListView
- JamesMusic浅读--------3,欢迎界面。
- Android RecyclerView 实现瀑布流效果
- Exception:must implement OnFragmentInteractionListener
- android和js互相调用
- 关于Android的Logcat不显示提示信息的解决办法
- AndroidMalShare评估
- Android:ListView多选,全选,反选,全不全;
- 关于android 5.0调用系统相册闪退
- 浅谈Android自定义View
- Android平台的JNI开发初步
- android wear 相关素材
- android 关于定位我的几点分享?