Android的MediaPlayer部分功能是基于Opencore的。
MediaPlayer调用MediaPlayerService使用到OpenCore内容
在MediaPlayerService:createPlayer的时候有三种player的type:
switch (playerType) {
case PV_PLAYER:
LOGV(" create PVPlayer");
p = new PVPlayer();
break;
case SONIVOX_PLAYER:
LOGV(" create MidiFile");
p = new MidiFile();
break;
case VORBIS_PLAYER:
LOGV(" create VorbisPlayer");
p = new VorbisPlayer();
break;
其中PVPlayer是调用OpenCore实现的
在阅读OpenCore的代码的时候,曾经走了一个弯路,就是在读代码的时候没有考虑向上调用的相关性,只看OpenCore内部的代码。
在读OpenCore的代码时opencore\Engines下封装了player和author,而且这两部分在pv提供的文档OpenCORE_brochure.pdf里也是描述成了主要的两个多媒体的处理引擎。
但是在实际的Android调用时,提供上层多媒体处理引擎接口的并不是player和author,而是在opencore/android/中的playerdriver(playerdriver.cpp)。
在分析代码是发现playerdriver的代码和opencore\Engines里的player基本是一样的。可以看出OpenCore集成入Android的时候,开发人员参考原有的引擎重写了接口。
Dec 9, 2008
OpenCore分析
From: Neil.He Time: 2:04:00 AM 0 评论
标签: Android
Nov 19, 2008
读Android代码
终于开始读Android的代码了。
因为工作需要先从OpenCore看起,OpenCore里又从mp3的codec看起,我看,我看,我看看
看不懂,更加头晕的是OpenCore里有两个地方的代码似乎和mp3的decoder有关,我倒是没有兴趣研究Android里的mp3 decoder有多好的算法,只是想看看到底上层是怎么调用mp3 decoder去实现音频播放的。万恶的Android什么文档说明都没有之后硬看了。
总之是看得头疼,mp3的decoder代码在两个地方都有external/opencore/codecs_v2/audio/mp3/dec还有external/opencore/codecs_v2/omx/omx_mp3,从目前看的结果mp3 decoder的实体是在
external/opencore/codecs_v2/omx/omx_mp3里面(在这里面找到了一些类似create,decode,close的操作,名字不一定对但是大体看上去比较像传统的编解码器的API接口,往上跟踪,一层一层的跟,试图找到哪里调用了这里的decode函数接口,跟踪到了一个Run函数,然后我的ubuntu虚拟机挂了,结果昨天没有继续跟踪。但是到这一步看起来跟踪也并不容易了,Run函数在Android代码中有上千个,看来只有找相关Run函数的对象定义了。
总之,没有文档,真是够烦
From: Neil.He Time: 11:29:00 PM 0 评论
标签: Android
Nov 5, 2008
Android
Finally,Google publish the source code of android
The code could be downloaded from the following address
http://source.android.com/
It seems google suggests the developer of android using ubuntu or MacX, they just provide ubuntu and MacX enviroment configure.
Install Git to my Ubuntu and downloaded the code with Ubuntu(It seem ubuntu packet sync is very slow, I install git using almost 1 week).
After get the source code, when build the source code, I meet two errors, the following item need be attention:
1. The compiler(gcc/g++) version should be newer than 4.2
2. The system need be installed libncurses
From: Neil.He Time: 6:47:00 PM 1 评论
标签: Android