Added FLV/f4v support and related principles in stagefright of Android platform

Source: Internet
Author: User

The stagefright framework of the Android platform has very few documents. The following two articles are good. For details, refer:

Http://blogold.chinaunix.net/u1/57901/showart_2423206.html

Http://blogold.chinaunix.net/u2/61880/showart_2339481.html

I recently added FLV support to stagefright on the Android platform of NV tegra2. Basically, all local and online FLV (h264 + AAC) files can be played normally. There are still a lot of details, and it may take several days to get stuck in a small detail.

Bytes --------------------------------------------------------------------------------------------------------------------

The whole video playing process (I am too lazy to draw a picture ):
Mediaplayerservice calls stagefrightplayer
Stagefrightplayer calls awesomeplayer
Awesomeplayer calls omxcodec
Omxcodec calls related methods in Extractor
Omxcodec calls the android standard iomx interface (that is, the OMX implementation in stagefright), OMX calls omxmaster, and omxmaster calls the omxpluginbase plug-in interface to obtain the external codec plug-in.
Omxcodec calls the render module for rendering

Bytes --------------------------------------------------------------------------------------------------------------------

Google teaches us how to add FLAC support to stagefright. The same applies to other audio and video formats (however, videos are much harder to use than pure audio ):

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.

Bytes --------------------------------------------------------------------------------------------------------------------

I will post a post here to improve this blog.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.