检查MediaPlayer
(链接)的源代码,该start()
方法如下所示:
public void start() throws IllegalStateException {
stayAwake(true);
_start();
}
_start()
方法如下所示:
private native void _start() throws IllegalStateException;
检查本机_start()
方法(链接)(调用start()
但不应该_start()
因为本机调用而被调用_start()
?):
status_t MediaPlayer::start()
{
ALOGV("start");
Mutex::Autolock _l(mLock);
if (mCurrentState & MEDIA_PLAYER_STARTED)
return NO_ERROR;
if ( (mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_PREPARED |
MEDIA_PLAYER_PLAYBACK_COMPLETE | MEDIA_PLAYER_PAUSED ) ) ) {
mPlayer->setLooping(mLoop);
mPlayer->setVolume(mLeftVolume, mRightVolume);
mPlayer->setAuxEffectSendLevel(mSendLevel);
mCurrentState = MEDIA_PLAYER_STARTED;
status_t ret = mPlayer->start();
if (ret != NO_ERROR) {
mCurrentState = MEDIA_PLAYER_STATE_ERROR;
} else {
if (mCurrentState == MEDIA_PLAYER_PLAYBACK_COMPLETE) {
ALOGV("playback completed immediately following start()");
}
}
return ret;
}
ALOGE("start called in state %d", mCurrentState);
return INVALID_OPERATION;
}
数据在哪里读取?我想检查 Android 如何与 RTSP 一起工作,但我找不到它加载数据的位置。我想知道它是否使用诸如 FFMpeg 之类的库或其他一些实现。
编辑:
为什么使用 JNI 需要这段代码?