コード例 #1
0
int prepare(VideoState **ps) {
	VideoState *is = *ps;

	if (is->prepare_sync) {
		return -EALREADY;
	}
	is->prepare_sync = 1;
	int ret = prepareAsync_l(ps);
	if (ret != NO_ERROR) {
		return ret;
	}
	if (is->prepare_sync) {
		while (!is->prepared) {
			sleep(1);
		}

		is->prepare_sync = 0;
	}
	return is->prepare_sync;
}
コード例 #2
0
// TODO: In case of error, prepareAsync provides the caller with 2 error codes,
// one defined in the Android framework and one provided by the implementation
// that generated the error. The sync version of prepare returns only 1 error
// code.
status_t MediaPlayer::prepare()
{
    ALOGV("prepare");
    Mutex::Autolock _l(mLock);
    mLockThreadId = getThreadId();
    if (mPrepareSync) {
        mLockThreadId = 0;
        return -EALREADY;
    }
    mPrepareSync = true;
    status_t ret = prepareAsync_l();
    if (ret != NO_ERROR) {
        mLockThreadId = 0;
        return ret;
    }

    if (mPrepareSync) {
        mSignal.wait(mLock);  // wait for prepare done
        mPrepareSync = false;
    }
    ALOGV("prepare complete - status=%d", mPrepareStatus);
    mLockThreadId = 0;
    return mPrepareStatus;
}
コード例 #3
0
status_t MediaPlayer::prepareAsync()
{
    ALOGV("prepareAsync");
    Mutex::Autolock _l(mLock);
    return prepareAsync_l();
}
コード例 #4
0
int prepareAsync(VideoState **ps) {
  return prepareAsync_l(ps);
}