This commit is contained in:
Martin Baliet 2024-05-05 19:03:39 +02:00
parent 4e0e3280d9
commit 8de97550b8
4 changed files with 39 additions and 3 deletions

View File

@ -220,6 +220,8 @@ class FileManager: public IFileManager {
if ((*dir->m_file) == endDir) return 0;
#pragma pack(push, 1)
struct DataStruct {
uint32_t fileno;
uint16_t reclen;
@ -228,6 +230,8 @@ class FileManager: public IFileManager {
char name[256];
};
#pragma pack(pop, 1)
auto count = dir->count;
int n = 0;
@ -237,7 +241,7 @@ class FileManager: public IFileManager {
auto const filename = (*dir->m_file)->path().filename().string();
if (sizeof(DataStruct) + std::min(filename.size(), 255llu) >= nbytes) break;
item->fileno = 0;
item->fileno = count;
item->type = ((*dir->m_file)->is_regular_file() ? 8 : 4);
item->namlen = filename.copy(item->name, 255);
item->name[item->namlen] = '\0';
@ -245,7 +249,7 @@ class FileManager: public IFileManager {
n += sizeof(DataStruct);
item->reclen = sizeof(DataStruct);
LOG_DEBUG(L"KernelGetdirentries[%d]: %S %u offset:%u count:%u", handle, item->name, item->type, item->reclen, count);
LOG_DEBUG(L"KernelGetdirentries[%d]: %S %u offset:%u count:%u", handle, item->name, item->type, n, count);
std::error_code err;
(*dir->m_file).increment(err);

View File

@ -279,7 +279,9 @@ bool Avplayer::getVideoData(void* info, bool isEx) {
if (retRecv < 0) {
if (retRecv == AVERROR(EAGAIN)) {
if (!m_isStop) {
LOG_DEBUG(L"-> wait video frame");
m_video.m_cond.wait(lock);
LOG_DEBUG(L"<- wait video frame");
continue;
}
} else if (retRecv != AVERROR_EOF) {
@ -310,6 +312,7 @@ bool Avplayer::getVideoData(void* info, bool isEx) {
auto const timestamp = (int64_t)(1000.0 * av_q2d(m_video.stream->time_base) * m_video.frame->best_effort_timestamp); // timestamp[seconds] to [ms]
auto const curTime = (av_gettime() - m_startTime) / 1000; // [us] to [ms]
LOG_DEBUG(L"video frame timestamp:%lld", curTime);
if (timestamp > curTime) {
return false;
}
@ -385,7 +388,9 @@ bool Avplayer::getAudioData(SceAvPlayerFrameInfo* info) {
if (retRecv < 0) {
if (retRecv == AVERROR(EAGAIN)) {
if (!m_isStop) {
LOG_DEBUG(L"-> wait audio frame");
m_audio.m_cond.wait(lock);
LOG_DEBUG(L"<- wait audio frame");
continue;
}
} else if (retRecv != AVERROR_EOF) {
@ -522,7 +527,7 @@ std::unique_ptr<std::thread> Avplayer::threadFunc() {
LOG_DEBUG(L"Queue Video Packet: numItems:%llu pts:%lld", m_video.decodeQueue.size(), packet->pts);
} else if (packet->stream_index == m_audio.streamIndex) {
m_audio.decodeQueue.push(packet);
LOG_DEBUG(L"Queue Video Packet: numItems:%llu pts:%lld", m_video.decodeQueue.size(), packet->pts);
LOG_DEBUG(L"Queue Audio Packet: numItems:%llu pts:%lld", m_audio.decodeQueue.size(), packet->pts);
} else
continue;
}

View File

@ -30,39 +30,57 @@ EXPORT SYSV_ABI int32_t sceAvPlayerAddSource(IAvplayer* avPlayer, const char* fi
}
EXPORT SYSV_ABI int32_t sceAvPlayerStreamCount(IAvplayer* avPlayer) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerGetStreamInfo(IAvplayer* avPlayer, uint32_t argStreamID, SceAvPlayerStreamInfo* argInfo) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerEnableStream(IAvplayer* avPlayer, uint32_t argStreamID) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerDisableStream(IAvplayer* avPlayer, uint32_t argStreamID) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerChangeStream(IAvplayer* avPlayer, uint32_t argOldStreamID, uint32_t argNewStreamID) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerStart(IAvplayer* avPlayer) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerStop(IAvplayer* avPlayer) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
avPlayer->stop();
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerPause(IAvplayer* avPlayer) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerResume(IAvplayer* avPlayer) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
@ -85,18 +103,26 @@ EXPORT SYSV_ABI bool sceAvPlayerGetVideoData(IAvplayer* avPlayer, SceAvPlayerFra
}
EXPORT SYSV_ABI uint64_t sceAvPlayerCurrentTime(IAvplayer* avPlayer) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerJumpToTime(IAvplayer* avPlayer, uint64_t argJumpTimeMsec) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerSetTrickSpeed(IAvplayer* avPlayer, int32_t argTrickSpeed) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceAvPlayerSetAvSyncMode(IAvplayer* avPlayer, SceAvPlayerAvSyncMode argSyncMode) {
LOG_USE_MODULE(libSceAvPlayer);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}

View File

@ -87,6 +87,7 @@ EXPORT SYSV_ABI int32_t scePlayGoSetInstallSpeed(ScePlayGoHandle handle, ScePlay
EXPORT SYSV_ABI int32_t scePlayGoGetInstallSpeed(ScePlayGoHandle handle, ScePlayGoInstallSpeed* speed) {
LOG_USE_MODULE(libScePlayGo);
LOG_ERR(L"TODO: %S", __FUNCTION__);
*speed = 2;
return Ok;
}