http://blog.csdn.net/matrix_laboratory/article/details/39322749
mediaplayer:
ImediaPlayer:BnMediaPlayer(MediaPlayerService.)、BpMediaPlayer(ImediaPlayer)
MediaPlayerClient:BnMediaPlayerClient(MediaPlayer)、BpMediaPlayerClient(IMediaPlayerClient)
IMediaPlayerService:BnMediaPlayerService(MediaPlayerService)、BpMediaPlayerService(IMediaPlayerService)
StagefrightPlayer架构:
AudioPlayer.cpp AweSomePlayer.cpp (notifyListener_l(MEDIA_SEEK_COMPLETE);)
AudioCallBack -->notifyAudioEOS--->postAudioEOS--->postCheckAudioStatusEvent--->onCheckAudioStatus--->postStreamDoneEvent_l-->onStreamDone-->notifyListener_l
MediaPlayerInterface StagefrightPlayer.cpp MediaPlayerFactory MediaPlayerService (IMediaPlayerClient)MediaPlayer
--->sendEvent------------->(setNotifyCallback)--->(createPlayer)--------->(createPlayer)---------->notify---->notify---->
android_media_MediaPlayer.cpp(JNIMediaPlayerListener: public MediaPlayerListener) MediaPlayer.java
-->env->CallStaticVoidMethod(fields.post_event = env->GetStaticMethodID(clazz, "postEventFromNative",))----->postEventFromNative--->EventHandler
NuPlayer架构:
ACodec.cpp NuPlayerDecoder.cpp MediaCodec.cpp
NuPlayerDecoder.cpp NuPlayerRenderer.cpp
(kWhatCodecNotify) ("callback", &callback) ("callbackID", CB_OUTPUT_AVAILABLE) (MediaCodec::CB_OUTPUT_AVAILABLE) (kWhatOutputBufferDrained)
onMessageReceived(BaseState)-->onOMXMessage-->(MediaCodec:mCodec->setNotificationMessage(kWhatCodecNotify))-->onOMXFillBufferDone--->{onConfigure(setCallback)--->setCallback--->onMessageReceived(kWhatSetCallback)}-->onMessageReceived(kWhatDrainThisBuffer)-->onOutputBufferAvailable--->onMessageReceived(kWhatCodecNotify)-->handleAnOutputBuffer-->q