WEB开发网
开发学院手机开发Android 开发 Android 下的PVPlayer的实现 阅读

Android 下的PVPlayer的实现

 2010-09-10 01:08:00 来源:WEB开发网   
核心提示:return UNKNOWN_ERROR;}setDataSource(fd, 0, 0x7fffffffffLL); // this sets mStatusclose(fd);return mStatus;} else {player_type playerType = getPlayerType(url);LOG

return UNKNOWN_ERROR;

}

setDataSource(fd, 0, 0x7fffffffffLL); // this sets mStatus

close(fd);

return mStatus;

} else {

player_type playerType = getPlayerType(url);

LOGV("player type = %d", playerType);

// create the right type of player

sp p = createPlayer(playerType);

if (p == NULL) return NO_INIT;

if (!p->hardwareOutput()) {

mAudioOutput = new AudioOutput();

static_cast(p.get())->setAudioSink(mAudioOutput);

}

// now set data source

LOGV(" setDataSource");

mStatus = p->setDataSource(url);

if (mStatus == NO_ERROR) mPlayer = p;

return mStatus;

}

}

status_t MediaPlayerService::Client::setDataSource(int fd, int64_t offset, int64_t length)

{

LOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);

struct stat sb;

int ret = fstat(fd, &sb);

if (ret != 0) {

LOGE("fstat(%d) failed: %d, %s", fd, ret, strerror(errno));

return UNKNOWN_ERROR;

}

LOGV("st_dev = %llu", sb.st_dev);

LOGV("st_mode = %u", sb.st_mode);

LOGV("st_uid = %lu", sb.st_uid);

LOGV("st_gid = %lu", sb.st_gid);

LOGV("st_size = %llu", sb.st_size);

if (offset >= sb.st_size) {

LOGE("offset error");

::close(fd);

return UNKNOWN_ERROR;

}

if (offset + length > sb.st_size) {

length = sb.st_size - offset;

LOGV("calculated length = %lld", length);

}

player_type playerType = getPlayerType(fd, offset, length);

LOGV("player type = %d", playerType);

// create the right type of player

上一页  1 2 3 4 5 6 7 8  下一页

Tags:Android PVPlayer 实现

编辑录入:coldstar [复制链接] [打 印]
赞助商链接