Android MediaPlayer Architecture — Introduction (2)
This article is for the author's own study. The content of the article only comes from the author's poor thinking. Please don't hesitate to give advice on the problems.
Invalid Sign
Source files involved in this article:
frameworks/av/include/media/mediaplayer.h
frameworks/av/media/libmedia/mediaplayer.cpp
frameworks/av/include/media/IMediaDeathNotifier.h
frameworksav/media/libmedia/IMediaDeathNotifier.cpp
First of all, we should make it clear that getmediaplayerservice () is a public static member function of imediadeathnotifier class, and mediaplayer inherits from imediadeathnotifier, so it can be referenced directly.
Getmediaplayerservice() declaration in imediadeathnotifier class:
Mediaplayer inherits from imediadeathnotifier:
Focus on the definition of getmediaplayerservice () method:
The function implementation of the above code is a typical process of obtaining the binder service through the service manager.
By the way, the registration of mediaplayerservice is completed in MediaServer (frameworks / AV / media / MediaServer / main_mediaserver. CPP)
The instance function of mediaplayerservice: