Android Media--stagefright Overview "one"

Source: Internet
Author: User
Tags id3 id3 tag

Recently assorted busy, a few days ago to see this part is mainly Stagefright module, so change the name

Did a long time on the Android platform Media Development, the previous analysis of a phased summary.

First, the Android structure diagram (context relationship)

Second, the Android folder structure

Since the android4.2 version number, the relevant code of the media are placed in the framework/av/folder, commonly known as "AV Worker", hehe (local code is not too sound, folder I manually knocked, company code sound, Direct Export folder tree)

|-----media|       | |       | --Libmedia_native   //jni Interactive part, can be seen from the name | | | |       --Libmedia          //A service-side agent, the corresponding layer to provide the relevant interface, and server-side interaction |       | | |       --Libmediaplayerservice//service segment (distributor, role of switch, personal understanding) |       | |       | --Libstagefright  //branch of a server, support work |       | |       | --MediaServer     //media process, management media Some related information, less attention | | | |       --MTP           //directory manipulation media related things |       |


Further, let's see what Stagefright contains.

|--stagefright|   | |   | --Codecs   //provide decoder implementation |   | |   | --colorconversion   //color Space conversion |   |   | | --Foundation   //Basic data Structure Implementation |   | |   | --httplive   //m3u8 Analysis |   |   | | --ID3        //ID3 tag parsing (typically metadata container for MP3 format) | | |   | --Include    //Basic Header file |   | |   | --Matroska   //matroska file parsing |   | |   | --mpeg2ts    //mpeg2ts file parsing and data acquisition some processing | | |   | --MP4        //mp4 's Format parsing |   | |   | --OMX        //IOMX Interface Implementation |   | |   | --RTSP       //rtsp file parsing |   | |   | --wifi-display//handling of WiFi |   | |   | --         data processing of YUV//YUV |   |


Iii. interface events with "Fear of speech"

Event handling interface for local media

Stage Fright English means: The Speaker of fear, awesomeplayer powerful player

This is also true in Android, where the "scary speaker" has a powerful interface and event-handling interface, but it does not implement, but all passes through the Awesomeplayer, and at its initialization, it directly instantiates the powerful player and listens to its settings. The code is as follows:

StageFrightPlayer.cpp

Stagefrightplayer::stagefrightplayer ()    : MPlayer (new Awesomeplayer) {    alogv ("Stagefrightplayer");    Mplayer->setlistener (this);}

Interface Basic Invocation Process:

1.Java Layer calls C + + MediaPlayer related interfaces via JNI

The server-side client is created in 2.mediaPlayerService, and the relevant player is instantiated, where the interface event is called to a detailed player such as: local media call Stagefright, streaming media call Nuplayerdriver

3.stagefright will call the Awesomeplayer interface, in fact the streaming media side and local media similar, and finally will call Nuplayer

Media Event Type

Enum Media_event_type {    Media_nop               = 0,//interface test message    media_prepared          = 1,//media ready to complete medium    _playback_complete = 2,//Play event    media_buffering_update  = 3,//buffer update event, updated value is percent    media_seek_complete     = 4,//seek event    Media_set_video_size    = 5,//Video size    media_timed_text        = 99,//subtitle-related, basic without    media_error             = 100,// Error    Media_info              = 200,//media specific information};


STAGEFRIGHT module Structure

Stagefright Module Structure diagram

1.mediaPlayerservice calls the stagefright corresponding interface

2.Stagefright calls the Awesomeplayer corresponding interface

3.AwesomePlayer call Omxcode to read ES data, and to decode the processing

4.OMXCodec call MediaSource's read function to get audio and video data

5.OMXCodec calls Android's IOMX interface, which is actually the OMX implementation in STAGEFRIGHTDE

6. OMX calls Omxmaster, and Omxmaster calls Omxpluginbase interface, here is also able to get the external codec plug-in, finally call the corresponding decoding set up to complete decoding, different decoding components are not quite the same, the following will do the introduction

7. After decoding, the bare stream data returned by OMXCODEC will call the render module in Awesomeplayer to render, thus providing the user with the screen

After the ad, more exciting ^.#

Android Media--stagefright Overview "one"

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.