Android平台Stagefright中增加flv/f4v支援及相關原理介紹

來源:互聯網
上載者:User

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.

--------------------------------------------------------------------------------------------------------------------

先在此打個樁,容我日後完善此篇部落格。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.