status_t MediaPlayer::prepare() { status_t ret; mCurrentState = MEDIA_PLAYER_PREPARING; av_log_set_callback(ffmpegNotify); if ((ret = prepareVideo()) != NO_ERROR) { mCurrentState = MEDIA_PLAYER_STATE_ERROR; return ret; } if ((ret = prepareAudio()) != NO_ERROR) { mCurrentState = MEDIA_PLAYER_STATE_ERROR; return ret; } mCurrentState = MEDIA_PLAYER_PREPARED; return NO_ERROR; }
status_t MediaPlayer::prepare() { __android_log_print(ANDROID_LOG_INFO, TAG, "prepare..."); status_t ret; mCurrentState = MEDIA_PLAYER_PREPARING; av_log_set_callback(ffmpegNotify); if ((ret = prepareVideo()) != NO_ERROR) { __android_log_print(ANDROID_LOG_INFO, TAG, "prepare video fail"); mCurrentState = MEDIA_PLAYER_STATE_ERROR; return ret; } if ((ret = prepareAudio()) != NO_ERROR) { __android_log_print(ANDROID_LOG_INFO, TAG, "prepare audio fail"); mCurrentState = MEDIA_PLAYER_STATE_ERROR; return ret; } mCurrentState = MEDIA_PLAYER_PREPARED; return NO_ERROR; }
status_t MediaPlayer::prepare(JNIEnv *env, jobject thiz) { status_t ret; mCurrentState = MEDIA_PLAYER_PREPARING; av_log_set_callback(ffmpegNotify); if ((ret = prepareVideo()) != NO_ERROR) { mCurrentState = MEDIA_PLAYER_STATE_ERROR; return ret; } //__android_log_print(ANDROID_LOG_INFO, TAG, "skip prepare Audio for now \n "); if ((ret = prepareAudio(env, thiz)) != NO_ERROR) { mCurrentState = MEDIA_PLAYER_STATE_ERROR; return ret; } mCurrentState = MEDIA_PLAYER_PREPARED; return NO_ERROR; }