mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
Added support for output sideband format query
This commit is contained in:
parent
f733ae8b86
commit
6a069ab02a
@ -13,8 +13,31 @@
|
||||
|
||||
namespace Libraries::Ajm {
|
||||
|
||||
constexpr int ORBIS_AJM_CHANNELMASK_MONO = 0x0004;
|
||||
constexpr int ORBIS_AJM_CHANNELMASK_STEREO = 0x0003;
|
||||
constexpr int ORBIS_AJM_CHANNELMASK_QUAD = 0x0033;
|
||||
constexpr int ORBIS_AJM_CHANNELMASK_5POINT1 = 0x060F;
|
||||
constexpr int ORBIS_AJM_CHANNELMASK_7POINT1 = 0x063F;
|
||||
|
||||
static std::unique_ptr<AjmContext> context{};
|
||||
|
||||
u32 GetChannelMask(u32 num_channels) {
|
||||
switch (num_channels) {
|
||||
case 1:
|
||||
return ORBIS_AJM_CHANNELMASK_MONO;
|
||||
case 2:
|
||||
return ORBIS_AJM_CHANNELMASK_STEREO;
|
||||
case 4:
|
||||
return ORBIS_AJM_CHANNELMASK_QUAD;
|
||||
case 6:
|
||||
return ORBIS_AJM_CHANNELMASK_5POINT1;
|
||||
case 8:
|
||||
return ORBIS_AJM_CHANNELMASK_7POINT1;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAjmBatchCancel(const u32 context_id, const u32 batch_id) {
|
||||
LOG_INFO(Lib_Ajm, "called context_id = {} batch_id = {}", context_id, batch_id);
|
||||
return context->BatchCancel(batch_id);
|
||||
|
@ -141,6 +141,8 @@ static_assert(sizeof(AjmInstanceFlags) == 8);
|
||||
|
||||
struct AjmDecMp3ParseFrame;
|
||||
|
||||
u32 GetChannelMask(u32 num_channels);
|
||||
|
||||
int PS4_SYSV_ABI sceAjmBatchCancel(const u32 context_id, const u32 batch_id);
|
||||
int PS4_SYSV_ABI sceAjmBatchErrorDump();
|
||||
void* PS4_SYSV_ABI sceAjmBatchJobControlBufferRa(void* p_buffer, u32 instance_id, u64 flags,
|
||||
|
@ -129,4 +129,15 @@ std::tuple<u32, u32> AjmAt9Decoder::ProcessData(std::span<u8>& in_buf, SparseOut
|
||||
return {1, samples_written / m_codec_info.channels};
|
||||
}
|
||||
|
||||
AjmSidebandFormat AjmAt9Decoder::GetFormat() {
|
||||
return AjmSidebandFormat{
|
||||
.num_channels = u32(m_codec_info.channels),
|
||||
.channel_mask = GetChannelMask(u32(m_codec_info.channels)),
|
||||
.sampl_freq = u32(m_codec_info.samplingRate),
|
||||
.sample_encoding = m_format,
|
||||
.bitrate = u32(m_codec_info.samplingRate * GetPointCodeSize() * 8),
|
||||
.reserved = 0,
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace Libraries::Ajm
|
||||
|
@ -34,6 +34,7 @@ struct AjmAt9Decoder final : AjmCodec {
|
||||
void Reset() override;
|
||||
void Initialize(const void* buffer, u32 buffer_size) override;
|
||||
void GetInfo(void* out_info) override;
|
||||
AjmSidebandFormat GetFormat() override;
|
||||
std::tuple<u32, u32> ProcessData(std::span<u8>& input, SparseOutputBuffer& output,
|
||||
AjmSidebandGaplessDecode& gapless,
|
||||
std::optional<u32> max_samples) override;
|
||||
|
@ -102,6 +102,9 @@ void AjmInstance::ExecuteJob(AjmJob& job) {
|
||||
m_gapless.skipped_samples = 0;
|
||||
m_codec->Reset();
|
||||
}
|
||||
if (job.output.p_format != nullptr) {
|
||||
*job.output.p_format = m_codec->GetFormat();
|
||||
}
|
||||
if (job.output.p_gapless_decode != nullptr) {
|
||||
*job.output.p_gapless_decode = m_gapless;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
virtual void Initialize(const void* buffer, u32 buffer_size) = 0;
|
||||
virtual void Reset() = 0;
|
||||
virtual void GetInfo(void* out_info) = 0;
|
||||
virtual AjmSidebandFormat GetFormat() = 0;
|
||||
virtual std::tuple<u32, u32> ProcessData(std::span<u8>& input, SparseOutputBuffer& output,
|
||||
AjmSidebandGaplessDecode& gapless,
|
||||
std::optional<u32> max_samples_per_channel) = 0;
|
||||
|
@ -192,4 +192,9 @@ int AjmMp3Decoder::ParseMp3Header(const u8* buf, u32 stream_size, int parse_ofl,
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
AjmSidebandFormat AjmMp3Decoder::GetFormat() {
|
||||
LOG_ERROR(Lib_Ajm, "Unimplemented");
|
||||
return AjmSidebandFormat{};
|
||||
};
|
||||
|
||||
} // namespace Libraries::Ajm
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
void Reset() override;
|
||||
void Initialize(const void* buffer, u32 buffer_size) override {}
|
||||
void GetInfo(void* out_info) override;
|
||||
AjmSidebandFormat GetFormat() override;
|
||||
std::tuple<u32, u32> ProcessData(std::span<u8>& input, SparseOutputBuffer& output,
|
||||
AjmSidebandGaplessDecode& gapless,
|
||||
std::optional<u32> max_samples_per_channel) override;
|
||||
|
Loading…
Reference in New Issue
Block a user