Android mediaplayer + stagefright framework (audio) diagram

Source: Internet
Author: User

In the android native Media Player, mediaplayerservice controls the Media Player. mediaplayerservice creates a mediaplayer and mediaplayer. the native method of Java calls the method in android_media_mediaplayer.cpp through JNI, and then calls mediaplayer. the method in CPP. mediaplayer calls the method in mediaplayerservice through the IPC Mechanism. mediaplayerservice selects a different player to play the music by judging the file format. When it is a MIDI format, sonivox is used to play the music, vorbris is used when the system configuration file allows the Ogg format to be played by vorbris; otherwise, stagefright is used for playback. The remaining formats are determined by the configuration file to determine whether stagefright is used for playing, but stagefright is used for playing, not pvplayer of opencore.
Stagefright is controlled by awesongplayer. It calls the setdatasource () method to load the audio file and selects different Resolvers based on different audio file header fields, this parser isolates audiotrack and videotrack from AV, and then selects different encoders for Encoding Based on the minetype type of audiotrack. This is decoded by audiosource, audiosource is an encapsulation of omxcodec, while audioplayer is used to control audiosource and audiotrack. Audioplayer calls the fillbuffer () method to write the decoded data into the data stream with the final de-code in the data, and finally transmits it to audiotrack. audiotrack then delivers the data to audioflinger. audiotrack calls creataudiotrack () to get the iaudiotrack returned by audioflinger, write the data stream into the iaudiotrack's shared buffer, and then audioflinger reads the data in the cache and submits it to playbacktread for mixing or directly outputting it to the cache and finally giving the data to audiooutput.

Related Article

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.