mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-14 06:40:53 +00:00
cellAdec: review + warning fixes
This commit is contained in:
parent
e7f1a34fe1
commit
9b3b9562c0
@ -8,6 +8,8 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include "util/asm.hpp"
|
#include "util/asm.hpp"
|
||||||
|
|
||||||
|
LOG_CHANNEL(cellAdec);
|
||||||
|
|
||||||
// These need to be defined somewhere to access the LLE functions
|
// These need to be defined somewhere to access the LLE functions
|
||||||
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_ac3;
|
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_ac3;
|
||||||
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_atrac3;
|
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_atrac3;
|
||||||
@ -31,26 +33,24 @@ vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_truehd;
|
|||||||
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_wma;
|
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_wma;
|
||||||
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_WmaLsl;
|
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_WmaLsl;
|
||||||
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_WmaPro;
|
vm::gvar<CellAdecCoreOps> g_cell_adec_core_ops_WmaPro;
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_Celp8(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_Celp8(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_Celp(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_Celp(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_Ddp(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_Ddp(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_DtsCore(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_DtsCore(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_DtsHd_Core(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_DtsHd_Core(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_DtsHd(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_DtsHd(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_DtsLbr(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_DtsLbr(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_Aac(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_Aac(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_mpmc(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_mpmc(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_M4Aac(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_M4Aac(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_M4Aac2ch(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_M4Aac2ch(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_M4Aac2chmod(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_M4Aac2chmod(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_Mp3s(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_Mp3s(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_mpmcl1(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_mpmcl1(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_truehd(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_truehd(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_wma(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_wma(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_WmaLsl(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_WmaLsl(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
[[noreturn]] error_code _SceAdecCorrectPtsValue_WmaPro(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); }
|
error_code _SceAdecCorrectPtsValue_WmaPro(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; }
|
||||||
|
|
||||||
LOG_CHANNEL(cellAdec);
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void fmt_class_string<CellAdecError>::format(std::string& out, u64 arg)
|
void fmt_class_string<CellAdecError>::format(std::string& out, u64 arg)
|
||||||
@ -394,12 +394,13 @@ error_code AdecContext::set_pcm_item(s32 pcm_handle, vm::ptr<void> pcm_addr, u32
|
|||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code AdecContext::link_frame(s32 pcm_handle)
|
error_code AdecContext::link_frame(ppu_thread& ppu, s32 pcm_handle)
|
||||||
{
|
{
|
||||||
std::lock_guard lock{mutex};
|
ensure(sys_mutex_lock(ppu, mutex, 0) == CELL_OK); // Error code isn't checked on LLE
|
||||||
|
|
||||||
if (verify_pcm_handle(pcm_handle) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
if (verify_pcm_handle(pcm_handle) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
||||||
{
|
{
|
||||||
|
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
|
||||||
return CELL_ADEC_ERROR_FATAL;
|
return CELL_ADEC_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,23 +420,27 @@ error_code AdecContext::link_frame(s32 pcm_handle)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
|
||||||
return CELL_ADEC_ERROR_FATAL;
|
return CELL_ADEC_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code AdecContext::unlink_frame(s32 pcm_handle)
|
error_code AdecContext::unlink_frame(ppu_thread& ppu, s32 pcm_handle)
|
||||||
{
|
{
|
||||||
std::lock_guard lock{mutex};
|
ensure(sys_mutex_lock(ppu, mutex, 0) == CELL_OK); // Error code isn't checked on LLE
|
||||||
|
|
||||||
if (verify_pcm_handle(pcm_handle) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
if (verify_pcm_handle(pcm_handle) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
||||||
{
|
{
|
||||||
|
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
|
||||||
return CELL_ADEC_ERROR_FATAL;
|
return CELL_ADEC_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frames_head == -1 || frames_tail == -1)
|
if (frames_head == -1 || frames_tail == -1)
|
||||||
{
|
{
|
||||||
|
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
|
||||||
return CELL_ADEC_ERROR_FATAL;
|
return CELL_ADEC_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,6 +451,7 @@ error_code AdecContext::unlink_frame(s32 pcm_handle)
|
|||||||
{
|
{
|
||||||
if (pcm_handle != frames_tail)
|
if (pcm_handle != frames_tail)
|
||||||
{
|
{
|
||||||
|
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
|
||||||
return CELL_ADEC_ERROR_FATAL;
|
return CELL_ADEC_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,6 +476,7 @@ error_code AdecContext::unlink_frame(s32 pcm_handle)
|
|||||||
frames[prev].next = next;
|
frames[prev].next = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,31 +500,31 @@ error_code AdecContext::correct_pts_value(ppu_thread& ppu, s32 pcm_handle, s8 co
|
|||||||
|
|
||||||
switch (correct_pts_type)
|
switch (correct_pts_type)
|
||||||
{
|
{
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_EAC3: if (ppu_execute<&_SceAdecCorrectPtsValue_Ddp>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_EAC3: return ppu_execute<&_SceAdecCorrectPtsValue_Ddp>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHD: if (ppu_execute<&_SceAdecCorrectPtsValue_DtsHd>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHD: return ppu_execute<&_SceAdecCorrectPtsValue_DtsHd>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_CELP: if (ppu_execute<&_SceAdecCorrectPtsValue_Celp>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_CELP: return ppu_execute<&_SceAdecCorrectPtsValue_Celp>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_M2AAC: if (ppu_execute<&_SceAdecCorrectPtsValue_Aac>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_M2AAC: return ppu_execute<&_SceAdecCorrectPtsValue_Aac>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L2: if (ppu_execute<&_SceAdecCorrectPtsValue_mpmc>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L2: return ppu_execute<&_SceAdecCorrectPtsValue_mpmc>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_TRUEHD: if (ppu_execute<&_SceAdecCorrectPtsValue_truehd>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_TRUEHD: return ppu_execute<&_SceAdecCorrectPtsValue_truehd>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_DTS: if (ppu_execute<&_SceAdecCorrectPtsValue_DtsCore>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_DTS: return ppu_execute<&_SceAdecCorrectPtsValue_DtsCore>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_M4AAC:
|
case ADEC_CORRECT_PTS_VALUE_TYPE_M4AAC:
|
||||||
switch (type.audioCodecType)
|
switch (type.audioCodecType)
|
||||||
{
|
{
|
||||||
case CELL_ADEC_TYPE_M4AAC: if (ppu_execute<&_SceAdecCorrectPtsValue_M4Aac>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case CELL_ADEC_TYPE_M4AAC: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case CELL_ADEC_TYPE_M4AAC_2CH: if (ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2ch>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case CELL_ADEC_TYPE_M4AAC_2CH: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2ch>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case CELL_ADEC_TYPE_M4AAC_2CH_MOD: if (ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2chmod>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case CELL_ADEC_TYPE_M4AAC_2CH_MOD: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2chmod>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
default: return CELL_OK;
|
default: return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_WMA: if (ppu_execute<&_SceAdecCorrectPtsValue_wma>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_WMA: return ppu_execute<&_SceAdecCorrectPtsValue_wma>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_DTSLBR: if (ppu_execute<&_SceAdecCorrectPtsValue_DtsLbr>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_DTSLBR: return ppu_execute<&_SceAdecCorrectPtsValue_DtsLbr>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L1: if (ppu_execute<&_SceAdecCorrectPtsValue_mpmcl1>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L1: return ppu_execute<&_SceAdecCorrectPtsValue_mpmcl1>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_MP3S: if (ppu_execute<&_SceAdecCorrectPtsValue_Mp3s>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_MP3S: return ppu_execute<&_SceAdecCorrectPtsValue_Mp3s>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_CELP8: if (ppu_execute<&_SceAdecCorrectPtsValue_Celp8>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_CELP8: return ppu_execute<&_SceAdecCorrectPtsValue_Celp8>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_WMAPRO: if (ppu_execute<&_SceAdecCorrectPtsValue_WmaPro>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_WMAPRO: return ppu_execute<&_SceAdecCorrectPtsValue_WmaPro>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_WMALSL: if (ppu_execute<&_SceAdecCorrectPtsValue_WmaLsl>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_WMALSL: return ppu_execute<&_SceAdecCorrectPtsValue_WmaLsl>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK1: // Same as below
|
case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK1: // Same as below
|
||||||
case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK2: if (ppu_execute<&_SceAdecCorrectPtsValue_DtsHd_Core>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; }
|
case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK2: return ppu_execute<&_SceAdecCorrectPtsValue_DtsHd_Core>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast<error_code>(CELL_ADEC_ERROR_FATAL) : static_cast<error_code>(CELL_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user didn't set a PTS, we need to interpolate from the previous PTS
|
// If the user didn't set a PTS, we need to interpolate from the previous PTS
|
||||||
@ -670,7 +677,7 @@ error_code adecNotifyPcmOut(ppu_thread& ppu, s32 pcmHandle, vm::ptr<void> pcmAdd
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->link_frame(pcmHandle) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
if (handle->link_frame(ppu, pcmHandle) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
||||||
{
|
{
|
||||||
return CELL_ADEC_ERROR_FATAL;
|
return CELL_ADEC_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
@ -682,7 +689,7 @@ error_code adecNotifyPcmOut(ppu_thread& ppu, s32 pcmHandle, vm::ptr<void> pcmAdd
|
|||||||
return CELL_ADEC_ERROR_FATAL;
|
return CELL_ADEC_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm::ptr<CellAdecPcmItem> pcm_item;
|
vm::ptr<CellAdecPcmItem> pcm_item{};
|
||||||
|
|
||||||
if (handle->get_pcm_item(pcmHandle, pcm_item) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
if (handle->get_pcm_item(pcmHandle, pcm_item) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
||||||
{
|
{
|
||||||
@ -811,7 +818,7 @@ error_code adecOpen(ppu_thread& ppu, vm::ptr<CellAdecType> type, vm::cptr<CellAd
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
new (_this.get_ptr()) AdecContext(_this, this_size, *type, *res, *cb, core_handle, core_ops, pcm_handle_num, frames, bitstream_info_size, bitstream_infos_addr);
|
new (_this.get_ptr()) AdecContext(ppu, _this, this_size, *type, *res, *cb, core_handle, core_ops, pcm_handle_num, frames, bitstream_info_size, bitstream_infos_addr);
|
||||||
|
|
||||||
*handle = _this;
|
*handle = _this;
|
||||||
|
|
||||||
@ -889,6 +896,12 @@ error_code cellAdecClose(ppu_thread& ppu, vm::ptr<AdecContext> handle)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (error_code ret = sys_mutex_destroy(ppu, handle->mutex); ret != CELL_OK)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
handle->_this = vm::null;
|
handle->_this = vm::null;
|
||||||
handle->sequence_state = AdecSequenceState::closed;
|
handle->sequence_state = AdecSequenceState::closed;
|
||||||
|
|
||||||
@ -1060,7 +1073,7 @@ error_code cellAdecGetPcm(ppu_thread& ppu, vm::ptr<AdecContext> handle, vm::ptr<
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->unlink_frame(pcm_item->pcmHandle) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
if (handle->unlink_frame(ppu, pcm_item->pcmHandle) == static_cast<s32>(CELL_ADEC_ERROR_FATAL))
|
||||||
{
|
{
|
||||||
return CELL_ADEC_ERROR_FATAL;
|
return CELL_ADEC_ERROR_FATAL;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cellPamf.h" // CellCodecTimeStamp
|
#include "cellPamf.h" // CellCodecTimeStamp
|
||||||
|
#include "../lv2/sys_mutex.h"
|
||||||
|
|
||||||
// Error Codes
|
// Error Codes
|
||||||
enum CellAdecError : u32
|
enum CellAdecError : u32
|
||||||
@ -498,7 +499,7 @@ class AdecOutputQueue
|
|||||||
vm::bptr<CellAdecPcmItem> pcm_item = vm::null;
|
vm::bptr<CellAdecPcmItem> pcm_item = vm::null;
|
||||||
be_t<s32> pcm_handle = -1;
|
be_t<s32> pcm_handle = -1;
|
||||||
}
|
}
|
||||||
entries[4];
|
entries[4]{ {0}, {1}, {2}, {3} };
|
||||||
|
|
||||||
be_t<s32> front = 0;
|
be_t<s32> front = 0;
|
||||||
be_t<s32> back = 0;
|
be_t<s32> back = 0;
|
||||||
@ -508,8 +509,6 @@ class AdecOutputQueue
|
|||||||
be_t<u32> cond{}; // sys_cond_t, unused
|
be_t<u32> cond{}; // sys_cond_t, unused
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AdecOutputQueue() : entries{ {0}, {1}, {2}, {3} } {}
|
|
||||||
|
|
||||||
error_code push(vm::ptr<CellAdecPcmItem> pcm_item, s32 pcm_handle)
|
error_code push(vm::ptr<CellAdecPcmItem> pcm_item, s32 pcm_handle)
|
||||||
{
|
{
|
||||||
std::lock_guard lock{mutex};
|
std::lock_guard lock{mutex};
|
||||||
@ -591,16 +590,16 @@ struct AdecContext // CellAdecHandle = AdecContext*
|
|||||||
|
|
||||||
const be_t<u32> bitstream_info_size;
|
const be_t<u32> bitstream_info_size;
|
||||||
|
|
||||||
u64 mutex_attribute[5]{}; // sys_mutex_attribute_t
|
sys_mutex_attribute_t mutex_attribute{ 2, 0x20, 0x200, 0x2000, 0, 0, 0, { "_adem03"_u64 } };
|
||||||
shared_mutex mutex; // sys_mutex_t
|
be_t<u32> mutex; // sys_mutex_t
|
||||||
|
|
||||||
AdecOutputQueue pcm_queue; // Output queue for cellAdecGetPcm()
|
AdecOutputQueue pcm_queue; // Output queue for cellAdecGetPcm()
|
||||||
AdecOutputQueue pcm_item_queue; // Output queue for cellAdecGetPcmItem()
|
AdecOutputQueue pcm_item_queue; // Output queue for cellAdecGetPcmItem()
|
||||||
|
|
||||||
u8 reserved2[1028];
|
u8 reserved2[1028];
|
||||||
|
|
||||||
AdecContext(vm::bptr<AdecContext> _this, u32 this_size, const CellAdecType& type, const CellAdecResource& res, const CellAdecCb& callback, vm::bptr<void> core_handle, vm::bcptr<CellAdecCoreOps> core_ops,
|
AdecContext(ppu_thread& ppu, vm::bptr<AdecContext> _this, u32 this_size, const CellAdecType& type, const CellAdecResource& res, const CellAdecCb& callback, vm::bptr<void> core_handle,
|
||||||
s32 frames_num, vm::bptr<AdecFrame> frames, u32 bitstream_info_size, u32 bitstream_infos_addr)
|
vm::bcptr<CellAdecCoreOps> core_ops, s32 frames_num, vm::bptr<AdecFrame> frames, u32 bitstream_info_size, u32 bitstream_infos_addr)
|
||||||
: _this(_this), this_size(this_size), type(type), res(res), callback(callback), core_handle(core_handle), core_ops(core_ops), frames_num(frames_num), frames(frames), bitstream_info_size(bitstream_info_size)
|
: _this(_this), this_size(this_size), type(type), res(res), callback(callback), core_handle(core_handle), core_ops(core_ops), frames_num(frames_num), frames(frames), bitstream_info_size(bitstream_info_size)
|
||||||
{
|
{
|
||||||
ensure(this == _this.get_ptr());
|
ensure(this == _this.get_ptr());
|
||||||
@ -609,6 +608,8 @@ struct AdecContext // CellAdecHandle = AdecContext*
|
|||||||
{
|
{
|
||||||
new (&frames[i]) AdecFrame(i, bitstream_infos_addr + bitstream_info_size * i);
|
new (&frames[i]) AdecFrame(i, bitstream_infos_addr + bitstream_info_size * i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure(sys_mutex_create(ppu, _this.ptr(&AdecContext::mutex), _this.ptr(&AdecContext::mutex_attribute)) == CELL_OK); // Error code isn't checked on LLE
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] error_code get_new_pcm_handle(vm::ptr<CellAdecAuInfo> au_info) const;
|
[[nodiscard]] error_code get_new_pcm_handle(vm::ptr<CellAdecAuInfo> au_info) const;
|
||||||
@ -617,8 +618,8 @@ struct AdecContext // CellAdecHandle = AdecContext*
|
|||||||
void set_state(s32 pcm_handle, u32 state) const;
|
void set_state(s32 pcm_handle, u32 state) const;
|
||||||
error_code get_pcm_item(s32 pcm_handle, vm::ptr<CellAdecPcmItem>& pcm_item) const;
|
error_code get_pcm_item(s32 pcm_handle, vm::ptr<CellAdecPcmItem>& pcm_item) const;
|
||||||
error_code set_pcm_item(s32 pcm_handle, vm::ptr<void> pcm_addr, u32 pcm_size, vm::cpptr<void> bitstream_info) const;
|
error_code set_pcm_item(s32 pcm_handle, vm::ptr<void> pcm_addr, u32 pcm_size, vm::cpptr<void> bitstream_info) const;
|
||||||
error_code link_frame(s32 pcm_handle);
|
error_code link_frame(ppu_thread& ppu, s32 pcm_handle);
|
||||||
error_code unlink_frame(s32 pcm_handle);
|
error_code unlink_frame(ppu_thread& ppu, s32 pcm_handle);
|
||||||
void reset_frame(s32 pcm_handle) const;
|
void reset_frame(s32 pcm_handle) const;
|
||||||
error_code correct_pts_value(ppu_thread& ppu, s32 pcm_handle, s8 correct_pts_type);
|
error_code correct_pts_value(ppu_thread& ppu, s32 pcm_handle, s8 correct_pts_type);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user