1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

cellAtracXdec: review fixes

This commit is contained in:
capriots 2024-08-05 17:14:48 +02:00 committed by Megamouse
parent e678931cee
commit 7f2534819e
3 changed files with 9 additions and 10 deletions

View File

@ -325,7 +325,7 @@ struct AdecCb
vm::bptr<void> cbArg; vm::bptr<void> cbArg;
}; };
typedef AdecCb<CellAdecCbMsg> CellAdecCb; using CellAdecCb = AdecCb<CellAdecCbMsg>;
// AU Info // AU Info
struct CellAdecAuInfo struct CellAdecAuInfo
@ -409,7 +409,7 @@ using CellAdecCoreOpClose = error_code(vm::ptr<void> coreHandle);
using CellAdecCoreOpStartSeq = error_code(vm::ptr<void> coreHandle, vm::cptr<void> param); using CellAdecCoreOpStartSeq = error_code(vm::ptr<void> coreHandle, vm::cptr<void> param);
using CellAdecCoreOpEndSeq = error_code(vm::ptr<void> coreHandle); using CellAdecCoreOpEndSeq = error_code(vm::ptr<void> coreHandle);
using CellAdecCoreOpDecodeAu = error_code(vm::ptr<void> coreHandle, s32 pcmHandle, vm::cptr<CellAdecAuInfo> auInfo); using CellAdecCoreOpDecodeAu = error_code(vm::ptr<void> coreHandle, s32 pcmHandle, vm::cptr<CellAdecAuInfo> auInfo);
using CellAdecCoreOpGetVersion = void(vm::ptr<std::array<u8, 4>> version); using CellAdecCoreOpGetVersion = void(vm::ptr<be_t<u32, 1>> version);
using CellAdecCoreOpRealign = error_code(vm::ptr<void> coreHandle, vm::ptr<void> outBuffer, vm::cptr<void> pcmStartAddr); using CellAdecCoreOpRealign = error_code(vm::ptr<void> coreHandle, vm::ptr<void> outBuffer, vm::cptr<void> pcmStartAddr);
using CellAdecCoreOpReleasePcm = error_code(vm::ptr<void> coreHandle, s32 pcmHandle, vm::cptr<void> outBuffer); using CellAdecCoreOpReleasePcm = error_code(vm::ptr<void> coreHandle, s32 pcmHandle, vm::cptr<void> outBuffer);
using CellAdecCoreOpGetPcmHandleNum = s32(); using CellAdecCoreOpGetPcmHandleNum = s32();

View File

@ -414,7 +414,7 @@ void AtracXdecContext::exec(ppu_thread& ppu)
if (int err = avcodec_send_packet(decoder.ctx, decoder.packet); err) if (int err = avcodec_send_packet(decoder.ctx, decoder.packet); err)
{ {
// These errors should never occur // These errors should never occur
if (err == AVERROR(EAGAIN) || err == AVERROR_EOF || err == AVERROR(EINVAL) || err == AVERROR(ENOMEM)) if (err == AVERROR(EAGAIN) || err == averror_eof || err == AVERROR(EINVAL) || err == AVERROR(ENOMEM))
{ {
fmt::throw_exception("avcodec_send_packet() failed (err=0x%x='%s')", err, utils::av_error_to_string(err)); fmt::throw_exception("avcodec_send_packet() failed (err=0x%x='%s')", err, utils::av_error_to_string(err));
} }
@ -425,7 +425,7 @@ void AtracXdecContext::exec(ppu_thread& ppu)
av_frame_unref(decoder.frame); av_frame_unref(decoder.frame);
} }
else if (err = avcodec_receive_frame(decoder.ctx, decoder.frame)) else if ((err = avcodec_receive_frame(decoder.ctx, decoder.frame)))
{ {
fmt::throw_exception("avcodec_receive_frame() failed (err=0x%x='%s')", err, utils::av_error_to_string(err)); fmt::throw_exception("avcodec_receive_frame() failed (err=0x%x='%s')", err, utils::av_error_to_string(err));
} }
@ -433,7 +433,7 @@ void AtracXdecContext::exec(ppu_thread& ppu)
decoded_samples_num = decoder.frame->nb_samples; decoded_samples_num = decoder.frame->nb_samples;
ensure(decoded_samples_num == 0u || decoded_samples_num == ATXDEC_SAMPLES_PER_FRAME); ensure(decoded_samples_num == 0u || decoded_samples_num == ATXDEC_SAMPLES_PER_FRAME);
// The first frame after a starting a new sequence or after an error is replaced with silence // The first frame after starting a new sequence or after an error is replaced with silence
if (skip_next_frame && error == CELL_OK) if (skip_next_frame && error == CELL_OK)
{ {
skip_next_frame = false; skip_next_frame = false;
@ -781,16 +781,13 @@ error_code _CellAdecCoreOpDecodeAu_atracx(ppu_thread& ppu, vm::ptr<AtracXdecCont
return handle->send_command<AtracXdecCmdType::decode_au>(ppu, pcmHandle, *auInfo); return handle->send_command<AtracXdecCmdType::decode_au>(ppu, pcmHandle, *auInfo);
} }
void _CellAdecCoreOpGetVersion_atracx(vm::ptr<u8> version) void _CellAdecCoreOpGetVersion_atracx(vm::ptr<be_t<u32, 1>> version)
{ {
cellAtracXdec.notice("_CellAdecCoreOpGetVersion_atracx(version=*0x%x)", version); cellAtracXdec.notice("_CellAdecCoreOpGetVersion_atracx(version=*0x%x)", version);
ensure(!!version); // Not checked on LLE ensure(!!version); // Not checked on LLE
version[0] = 0x01; *version = 0x01020000;
version[1] = 0x02;
version[2] = 0x00;
version[3] = 0x00;
} }
error_code _CellAdecCoreOpRealign_atracx(vm::ptr<AtracXdecContext> handle, vm::ptr<void> outBuffer, vm::cptr<void> pcmStartAddr) error_code _CellAdecCoreOpRealign_atracx(vm::ptr<AtracXdecContext> handle, vm::ptr<void> outBuffer, vm::cptr<void> pcmStartAddr)

View File

@ -12,6 +12,8 @@ extern "C"
{ {
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"
} }
constexpr int averror_eof = AVERROR_EOF; // Workaround for old-style-cast error
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(pop) #pragma warning(pop)
#else #else