I want to know how a default media player works.Like how it scans all songs in sd card,how it displays them,so overall entire working on default media player.
I want this information so that I can compare it with my custom media player and check how fast my media player is working as compared to default one.I have tried searching internet but was not able to find some relevant information related to this.
Your question is very broad in perspective and hence, I will refer you to corresponding paths to get an understanding of the overall system.
First, the overall processing of media files
starts from the Gallery
application. Though not the entry point, ImageCacheRequest
could be a good reference point to start the study, which shows how a cached image is read and rendered onto the screen.
Next, to understand how this thumbnail is generated, you will have to refer to ThumbnailManager.java
which is invoked from camera
, mms
etc.
Thumbnail
class internally employs MediaMetadataRetriever
which is the main class for retrieving the thumbnail data.
MediaMetadataRetriever
has a corresponding JNI
implementation as shown here. The main function of interest is getFrameAtTime
.
The most common implementation is StagefrightMetadataRetriever
, which works on a simple principle. First, a MediaExtractor
i.e. a parser is created which will sniff out the media-file type and create a corresponding parser entity as shown here. Next, the parser will then invoke a codec to decode the corresponding key frame at the requested time stamp and provide the image back as can be observed in extractVideoFramewithFlags
.
Inside this function, a codec is created, frame is decoded, color converted and returned back to the caller which will transfer the same to the higher application.
In a nutshell, I feel your player will not come into picture and as long as the corresponding parsers and codecs are registered with the system, the thumbnails will be generated .