Add a developer setting to force using FFMPEG for audio decoding.

This commit is contained in:
Henrik Rydgård committed 2025-04-12 11:35:55 +02:00
1 parent f7ff2e2d20
commit 200edfaa96
5 files changed
+47 -11

No files matched your search

+1
View File
@@ -263,6 +263,7 @@ public:
int iDefaultTab;
int iScreenshotMode;
bool bVulkanDisableImplicitLayers;
bool bForceFfmpegForAudioDec;
std::vector<std::string> vPostShaderNames; // Off for chain end (only Off for no shader)
std::map<std::string, float> mPostShaderSetting;
+14 -5
View File
@@ -39,6 +39,7 @@ extern "C" {
#include "Core/FFMPEGCompat.h"
}
#include "Core/Config.h"
#else
@@ -136,15 +137,23 @@ private:
};
AudioDecoder *CreateAudioDecoder(PSPAudioType audioType, int sampleRateHz, int channels, size_t blockAlign, const uint8_t *extraData, size_t extraDataSize) {
bool forceFfmpeg = false;
#ifdef USE_FFMPEG
forceFfmpeg = g_Config.bForceFfmpegForAudioDec;
#endif
if (forceFfmpeg) {
return new FFmpegAudioDecoder(audioType, sampleRateHz, channels);
}
switch (audioType) {
case PSP_CODEC_MP3:
return new MiniMp3Audio();
// case PSP_CODEC_AT3:
// return CreateAtrac3Audio(channels, blockAlign, extraData, extraDataSize);
// case PSP_CODEC_AT3PLUS:
// return CreateAtrac3PlusAudio(channels, blockAlign);
case PSP_CODEC_AT3:
return CreateAtrac3Audio(channels, blockAlign, extraData, extraDataSize);
case PSP_CODEC_AT3PLUS:
return CreateAtrac3PlusAudio(channels, blockAlign);
default:
// Only AAC falls back to FFMPEG now.
// Only AAC normally falls back to FFMPEG now.
return new FFmpegAudioDecoder(audioType, sampleRateHz, channels);
}
}
+11 -2
View File
@@ -291,6 +291,12 @@ void DeveloperToolsScreen::CreateMIPSTracerTab(UI::LinearLayout *list) {
ClearMIPSTracer->OnClick.Handle(this, &DeveloperToolsScreen::OnMIPSTracerClearTracer);
}
void DeveloperToolsScreen::CreateAudioTab(UI::LinearLayout *list) {
using namespace UI;
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
list->Add(new CheckBox(&g_Config.bForceFfmpegForAudioDec, dev->T("Use FFMPEG for all compressed audio")));
}
void DeveloperToolsScreen::CreateGraphicsTab(UI::LinearLayout *list) {
using namespace UI;
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
@@ -402,11 +408,14 @@ void DeveloperToolsScreen::CreateTabs() {
AddTab("General", sy->T("General"), [this](UI::LinearLayout *parent) {
CreateGeneralTab(parent);
});
AddTab("TextureReplacement", dev->T("Texture Replacement"), [this](UI::LinearLayout *parent) {
CreateTextureReplacementTab(parent);
});
AddTab("Graphics", ms->T("Graphics"), [this](UI::LinearLayout *parent) {
CreateGraphicsTab(parent);
});
AddTab("TextureReplacement", dev->T("Texture Replacement"), [this](UI::LinearLayout *parent) {
CreateTextureReplacementTab(parent);
AddTab("Audio", ms->T("Audio"), [this](UI::LinearLayout *parent) {
CreateAudioTab(parent);
});
AddTab("Tests", dev->T("Tests"), [this](UI::LinearLayout *parent) {
CreateTestsTab(parent);
+1
View File
@@ -21,6 +21,7 @@ private:
void CreateHLETab(UI::LinearLayout *parent);
void CreateMIPSTracerTab(UI::LinearLayout *list);
void CreateTestsTab(UI::LinearLayout *list);
void CreateAudioTab(UI::LinearLayout *list);
void CreateGraphicsTab(UI::LinearLayout *list);
UI::EventReturn OnRunCPUTests(UI::EventParams &e);
+20 -4
View File
@@ -957,6 +957,7 @@ void DrawAudioDecodersView(ImConfig &cfg, ImControl &control) {
}
if (ImGui::CollapsingHeader("sceAtrac", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::Checkbox("Force FFMPEG", &g_Config.bForceFfmpegForAudioDec);
if (ImGui::BeginTable("atracs", 8, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
ImGui::TableSetupColumn("Index", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("Mute", ImGuiTableColumnFlags_WidthFixed);
@@ -1851,6 +1852,10 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
System_CopyStringToClipboard(StringFromFormat("%016llx", (uint64_t)(uintptr_t)Memory::base));
}
}
ImGui::Separator();
if (ImGui::MenuItem("Close")) {
g_Config.bShowImDebugger = false;
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Core")) {
@@ -1969,11 +1974,22 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
ImGui::MenuItem("Dear ImGui Style editor", nullptr, &cfg_.styleEditorOpen);
ImGui::EndMenu();
}
// Let's have this at the top level, to help anyone confused.
if (ImGui::BeginMenu("Close Debugger")) {
if (ImGui::MenuItem("Close")) {
g_Config.bShowImDebugger = false;
ImGui::EndMenu();
}
switch (coreState) {
case CoreState::CORE_STEPPING_CPU:
if (ImGui::MenuItem(">> Run")) {
Core_Resume();
}
break;
case CoreState::CORE_RUNNING_CPU:
if (ImGui::MenuItem("|| Break")) {
Core_Break(BreakReason::DebugBreak);
}
break;
default:
break;
}
ImGui::EndMainMenuBar();
}